Skip to content

Jumping

  • Lesson
  • 1 min read
  • 8 of 9 in this chapter

Jumping

We are going to add an event for our player object which is "Key Down" and select the space button. Now add this code:

Text
if (place_meeting(x, y + 1,obj_wall)) {
 vspd -= 7;
}

What the code is doing here is checking if you are currently on the floor. If you are, pressing the space button will make your sprite jump 7 pixels up.