Step 5: Gravity
This is a simple method of simulating gravity. On each loop, if an Enemy is not overlapping an obstacle, it will be moved down one pixel, and if it is overlapping an obstace, it will be moved up one pixel. The number of times you run the loop, is the total number of pixels the object can rise or fall per frame.- Always
: Start loop "Gravity" 10 times
- On loop "Gravity"
-
is overlapping a backdrop
: Set Y position to Y( "
" )+1
- On loop "Gravity"
-
is overlapping a backdrop
: Set Y position to Y( "
" )-1

8