This will require a little bit of experience with Game Maker. Don't do this for your first game.

Steps

  1. 1
    Make a simple block sprite for your wall. Also make a sprite for your player. For the wall call it spr_wall and the player spr_player
  2. 2
    Make an object called obj_wall and check the solid box.
    Advertisement
  3. 3
    Make sure you select the wall sprite.
  4. 4
    Make an object and call it obj_player.
  5. 5
    Make sure you select your player sprite.
  6. 6
    For obj_player: go to add event and click Step then Step again. Then go to the control tab, and drag and drop the 'execute code' action.
  7. 7
    Now in the code box put in
    // simple Platforming code!
    //if place_free(x,y+1){gravity = 0.7gravity_direction = 270}else{gravity=0gravity_direction = 270}//the arrow keys<,>,^if place_free(x-4,y)and keyboard_check(vk_left){x-=4}if place_free(x+4,y)and keyboard_check(vk_right){x+=4}if !place_free(x,y+1)and keyboard_check(vk_up){vspeed=-10}
  8. 8
    Just copy and paste.
  9. 9
    For obj_player: Go to add event, then Collision, then with obj_wall.
  10. 10
    Put in this code (go to the control tab and drag and drop 'execute code':move_contact_solid(direction,12);vspeed=0;
  11. 11
    Make a room, call it room_1, make a level design by clicking with the selected object and save the room (click the tick at the top.)
  12. 12
    Run the game!
  13. Advertisement

Community Q&A

  • Question
    My gravity forces me right, rather than down. How do I fix this?
    JumpingDragon
    JumpingDragon
    Community Answer
    Make sure your gravity direction is set to 270. Just for future reference, in Game Maker 0 means right, 90 is up, 180 is left and 270 is down.
  • Question
    I tried this, and my character just keeps falling through the platforms. How do I fix this?
    Community Answer
    Community Answer
    Probably using Step 2. Click obj_wall, then click Solid checkbox. Try to place your character a bit above the wall at the start, so it drops onto the wall.
  • Question
    Is there a smooth way to make a character walk in a platform game?
    Community Answer
    Community Answer
    Yes! You can use the variables hspeed and vspeed, but they won't stop.
Advertisement

Things You'll Need

  • GameMaker of course! This tutorial uses GM:S Professional, but Standard is also good. You'll also need a bit of experience in GML first before doing this tutorial.

About This Article

wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 26 people, some anonymous, worked to edit and improve it over time. This article has been viewed 241,251 times.
70 votes - 39%
Co-authors: 26
Updated: October 8, 2020
Views: 241,251
Categories: Video Game Creation
Advertisement