Physics Help with Flipping Gravity

I am making a game where when you tap the screen, the gravity flips. There will be massive saws coming at you and you need to dodge them. I need help with making the floors actually function as a floor. You need to stop, no matter what, when you hit them, but still be able to go up once the gravity flips. @CodeHelp WIP:


@CreationsOfaNoob, @ThinBuffalo and @Petrichor knows this kind of stuff (correct me if I’m wrong).


Ooh fun.
I think fearless might be able to help, I’ll get them to check out your draft and see if they can do anything for ya.


IDK if this will help but you should take a look

Edit: I misread your post originally, you need to stop completely when you hit the floors. Just set gravity to 0 when distance y between man and self is less than some number. Also, only do it gravity is pulling towards the object. You may need to use multiple rules for each clone index of floor.


That’s what I applied in my code, also when you tap, a variable called antigravity changes


Yeah, that was helpful but I don’t think it should bounce.

@Petrichor, that is what I did. However, if you were coming at the floor at any large velocity, you would sink through it. And, if you flipped just before you hit the floor, you could go through it completely because you were the other way around and therefore the rule wasn’t triggering. That is the problem I don’t know how to fix.

1 Like

Really sorry! I just realised that in my project, the man bounced. That was just me experimenting.

Here is the actual link:

1 Like

Then if you use a clone index 1 rule and a clone index 2 rule, you can just check if man y position is less than self y position+ something for clone index 1, and the opposite for 2.


Sounds like a good game, but I’m not good with that kind of code.
I agree with @William04GamerA though, they do know a lot about that type of code.

1 Like