![game maker studio 2 platformer tutorial game maker studio 2 platformer tutorial](https://i.ytimg.com/vi/1r1rElIiWqw/maxresdefault.jpg)
We should also advance to the next room.Type whatever message you'd like the user to see when they complete this level.Find and add the "Display Message" action from the "Main2" tab.When this occurs, we should display a message. Add a new event for a collision with the winBlock.We'll check for 2 possible scenarios: Qbert colliding with the winBlock, and Qbert standing over the winBlock. In order to win, Qbert must touch the winBlock ( ). We'll use the same direction as before (270), but this time with a value of 0.
![game maker studio 2 platformer tutorial game maker studio 2 platformer tutorial](https://img.itch.zone/aW1hZ2UvMjE2MzAxLzE0OTcyMTEuZ2lm/347x500m/EClel5.gif)
Lastly, find and add the "Set Gravity" action again.This tells GameMaker that we want to do something else if previous conditional is false. Now find and add the "Else" action in the "Control" tab.For straight down, we'll want a direction of 270. The direction field expects an angle in degrees, with 0 degrees pointing straight right.Now find and add the "Set Gravity" action in the "Move" tab. īecause we want to check the area below Qbert, we'll use the following settings: Add the "Check Empty" action - the same one we used to prevent Qbert from walking through walls, and it looks like this. We want to check the space below Qbert's feet.This will occur once per iteration of the game loop (or, once per frame). Click "Add Event", select "Step" and then "Step" again.If he's on the ground, we'll take gravity away to prevent him from sinking in. To make this work, we'll check Qbert's feet on every frame. We need to add gravity to our world, but we only want this to affect Qbert if his feet are not on the ground. If you play your game now, you'll notice that Qbert goes straight into the air and never comes down - oh no! This time, be sure to use positive 4 in the X and mark it as "Relative".Now select the Keyboard event, and add the "Check Empty" action as well.If your "Check Empty" action is not at the top of the list, drag it up so that it is.Use the same values which we used in the "Jump to Position" action. This action allows us to make sure our target destination is empty. Add the "Check Empty" action to the top of the actions list.Go to the "Control" tab in the actions toolbar on the right side of the window. Now we need to add a conditional statement.We told Qbert to move to the left and right, but we never told him he couldn't walk through walls! Notice anything weird while playing the game? Once you're done, let's try out your game by pressing the button at the top left of GameMaker Studio.Add the "Jump to Position" action to this event. This time, we want Qbert to move to the RIGHT from his CURRENT position.Now add another event for the Keyboard key.We want Qbert to move to the LEFT from his CURRENT position, so we'll put: To add this action, you can either drag-and-drop it into the actions list, or simpley right-click on it.Find the "Jump to Position" action on the "Move" tab. The right side of the window lists all the actions we can do.What do we want to happen when the player presses left? We want Qbert to move to the left!.Click the "Add Event" button at the bottom of this window.Double click the Qbert object under the Objects folder.We'll do this by adding keyboard events to the Qbert object. Let's give our player control over Qbert. Be sure to save your work so far by clicking the button!Īlright, we've created our first level.When you're done, click the at the top left of the room window.He should start far from the winBlock, on top of an okBlock. Change the current object to Qbert which you created earlier.Change the current object to the loseBlock which you created earlier.Don't make it too easy, but remember, this is just the first level. Change the current object to the winBlock which you created earlier.Create platforms using okBlocks for the player to jump on.You can re-arrange blocks by clicking and dragging them.
![game maker studio 2 platformer tutorial game maker studio 2 platformer tutorial](https://cdn.conceptartempire.com/images/04/7280/18-asteroids-tutorial-game.jpg)