Does your gravity look like this?
Don’t you wish it could look like this without the use of 2D Physics blocks?
Well, I can show you how! First, you need to select a sprite!
I’ll choose a white squircle.
Then you need a Level sprite! I will just use a square. Alright, let’s get to coding! First we need a
when green flag clicked
block!
Now we need a forever loop! It should look something like this:
We should make a Gravity variable, and don’t forget to start off with Gravity being 0!
Here’s what I did:
Now don’t forget to add collision!
This didn’t quite work. Let’s fix that!
Perfect! Now we need a key to press to start it! I’ll use Space Bar.
Uh oh! The player can jump indefinitely! Let’s fix that!
Good job! You just made basic, but customizable Gravity!
It’s a bit buggy, but it works! If you know how to fix some issues, please contact me by making a new topic with the title; “RE: Tutorial: Gravity without 2D Physics”, and you may tag me as well.
I hope you found this tutorial useful, and I might make some more!