CheeseMyBaby
Member
I wrote a dash ability for my character. Everything works except for the collision checks.
When a succesful dash takes place I call either of the functions "scrDashLeft" or "scrDashRight":
I guess what I need is something like:
All input is appreciated!
Edit: I've been fiddling with DO / WHILE loops but I always manage to create endless loops.
Edit2: Yes... I'm quite noobish.
When a succesful dash takes place I call either of the functions "scrDashLeft" or "scrDashRight":
Code:
with (objPlayer)
{
for (var i = 0; i < 10; i += 1) x -= 0.5;
// Colliding horisontally?
if (place_meeting(x+hsp,y, objWall))
{
while (!place_meeting(x+sign(hsp),y,objWall))
{
x = x + sign(hsp);
onWall = false;
}
hsp = 0;
onWall = true;
}
x = x + hsp;
// Colliding vertically?
if (place_meeting(x, y+vsp, objWall))
{
while (!place_meeting(x,y+sign(vsp),objWall))
{
y = y + sign(vsp);
}
vsp = 0;
}
y = y + vsp;
}
Code:
Increment/decrement X correct number of steps unless a wall is hit.
If a wall is hit... stop next to the wall.
Edit: I've been fiddling with DO / WHILE loops but I always manage to create endless loops.
Edit2: Yes... I'm quite noobish.
Last edited: