Step 4

Gravity

We can make our character fall down by setting a gravity strength, and by making it affected by gravity (objects are unaffected by gravity by default). Edit the script, and grab the "Set gravity x 0" block from Physics, and drag it under the other blocks inside the event block. Also grab the "set reacts to gravity true" block from Physics, and drag it underneath. In the "Set gravity x 0" block, change 0 to 300.

So that we can see how gravity affects the plane, change the x and y velocity blocks to 0.

Now play the game. What's going on here?!

We need gravity to pull us down, not sideways! Change gravity x to gravity y by clicking on the x. When you play your game now, the character should fall out down.

To turn this into a playable game, move on to the next tutorial: Tap to jump: Triggering velocity and gravity.

results matching ""

    No results matching ""