# Staying on the Down-Low

Hey guys!
I was wondering if any of you new how to keep your character staying feet down on the floor.
So, for example, If I made a square platform and my character were to walk all the way to the right/left, it wouldnâ€™t fall, it would keep walking, but on a different side.
Thanks,
wombocombo

Not sure what you are talking about, do you want to put multiple platforms aligned?

He wants to walk around a platform like Super Mario walks around planets in Mario Galaxy games. He doesnâ€™t fall off of the sides of the planets. He just walks around them.

You should create a sample project for him with a rectangle and a character. When the character walks past the tip of the rectangle, he must not fall off. He should start walking on the next side of the rectangle.

Look at the character in my picture below. When he walks past the edge of the platform, he doesnâ€™t fall. He walks on the edge of the platform. He can walk all around it.

This would be very trickyâ€¦ The platformer behavior support only a positive and (maybe) a negative gravity, never horizontal gravity, so platformer is not a good idea
Since the character can stand in only one platform at a time, maybe you can link a character and a platform, and then do tricky maths to detect the platform side the character stand at, and move/roate it in function of the side. Of course if the character collides with other platform different than the one itâ€™s â€ślinkedâ€ť, you could switch the platform link and fix the character to stick to the new platform.
As I said, it would need some math to detect the side of the platform to stick at. you should play with widths/heights/xs/ys, not funny at all What do you want it for?, an old-style AI (you know, those old bugs/slimes that walk all the way around)?

EDIT: Thinking about itâ€¦ The maths could be not soooooo tricky if you use points in a smart way, for example put the Centre point of the character at the center on X and bottom on Y (middle of the feets). And on the platform add 4 points (or calculate 4 variables), one for each vertex. This setup would make it easier to know in wich side the character is at, and rotate over the platform without changing the maths, because the Center point will stand over the platform, at the same position

In case the platform always square (never circle) and you donâ€™t want smooth side to side movement, and you donâ€™t want the camera to follow the rotation, maybe can be done by simply creating 4 different character objects used on the 4 different sides and create your own platformer behaviour so you can apply custom controls and gravity for each character and simply swap the characters and change the position at the edge of the square depends on which side of the square is next.
Or you can also use a single object and rotate it on the edge and change the controls and gravity based on it rotation.

To create your own platformer engine, an example is included with gdevelop called â€śCastle Doodle Platformerâ€ť

Along the lines of Lizard-13â€™s idea with 4 points, how about using 4 â€śrotatorâ€ť objects (a bit like the goleft object in the demo projects)?

When the player collides with a red square object (which would be invisible in the game):

deactivate the platformer behaviour
stop all forces
change angle of player object to 0, 90, 180 or 270 (each rotator instance has a different angle, stored in an object variable)
apply a small force at the new angle of the object to move it off the corner and along the new edge a bit

Thereafter the â€śrightâ€ť key would move it in that direction by adding a force with the same force angle until the next rotator object is reached.

The rotator objectâ€™s size and position would have to be matched to the player object so that the player rotates at the correct time and at the correct distance away from the platform so that it looks like it is standing on it after the rotation happens. This could be too much work if there are lots of platforms like this.

Presumably pressing the jump button would â€śbreakâ€ť the sticking effect by reactivating the platform behaviour.

thank you all so much for the replies! Iâ€™m sorry I saw them so late. I was using the idea for a game called Gravity Cow.

thank you for the reply! hat game mode would I use?