For our first step, let’s create a function that makes the player.
Call the function ‘createMe’ and set it up with the same code blocks as shown to the right
The block with ‘ay (acceleration y)’ can be found in the Sprites section. It normally says change my sprite ‘x’ we are just changing it. By doing this, our player will always have a downward speed, siumulating the effect of gravity!
Next, lets create a new function and call it ‘createScenery’.
For this example, we’re keeping it simple and just using a tilemap, feel free to add a background if you’d like.
Click on the tilemap square to edit your tilemap.
Now spend some time editing the tilemap
Don’t forget to set the tilemap to be 10 X 8
Lastly, let’s call the functions we made to test them.
You should see your player fall to the floor like shown. This is because of the ‘ay (acceleration y)’ we used. We now have our own simple version of gravity working!