• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

LOST: play animation on button press then stop and change to default

D

Dibb

Guest
Hey, Ive been looking on the forum for a while about this (i like to figure things out for myself, but it isnt happening)

I am trying to play an animation on (for arguements sake space key) and the animation plays completely and returns to default animation, however I have somehow got it so the key needs to be held to complete animation and then it loops.

I want to press space, animation complete and return to default animation.

Ive read alot about :-

Code:
if (image_index >= image_number - 1){
 image_speed = 0
 }
but it isnt working, am on very bad net(3g/4g costing £10 for 5GB, which includes my son and fortnite....blah) So youtube videos are to slow or taking up much needed fortnite bandwith/shut the whingebag up

i think am mixing DnD with GML to much and have crossed wires that i cant figure out.

Am looking for a simple example of press key(complete animation regardless of it held or button mashed then return to default animation)

Also am terrible at explaining myself so this is probs a puzzle in itself :D
 

mar_cuz

Member
In Step event: if keyboard_check_button_pressed(vk_space) { sprite_index = other_sprite;}

In Animation end event: if sprite_index = other_sprite { sprite_index = default_sprite;}

This is a very basic example and doesn't account for any other code you might have that changes your sprites. It should work though.
 
Top