Animation

From Game Editor

Jump to: navigation, search

To add an animation, click the 'add' button on the actor control next to 'animations'.

Browser for an animation file, which can be a single frame or image, multiple images (only if named in sequence: run00.png, run01.png, etc.), or animation strips. To use a strip, select the file and adjust the number of horizontal or vertical frames.

You can also adjust the speed of the animation.

To initialize an Actor with an animation, choose it from the animations list on the actor control panel.

To Change Animation: ChangeAnimation("Event Actor", "animationname", FORWARD); You can also use a specific actorname, such as ChangeAnimation("enemytank", etc. You can also use Collide Actor and Creator Actor.

You can set the direction to FORWARD, BACKWARD, and NO_CHANGE;

NO_CHANGE will leave it on the same direction it was before this was called (forward is usually the default), and will start it from the current frame.

So if you have a repeating event that changes it to NO_CHANGE (when it was forward to begin with), it will play normally, and loop normally.


You can also use the event AnimationFinish to trigger another event, such as turning this animation backwards, or changing to a new one.

To adjust the direction without changing the animation, use ChangeAnimationDirection("Event Actor", BACKWARD);

You can query an Actor's animation by using the variable animindex; however, this will only return which animation(by order in the list) the actor is using. You cannot use this to change the animation.

You can also control an animation using the variable animpos.

animpos++; 

will increase the frame. This is especially usefull for shooting games, where an enemy flashes when hit, then switches back. Load a 2frame animation strip, with one normal and one glowing, then on actor>collision>otherActor>script editor>

animpos=1;

and in actor>draw actor>script editor>

animpos=0;

The actor will flash when hit, then return to the normal animation frame.