Drag And Drop [SOLVED] Frame by frame animation: Frame switching by pressing a button



Hey there!
I need to animate my intro sequence frame by frame and I want that every time a button is pressed it changes to one frame forward. How do I do that?
The attached file is how I achieved this in Stencyl, but I don't know how to translate this into Game Maker Studios Drag and Drop system!
Please please help me!


Last edited by a moderator:
Within the object showing the intro:

if keyboard_check_released(whatever)
{if image_index < image_number - 1
{image_index += 1}
{is at end of images - do whatever}}

Look under 'gameplay' / 'mouse, keyboard and other controls' / 'keyboard input' in the manual for the keyboard controls. You want to use key released so that the input is only registered once - as the command suggests, when the key has been registered as pressed and then released.

You want the image_speed to be set to zero, so it doesn't play automatically.

image_index refers to the frame of the sprite.

image_number refers to the number of frames the current sprite has. This will work only if the object has been given the intro as a sprite by way of setting the sprite_index. Frames start at zero, so this overall number of frames is one less than the total.

The else part of the statement just deals with whatever you want to happen when image_index reaches the end of the animation.

That should be enough to get you started :)