Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 29/06/2003 09:28:44

Title: question about character animation
Post by: on Sun 29/06/2003 09:28:44
i was creating my game some months ago... ive quit to create a new one, but i still got a question unanswered:
so, there was a room with a teleporter hotspot, when the character moved onto it it played the animation of my character dissappering... then it transfers him into another room, with a similar teleporter... i want to play an animation of my character`s appearance from the teleporter... if i used a script in "when enters room", it would be okay, but what if my char enters then room from another way - the animation of teleportation will be still played... have any solutions?
Title: Re:question about character animation
Post by: Scorpiorus on Sun 29/06/2003 12:03:21
Yes, the solution is to set a global int in order to distinguish between teleportation and a normal enter:

when you teleport him:

AnimateCharacter(<teleport animation>);
SetGlobalInt(1, 1); // character is teleported
NewRoom(<teleport him there>);



on player enters room:

if (GetGlobalInt(1) == 1) { // if char was teleported
AnimateCharacter(<appearance animation>);
SetGlobalInt(1, 0); // don't forget to reset global int
}


-Cheers
Title: Re: question about character animation
Post by: The Electrician on Wed 21/04/2010 23:26:17
Another solution is simply to check the position of the character when s/he enters the room. I do this when I have my character come out a door and make the closing door animate. It saves you the global variable.

In programming, it is generally bad practice to use global constants unless strictly necessary. It makes for messy code as you have more and more of them. General rule: keep variables as local as possible, or don't use any if they can be derived from other variables.
Title: Re: question about character animation
Post by: Khris on Wed 21/04/2010 23:53:43
Wow. This thread is almost SEVEN YEARS OLD. That's got to be a new record.