LunarTaqq
Member
I'm quite a beginner when it comes to Game Maker and mostly programming in general, so please understand if my questions are super basic. I am trying to create a platformer game. I have worked out basic movement, animation, and collision. The problem comes when I try to implement collision with slopes. I can have my character perfectly go UP slopes, but no matter what I try they always just FALL when going DOWN, they aren't actually grounded. I would love any tips/help. Thanks!
Current code for slope/wall collision:
if (place_meeting(x + hsp, y, obj_wall))
{
yplus = 0;
while (place_meeting(x + hsp, y - yplus, obj_wall)) && (yplus <= abs(1 * hsp))
{
yplus += 1;
}
if (place_meeting(x + hsp, y - yplus, obj_wall))
{
while(!place_meeting(x + sign(hsp),y,obj_wall))
{
x += sign(hsp);
}
hsp = 0;
}
else
{
y -= yplus;
}
}
x += hsp;
- LunarTaqq
Current code for slope/wall collision:
if (place_meeting(x + hsp, y, obj_wall))
{
yplus = 0;
while (place_meeting(x + hsp, y - yplus, obj_wall)) && (yplus <= abs(1 * hsp))
{
yplus += 1;
}
if (place_meeting(x + hsp, y - yplus, obj_wall))
{
while(!place_meeting(x + sign(hsp),y,obj_wall))
{
x += sign(hsp);
}
hsp = 0;
}
else
{
y -= yplus;
}
}
x += hsp;
- LunarTaqq