F
fxokz
Guest
For some reason whenever I jump the player either gets too deep into the ground, floats above it or collides perfectly with it. It varies every time I jump. It has to be because of the fact that the gravity variable I use is a decimal value. when I change it to a whole number everything goes smooth.
edit: okay so I was wrong. I'm not exactly sure why this is happening
any suggestions on how I could rewrite this?
edit: okay so I was wrong. I'm not exactly sure why this is happening
any suggestions on how I could rewrite this?
Code:
//fall
if (vsp < 10)
{
vsp += global.grav;
}
//jump
if (place_meeting(x, y+1, par_boundary))
{
vsp = (key_jump * -jump_speed);
}
Code:
//vertical collision
if place_meeting(x, y+vsp, par_boundary)
{
while(!place_meeting(x, y+sign(vsp), par_boundary))
{
y += sign(vsp)
}
vsp = 0;
}
y += vsp;