Author Topic: View offset after a one-off animation  (Read 1358 times)

View offset after a one-off animation
« on: 30 Oct 2009, 00:39 »
Hi guys,

I've searched the forums for an answer to this problem, and unfortunately I've only seen answers that don't quite help.

I have a character who has to play a one-off animation of jumping backwards. This is fine in and of itself - the animation plays fine in-game and the start of the animation is nicely lined up with where the character is to begin with.

The problem is that once the animation has finished it unlocks the view and, of course, the player character jumps back to where they started.

I'm currently using LockViewAligned (aligning to the left), but obviously it only aligns the jump animation. Is there some way of aligning the normal view, after you unlock it, to the last frame of the previous animation?

Hope this makes sense - it's driving me crazy.  ???

I realise that I could manually modify the characters X/Y values to move them into the right place, but it feels like there should be an easier method.

Calin Leafshade

  • Long live King Cat!
    • I can help with making music
    • I can help with voice acting
    • Calin Leafshade worked on one or more games that won an AGS Award!
    •  
    • Calin Leafshade worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #1 on: 30 Oct 2009, 05:19 »
The X/Y positions denote the centre bottom of the sprite and thus the location of the character.

If the character has jumped back then he has MOVED position, therefore you need to change the x/y position since he isnt in the same place he was before.

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #2 on: 30 Oct 2009, 11:19 »
Yeah, unfortunately, AGS doesn't have an AI that analyzes sprites and determines position changes automatically. ;)

Re: View offset after a one-off animation
« Reply #3 on: 30 Oct 2009, 11:44 »
Yeah, unfortunately, AGS doesn't have an AI that analyzes sprites and determines position changes automatically. ;)

... Yet

CJ, get to work, you lazy slob! :P

Calin Leafshade

  • Long live King Cat!
    • I can help with making music
    • I can help with voice acting
    • Calin Leafshade worked on one or more games that won an AGS Award!
    •  
    • Calin Leafshade worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #4 on: 30 Oct 2009, 13:09 »
I'm still waiting for the 'Make My Game For Me, Its About Zombies' button.

Re: View offset after a one-off animation
« Reply #5 on: 31 Oct 2009, 14:58 »
Okay, well I've done it now by changing the x position of the character manually after unlocking the view.

I don't see why there couldn't be an unlockViewAligned method though. If one can lockViewAligned to the left, centre or right of the previous frame, then surely you should be able to do the same thing again afterwards?

Just a suggestion, and of course that's not for this forum  ;)

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    • I can help with characters
    • Lifetime Achievement Award Winner
    • I can help with making music
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • Shane 'ProgZmax' Stevens worked on one or more games that won an AGS Award!
    •  
    • Shane 'ProgZmax' Stevens worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #6 on: 02 Nov 2009, 20:56 »
I'm not even sure why you're using Lock and Unlock anyway.  CJ made them almost entirely obsolete when he gave views infinite loops.  You could quite easily make loops down to 14 for the walk view and place your backwards jump animation there and just run it, update player x, then set loop to whatever you want.  No muss, no fuss.

Calin Leafshade

  • Long live King Cat!
    • I can help with making music
    • I can help with voice acting
    • Calin Leafshade worked on one or more games that won an AGS Award!
    •  
    • Calin Leafshade worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #7 on: 02 Nov 2009, 21:09 »
I find lockview to be useful from an organisational standpoint.. they keep the animations seperate and easy to access... Though you are right they are not needed.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #8 on: 02 Nov 2009, 21:38 »
There is the benefit that when you call UnlockView it stops any current animation you might be (repeatedly) running on that character. AFAIK there's no other way of stopping that is there? Does changing the Loop/Frame stop animations?

Oh, also as per the manual:

Quote
Before using this command [(Character.Animate)], you should use LockView in order to select the view you want to animate with and prevent any automatic animations (eg. walking or idle animations) from playing.

So there's also the benefit of preventing automatic animations overriding a custom animation. Not completely deprecated...

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    • I can help with characters
    • Lifetime Achievement Award Winner
    • I can help with making music
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • Shane 'ProgZmax' Stevens worked on one or more games that won an AGS Award!
    •  
    • Shane 'ProgZmax' Stevens worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #9 on: 03 Nov 2009, 21:59 »
Idle animations won't interrupt a blocked animation regardless, and if you're triggering a noblock it's trivial to turn idles off and on again.  Heck, you could write a simple wrapper function to do a nonblock animation with disabling the idle anim if you wanted.  I've never run into an issue with it in the many, many, many animations in my games, though.  An easy way to stop a loop is to re-run that same loop (or a walkcycle, or whatever) noblock and no repeat (or play it blocking if interruptions don't matter). 

Pumaman

  • Creator of AGS
  • I sense danger.
    • Lifetime Achievement Award Winner
    • Pumaman worked on one or more games that was nominated for an AGS Award!
Re: View offset after a one-off animation
« Reply #10 on: 04 Nov 2009, 21:04 »
I see what you mean, there could be an UnlockViewAligned too. But generally, it's assumed that all frames of a particular animation will be the same size which is why this is not currently provided.