HuntExe
Member
I've been working on a double jump in my game, but all it does is teleport the character a few pixels away from the wall, not push it. I'm somewhat aware of why this is happening, just not sure how to solve it.
Step Code:
Step Code:
GML:
key_left = keyboard_check(ord("A")) or keyboard_check(vk_left)
key_right = keyboard_check(ord("D")) or keyboard_check(vk_right)
key_jump = keyboard_check_pressed(ord("W")) or keyboard_check_pressed(vk_up) or keyboard_check_pressed(vk_space)
//Calculate Movement
var move = key_right - key_left;
hsp = move * walkspd;
vsp=vsp+grv
if (place_meeting(x+hsp,y,oWall))
{
jumpcurrent = 2;
hsp = -8 * move * 2;
vsp = -5
}
//jump
if (key_jump) and (jumpcurrent > 0)
{
vsp = -5;
jumpcurrent --;
}
//Horizontal Collision:
if (place_meeting(x+hsp,y,oWall))
{
while (!place_meeting(x+hsp,y,oWall))
{
x=x+sign(hsp);
}
hsp = 0;
}
x = x + hsp;
//Vertical Collision:
if (place_meeting(x,y+vsp,oWall))
{
while (!place_meeting(x,y+vsp,oWall))
{
y=y+sign(vsp);
}
if(vsp > 0)
{
jumpcurrent = jumpnumber;
}
vsp = 0;
}
y = y + vsp;