question about character animation

Started by better than Shanon, Sun 29/06/2003 09:28:44

Previous topic - Next topic

better than Shanon

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?

Scorpiorus

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

The Electrician

#2
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.

Khris

Wow. This thread is almost SEVEN YEARS OLD. That's got to be a new record.

SMF spam blocked by CleanTalk