How to animate sprite with a keypress/release

I’m new to GDevelop and i have ran into a problem
Im trying to make a sprite Change animations when i press a key and then change back to another animation when i release that same key.

However when i try to put the events right next to eachother the animation never plays regardless of me pressing the key or not

any help would be appriciated ^^

Hi, you have two diverging conditions in one event block. At the moment you have to press and release the s key at the same time. Even if that would be possible two animations of your sprite cannot play at the same time. So you have to use two event blocks.

A big suggestion from my side is to make one or two of the tutorial projects, they cover all the basics of the engine and how the event system works GDevelop 5 tutorials [GDevelop wiki]

3 Likes

thanks for the help ^^

I also have a question, how can i round a number to a certain decimal place?

There are several expressions to round a number, for example:
round(number); roundTo(number, number)

You can read about all expressions here and choose one that fits your case. Expressions reference [GDevelop wiki]

Aside from that, if you search the forum there is a big chance that this kind of question has been asked before. :slightly_smiling_face:

2 Likes

thanks for all the help ^^