How do I make the head bounce around as I move the player? [SOLVED]

Note 1: Please be polite. I didn’t have the best experience the first time I asked a question in the GDevelop community. As a precaution, I kindly ask you to consider that I’m very new to GDevelop and game development as a whole, so I may not know the correct terms. I learn by experimenting rather than using tutorials and only turn to them when I do not know what to do.

Note 2: I had to remake this entire post because of the fact new users can only post one image at a time… I have gifs explaining my problem if it is needed, but if this second rendition is poorly explained, this was because I was already tired from trying to fix the problem alone AND having to create images and texts explaining it.

Note 3: Bolded the text that is important for convenience.

Note 4: Edited unimportant things.


The events:


I tried making a cute bouncing effect as the player’s character walks.

It works well when moving left or right (thanks to the head’s consistent X position), but the up and down movement is a bit off. The head doesn’t stick properly to the body, especially when walking diagonally or vertically.

Whenever I try to make the head follow the body using other events, it messes up the bouncing effect. I think it’s because pulling it towards the body prevents the head from going too far, giving me my current issue.

I hope that makes sense; my understanding of GDevelop is mostly based on guesses…

I’m using the Tween and Top-Down Movement behaviors for both the head and the body. The Top-Down movement was added to the head when my initial attempt didn’t work and I forgot to remove it.

I don’t want to switch to using animations unless GDevelop has a limitation. I want to learn by figuring this out without relying on animations.

Thanks for reading!

Hi @uselessthrowaway

I’ve done something similar in the past and I’ll show you how I managed to make it work.

First thing, tweens should only be triggered once and not on every frame, or else the tween will keep starting over and over and won’t work.

Having said that, when the player is moving, it’s position is constantly changing. So if you’re trying to tween the position of the head while the body is also changing position, the head will keep trying to catch up with the body and won’t stay where it should be.

Instead, you need to tween a number variable, from 0 to -5 back and forth, and on every frame keep the head’s Y position = body’s Y position + this number.

Hope this makes sense.

1 Like

Thank you! Sorry for the late reply, but when I hopped back on GDevelop today, it worked! Must’ve skimmed a mention about tweening variables because it’s extremely useful. :grin:

I’ve also found a way to add a delay to the head’s movement, which is admittedly a strange feature but was my original intention! Thank you so much for your help!

1 Like

No problem! Happy to help.

1 Like