About character animation state switching

	if action_id == hash("up") then
		position.y = position.y + 1
		if action.pressed then
			sprite.play_flipbook("#player", "up", function() os.exit() end)
		elseif action.released then
			sprite.play_flipbook("#player", "idle-up", function() os.exit() end)
		end

I’m using this judgment for playback now and it works but it’s not elegant, is there another way?

Switching the animation based on input state is totally acceptable. One thing though is how you update the position. You should update the position in update() and apply the delta time to ensure frame rate independent movement. Like in this example: Move forward

1 Like

thx man