0

# How do you make an object 'jump' in a Game Maker game?

Updated: 9/14/2023

Wiki User

15y ago

The easiest way to jump is by entering this code in the correct places. You could set the gravity but this way is easier. This will work in both the pro and lite

put this code in you Create event of you player

falling=false; //Variable for Falling

hitting=false; //Variable for if you are hitting something

grav=7; //Gravity

movement=6; //Speed at which you move

jump=0; //Used for jumping

jumping=false; //If you are jumping or not

space=false; //if space is pressed

doublejumping=false //if doublejumping

doublej=0; //for doublejumping

put this code in you step event of you player

//FALLING:

if(!collision_point(x,y,ground,true,false) && !jumping && !doublejumping) //not touching ground, or jumping{

y+=grav; //Move down the number gravity

grav=7; //Keeps gravity set

falling=true; //says the player is falling

}

if(keyboard_check_pressed(vk_space)){ //if keypressed SPACE

space=true //space=true. For other purposes

}

if(keyboard_check_released(vk_space)){ //if space not pressed

space=false //space is false

}

if(space=true && jumping==false) //if space is pressed, and jumping is false{

jumping=true; //jumps

space=false //space no longer pressed

}

if(space=true && jumping==true && doublejumping=false) //if space pressed, player jumping, and not doublejumping {

doublejumping=true //doublejumps

jumping=false //no more jumping

}

if(jumping) //if jumping is true{

y-=jump; //go up jump

jump-=.5; //lower jump a little

if(jump<0) && doublejumping=false //if jump is nil and not doublejumping {

falling=true; //fall

}

if(jump<-10) { //if jump is below -10, set it to 10

jump=-10;

}

}

if(doublejumping) //if doublejumping{

y-=doublej; //go up doublej

doublej-=.5; //lower doublej a little

if(doublej<0) { //is doublej is nil, fall

falling=true;

}

if(doublej<-10) { //if doublej is below -10, set it to -10

doublej=-10;

}

}

if(collision_point(x,y,ground,true,false) && falling) { //if touching ground and falling

jump=10; //jump is 10, for next jump

jumping=false; //No longer jumping

falling=false; //no longer falling

doublejumping=false //no longer doublejumping

}

if(keyboard_check(vk_left)) { //MOVEMENT. if left key is pressed

x-=movement; //move left

}

if(keyboard_check(vk_right)) { //if right pressed

x+=movement; //move right

}

if falling=false && jumping=true { //if falling is false, and jumping is true

{

doublej=10; //doublej is 10

}

}

http://www.willhostforfood.com/users/warsome/doublejumpgrav.gmk

Wiki User

15y ago

Earn +20 pts
Q: How do you make an object 'jump' in a Game Maker game?
Submit
Still have questions?
Related questions

### In game maker how do you double jump?

jump, and press jump in mid air. some characters can jump multiple times.

### How do you play fastball?

To play fastball, you have to tap the screen to jump. And the object of the game is to jump over the objects. And do not run into any walls.

### How do you make bullets do damge in game maker?

Collision Event with object obj_bullet: play sound snd_exp; looping: false for other object: destroy the instance for other object: create instance of object obj_exp1 at relative position (0,0) jump to position (random(room_width),-16) set the score relative to 1

### How many times do you jump in a basketball game?

I can jump 10 times in a game

Select the object you want and make a step event. Then under the step event put "jump to position" and for the values put mouse_x and mouse_y. This means every step it will jump to the exact position of the mouse. The steps are equivalent to about a millisecond, so it should move right along with your mouse. Hope this helps.

### How do you play the game Mappy?

The object of the game is to collect everything without running into other mice. You can jump on the trampolines to get up or down. You can only go through doors that are open.

### How do you make a dress up game with game maker 7?

for a drag and drop action, there is an event called global mouse left. create an object(preferably a dress) add the event then create an action (jump to postion) give the x &amp; y coordinates (x:mouse_x, y:mouse_y). this should make it so that you can drag and drop an item.

### What is Poop Jump?

Poop Jump is a game for the Android platform. In the game, you get to be a piece of feces that escapes from a toilet.

Press 'shift'

### In Game Maker how do you make the player jump in both directions in other words make him jump facing right if your going right and jump facing left if your going left?

use the variables xprev and yprev to determine which direction it is facing

### When did Harrier Jump Jet - video game - happen?

Harrier Jump Jet - video game - happened in 1992.

### When was Harrier Jump Jet - video game - created?

Harrier Jump Jet - video game - was created in 1992.