From the course: Building a Physics-Based Platformer in GameMaker Studio Using GML

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Collision checking with the ground

Collision checking with the ground

- [Instructor] Let's open up the player object, and transition from the jump state back into the run state. The easiest way to do this is to check to see if we've collided with the ground, once we're in the jump state. So, let's open up our collision with our static parent, which includes the floor object. Now, let's drag some code in there. I'll do a triple slash comment, and say floor checking. So, when we collide with the floor, the first thing we wanna do is check and see if we're in the jump state. So, let's check our state player variable, and if the current state is equal to our jump state, then we wanna transition back into the run state. Simple enough. I'll close this out. Since we now have some code in this event, I can remove the comment that we added earlier. I'll close out the player object. And if we run our game, we'll see that we have an issue. We'll start our player running. And jump. You notice that for some reason, the animation isn't correct. It's a very subtle…

Contents