Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to add Anti-Gravity to a Platformer Game?
- 8BlTPENGUIN
-
29 posts
How to add Anti-Gravity to a Platformer Game?
I'm creating a platformer game and I want a Jetpack Joyride-like thing that activates when you press the space bar.(Where you go to the ceiling or floor when you press Space) I also want to make it where you can't go through platforms and stuff without adding a ton of sprites and scripts. Sorry if this sounds kind of confusing. Click here to see the project.
Last edited by 8BlTPENGUIN (Feb. 3, 2016 01:52:01)
- Ataxaos
-
500+ posts
How to add Anti-Gravity to a Platformer Game?
Last edited by Ataxaos (Feb. 3, 2016 03:49:10)
- Ataxaos
-
500+ posts
How to add Anti-Gravity to a Platformer Game?
This doesn't answer the user's question. Check it out:
https://scratch.mit.edu/projects/89351420/
Please don't advertise your own projects that are only loosely relevant to the topic.
Feel free to advertise as much as you want on “Show and Tell”, though.

- zp100
-
100+ posts
How to add Anti-Gravity to a Platformer Game?
This doesn't answer the user's question. Check it out:
https://scratch.mit.edu/projects/89351420/
Please don't advertise your own projects that are only loosely relevant to the topic.
Feel free to advertise as much as you want on “Show and Tell”, though.
I was showing my project that has anti-gravity scripts.
- Ataxaos
-
500+ posts
How to add Anti-Gravity to a Platformer Game?
It doesn't. I did check before posting - your project only has regular gravity scripts. I was showing my project that has anti-gravity scripts.
By anti-gravity, the topic owner meant the ability to switch between gravity pulling up or pulling down.
Besides, even if your project did contain anti-gravity scripts, the project does not explain how to do it.
For example, posting a platformer game does not answer the question “How do I make solid platforms?”
Anyway, just trying to tell you there are way more better places to advertise, like in your signature.

- zp100
-
100+ posts
How to add Anti-Gravity to a Platformer Game?
It doesn't. I did check before posting - your project only has regular gravity scripts. I was showing my project that has anti-gravity scripts.
By anti-gravity, the topic owner meant the ability to switch between gravity pulling up or pulling down.
Besides, even if your project did contain anti-gravity scripts, the project does not explain how to do it.
For example, posting a platformer game does not answer the question “How do I make solid platforms?”
Anyway, just trying to tell you there are way more better places to advertise, like in your signature.
Okay, thanks. In the Player sprite, there are scripts that include “change y by ((2) * (gravity)”. When you press space, the gravity switches. It's exactly what 8BlTPENGUIN was asking for.
- Ataxaos
-
500+ posts
How to add Anti-Gravity to a Platformer Game?
Ah, I didn't know you had to press space in mid-air to change the gravity; my bad, I apologize! Okay, thanks. In the Player sprite, there are scripts that include “change y by ((2) * (gravity)”. When you press space, the gravity switches. It's exactly what 8BlTPENGUIN was asking for.
Maybe put that in the project notes or add explanations next to your scripts?

Last edited by Ataxaos (Feb. 4, 2016 03:27:27)
- zp100
-
100+ posts
How to add Anti-Gravity to a Platformer Game?
@Ataxaos
Good point. I wasn't done with it yet, so I didn't make a full description.
Good point. I wasn't done with it yet, so I didn't make a full description.
- ey83985
-
10 posts
How to add Anti-Gravity to a Platformer Game?
when clickedforeverif gravity = anti-gravity thenchange Y-velocity by 0.1elsechange Y-velocity by -0.1change y by Y-velocity
when clickedforeverif key space pressed? thenif gravity = anti-gravity thenset gravity to normalelseset gravity to anti-gravitywait until not key space pressed?
when clickedforeverif key space pressed? thenif gravity = anti-gravity thenset gravity to normalelseset gravity to anti-gravitywait until not key space pressed?
- Discussion Forums
- » Help with Scripts
-
» How to add Anti-Gravity to a Platformer Game?