X
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.
Learn more...
This will require a little bit of experience with Game Maker. Don't do this for your first game.
Steps
-
1Make 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
-
2Make an object called obj_wall and check the solid box.Advertisement
-
3Make sure you select the wall sprite.
-
4Make an object and call it obj_player.
-
5Make sure you select your player sprite.
-
6For 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.
-
7Now 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} -
8Just copy and paste.
-
9For obj_player: Go to add event, then Collision, then with obj_wall.
-
10Put in this code (go to the control tab and drag and drop 'execute code':move_contact_solid(direction,12);vspeed=0;
-
11Make 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.)
-
12Run the game!
Advertisement
Community Q&A
-
QuestionMy gravity forces me right, rather than down. How do I fix this?JumpingDragonCommunity AnswerMake 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.
-
QuestionI tried this, and my character just keeps falling through the platforms. How do I fix this?Community AnswerProbably 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.
-
QuestionIs there a smooth way to make a character walk in a platform game?Community AnswerYes! 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
Advertisement