GameMaker (2.0 - 2.2.x)
Icon

Animation Sequence

Jacob Copsey

You must be logged in to obtain assets

Description

Create custom animation sequences that eliminate duplicate frames in your sprites.

  • Include sprite frames in any order
  • Include the same sprite frame more than once
  • Have different display durations per frame
  • Call a function to determine how many times the animation has played all the way through

This set of scripts allow you to create an animation sequence and then call a function in your draw event to calculate which sprite image_index to draw for the current step. The scripts will keep track of how long each animation frame should be displayed and which sprite image_index to draw for the current animation frame.

See the included demo project or the screenshots here for example code to implement an animation sequence in an object's Create, Draw, and Clean Up events.

When adding to your own project just import the scripts.

Script overview:

animation_sequence_create();

Creates a new animation sequence and returns the id.

animation_sequence_add_frame(sequence, image_index, steps);

Add a frame to an animation sequence.

  • sequence: the animation sequence id returned from animation_sequence_create
  • image_index: the image_index for this animation frame
  • steps: the number of steps to show this image_index for

animation_sequence_next_image_index(sequence);

Returns the image_index to draw for the current step.

animation_sequence_completed_count(sequence);

Returns the number of times the animation has been completed played.

animation_sequence_destroy(sequence);

Destroys the animation sequence.

End User Licence Agreement (EULA).

Age Rating: None

Version

GMS2 - Version 1.0.2. Published April 7, 2017

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait