Inverted Gravity Option for Platformer Behavior

I have a small suggestion to make that might be helpful.
It would be cool if there was a new option under the Platform Character behavior that inverts their gravity. Not only that, but when they walk on the ceiling while their gravity is inverted, it counts as being on the floor, so that “On Floor” conditions could work with the inverted gravity.
Additionally, there should be a new action for the Platformer Character that will invert the gravity, and then invert it back again, such as “Invert Gravity? Yes / No.” This could be super useful for those games where you can change gravity.
The reason I am posting this suggestion is because I made a prototype game no too long ago in which the gimmick is that you can change not only your own gravity, but the gravity of everything else as well. I tried to accomplish this by setting the gravity to a negative value. However, GDevelop does not seem to like negative values. When the character’s gravity is negative, it keeps accelerating upwards, no matter what, eventually clipping through the floor. I tried looking up solutions for this problem on the forums, but not a single one had a solution. Meanwhile, Construct 2 and 3 can pull off this problem quite effortlessly, which is very disappointing. Alas, since inverted gravity is not allowed in GDevelop, and since there are no known solutions, I was forced to abandon my game idea. :frowning:
So yeah, anything that could make inverted gravity possible in GDevelop will be greatly useful. Thank you all for listening. Please like this so 4ian could see this and possibly? put this on the Trello roadmap.

Finally, what do you guys think about this suggestion? Any feedback is appreciated!

2 Likes

:thinking: last time I checked it was a cpp extension, and cpp is much more tidious to write than Js. I will look into it but can’t promise anything.

Actually, I think I can implement it. Didn’t read the whole code yet but found already two spots needing changes. I will add it with a function get gravity (expression), a function toggle gravity (action), set gravity to true/false (action), and a condition gravity inverted, and add the property _invertedGravity (default false). Changes needed(as far as I saw):

  1. The ladders. I will need to make a check if this._invertedGravity, and if false do like always, else negate the end value.
  2. Check gravity inversion and instead of lifting a bit the y up on x handling making it a little lower on inverted gravity.

I will update this post while investigating.

It will take some time to implement tho as my PC is broken so I need to use someone else’s PC and I don’t have always access to it unlike mine.

1 Like

Please add this! Currently you have to do a lot of workarounds to make antigravity work.