Ask here your questions to get help using GDevelop.
By wombocombo
#62822 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.
Please let me know ASAP!
Thanks,
wombocombo :)
By wild master
#62826
Lizard-13 wrote: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.

the character walks around the platform without falling off.png
the character walks around the platform without falling off.png (3.47 KiB) Viewed 981 times
User avatar
By Lizard-13
#62841 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 :D 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 :)
User avatar
By ddabrahim
#62843 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"
By MattLB
#62854 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)?

walkround.png
walkround.png (1.23 KiB) Viewed 931 times


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.
By wombocombo
#62971
Lizard-13 wrote: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 :D 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 :)




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.
By wombocombo
#62972
MattLB wrote: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)?

walkround.png


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 for the reply! hat game mode would I use?