• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Platformer movement glitch, Please help :(

T

Ting_Thing

Guest
Hi,

In the future, you're more likely to get help if you post the relevant code or object information. Not everyone is willing to download a whole project and launch it with game maker. I'm reading from a phone so I can't view it even if I wanted to.

I will say that a common reason that a character will get stuck in the ground for beginning Game Maker users is that you are using two different speites where the character is on the ground, and those sprites have different distance between the bottom of the bounding box and the y position of the origin. Your solution is to make sure all of the sprites are the same height, that they all have the character touching the bottom of the image, and the y position for the origin is always set to 0.

Another reason this could happen is when the code for landing on the ground doesn't properly place the character on top of the ground I would have to look at your code or object information to determine if that were the case

Good luck!
 
U

US Claire Force

Guest
If you could post the code you're using for the jump action, that would help us get to the root of the issue faster. The problem you described above will occur if you have moving objects marked "solid". Solid is alright for some cases of inanimate objects- I have used it before for floors- but I would not recommend it for characters. Here is a possible fix to your problem.

In your floor object- check the solid box. Create a collision event in the floor object for when the player object collides with the floor, and add this script.

Code:
move_contact_solid(direction,12)
vspeed = 0;
Then, go into your player object. Make sure "solid" is unchecked. Add this code into the key or mouse press event that makes your character jump.

Code:
if!(place_empty(x,y+1))
{
    hspeed = 0;
}
Also in the player object, a step event. Add this script to the event. For the program I'm writing, I have the jump event triggered by pressing the space bar. If you want it to be triggered by a different event, simply remove the "vk_space" and replace it with your desired key.

Code:
if(keyboard_check_pressed(vk_space))
{
    vspeed -= 10;
}

//gravity
if(place_empty(x,y+1))
{
    gravity = 0.5
}
else
{
    gravity = 0
}
Let me know if that helps.
 
Last edited by a moderator:
Top