How do i code the movements of a character

So, this is the first time i am using Gdevelop to create my first game as i never developed a game before and i don’t know almost nothing about coding. The objective of the game is to deliver boxes to houses with a balloon. Before yesterday i started to work in the project, making placeholders to test the engine. After making the placeholders, i started to work in the events of the new scene. The first thing i did was add a instant force to the balloon move up when a key is pressed and it went easier and better than i thought but after i decided to add another instant force when a key is released in another condition but after doing this, the balloon couldn’t get off the ground. So i decided to add permanent force to the key is released. Now the balloon at least get off the ground when i press the key to the balloon fly up and also when i release the same key, the balloon falls slowly as planned but every time i press the space again, the balloon fly each time more slower and every time i release the same key, the balloon falls each time more faster. I just want to know how do i make the balloon to increase the force until a limit as long as i press and release a key without happening the same thing i described before? And also, how do i make the balloon move left or right just when i am pressing a key and just when the balloon is in the air?

Heya, might not be able to answer all of that, but for some specific questions:

“the balloon fly each time more slower and every time i release the same key, the balloon falls each time more faster”
This is because you didn’t stop the permanent force that makes the balloon go down.
You can view Permanent force like an invisible conveyor belt/escalator - once you activate it, you need to stop it. [In the event that adds the permanent force, add an event called “Stop all forces”, and put it BEFORE the add a Permanent force event/action. You also have to use this to stop the balloon when it’s on the ground]

" I just want to know how do i make the balloon to increase the force until a limit as long as i press and release a key without happening the same thing i described before?"
The quickest way to add a limit is edit the balloon object, add a new behaviour, find the
one that makes your balloon stay on screen - I don’t remember the name but it probably looks like arrows inside a box.

“how do i make the balloon move left or right just when i am pressing a key and just when the balloon is in the air?”
Pretty similiar to making the balloon go up when you press Space - add condition that checks for key pressed, and if the ground is a Sprite object, add a condition that checks if the balloon object is currently NOT colliding with the ground object.
You select the “NOT” by first choosing the regular “object is currently colliding with another object”, choose the objects, then there’s a little switch that says “Invert condition”.
Then, add actions to add instant force to the balloon horizontally - so using the Y axis.

If you need more help, it would be a lot easier if you screenshotted your events (on Windows, use the built-in Snipping Tool)
Also, what kind of game are you making? Context would also help.
Either way good luck!

Yes, you helped a bit but in relation to activate the right and left button only if space is pressed, didn’t work as the way i wanted and also i have another problem. After i fly up the balloon, the tile under the balloon loses collision. Also the problem of the up force persists, even if is less worse than before. Here is a screenshot of the scene:

I want to make something similar to Balloon Fight.

Thanks to that great info by Cat I would suggest maybe try putting “Stop All Forces” as the first action of the “Space key pressed” condition. Because it looks like right now you are stopping the up force when the space key is released, but you aren’t stopping the down force when the space key is pressed.

Secondly, if you want to do a Space + Right Key is pressed, you need to put them in the same event underneath each other (not in 2 separate events). If you want the Right or Left Key to have an effect without the Space Key pressed then you put that in a separate event (as you have already done for the Right Key).

1 Like

On “Space key is released” event, can you change the force to ‘instant’ instead of ‘permanent’ and mention what happens? I think that will stop the balloon from falling down so rapidly each time you release Space

If i do that, the balloon don’t fall.

Thank you very much! The first worked but the second, the balloon don’t goes to the right if i do this.