How do I get to properly control a Bouncy Ball in GDevelop?

I am in the progress of making a game similar to Phases, a 2D platform game where players control a little ball of light and must overcome all the obstacles that come their way.

I have just started making progress on the game a few days ago and right now I am doing some work on the tutorial level for the game, I have managed to create the ball that the player will control along with the buttons to control said ball.

This is how it looks like right now:
IMG_0707

Is there anyway to add a tap and hold touchscreen mechanic to control the ball?

And is there anyway I could get the ball to bounce properly?

sounds great - what code and behaviours have you got for the ball? it’s behaving very strangely

1 Like

i just tried it with physics 2 - plus a multitouch joystick and it works well


1 Like

Well…

for the actions of the Ball Sprite I added a permanent force with the angle between 0 and 359 degrees and 100 pixels in length, I then added a Bounce Behaviour to the Sprite along with the 2D Physics, Smooth Camera and Top Down Movement Behaviours, I had also added the 2-D physics behaviour to the platform for the ball to bounce on.

I later used the 3 arrow buttons to control the ball, I could show you some photo examples of them if you like.

ahh that’s why its wobbling about in a weird way. Do you want it to do that? Do you really want a permanent force on it? It’s generally frowned upon mixing the old physics action with physics2 behaviour. I just sent it 180 degrees when pressing left and 0 when pressing right.
you need to do it at object.masscenterx() and object.masscentery()

when you press up i increase the momentum by adding adown force when its going down and up force when going up.

3 Likes

Right! I’m gonna test it out right now, should I remove the permanent force or?

Hi Yes - i don’t think you need a permanent force. The ball already has a permanent force with physics 2 - you just need to add a gentle push in the direction you want it to go in. So 0 degrees is right and 180 or -180 is left.

2 Likes


Could you explain why? It’s a side scroller using physics, so I don’t understand why you’d add this.

2 Likes