Discord
Login
Community
DARK THEME

how to stop animation after input

I want to stop the animation after a mouse click here's my code. init = function() end

update = function() end

draw = function() screen.drawMap( "map", 0, 0, 600, 200 ) screen.drawSprite( "sprite", 0, -70, 180, 0 ) end

I've tried everything, and I'm new to micro studio

whate you can do is

init = function() sprite = "my_animated_sprite" frame = 0 is_playing = true end

update = function() if keyboard.pressed.SPACE is_playing = false end

if is_playing frame = (frame+1)%sprite_get_frames_count(sprite) end end

draw = function() screen.clear() screen.drawSprite(sprite,200,200,100,100,0,0,frame) screen.drawText("Druk op SPATIE om de animatie te stoppen",320,380,20,"#FFFFFF") end

(hope it works)

thanks

guys, to share code in a "pretty" form you can use this ``` in the beggin and in the final of the text ex

if keyboard.X then
  print("blue")
end

just to help (^-^) > > <3

@warrior thank you for tip

@warrior great coding tips ur good

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community