I want to know how I can switch gravity in @awc95014’s platformer enjine
Could you please elaborate more in what you want to achieve? “switch gravity”?
I believe what he wants is to make gravity take the player up rather than down.
Here’s a quick trick to do this:
Don’t try to reverse gravity when you can just flip the screen around!
Add this into the default script of the frame:
this.project.rotation=-180; // Flip the screen upsidedown
This way, gravity will be upside-down
To set it back to normal, you can use this:
this.project.rotation=0;
I mean when you jump you switch your gravity like in this game https://www.coolmathgames.com/0-mini-switcher
inside the player, i think there’s a variable called this.gravity. it is set to some number, i don’t remember what number exactly. if you invert that number (make it negative if it’s positive and vice versa), then I think (THINK) it will flip the gravity.
(not tested)
That’s part of it… he may also need to switch the initial jump force to the opposite direction and probably some other minor tweaks.
I got the first gravity change but I cant figure out how I turn it back My Project4-7-2021_18-42-48.wick
I know that you can figure that out by yourself… small hint… declare project global variables for gravity, and consume that variable inside your player(s) or character(s)… when you hit jump, change that global value…