Z
Zwaya
Guest
So I'm making a shooter where the player is in a room and enemies randomly spawn around him. Room has no gravitational force pulling the players so I don't have hsp and vsp variables for enemy movement I just have walksp. For the enemies movement I used
mp_potential_step(oPlayer.x, oPlayer.y, walksp, false)
Now while moving towards the player enemies would obviously go through a wall because I didn't setup any code for collision. I used Spalding's code for wall collision
if (place_meeting(x+walksp, y, oWall))
{
while (!place_meeting(x+sign(walksp), y, oWall))
{
x = x + sign(walksp);
}
walksp = 0;
}
Now, the enemies will stop when colliding with the wall, but they don't move anymore after that. What I mean is when they collide with a wall, they just stick to it. They do move around, look and shoot at the player, but they don't move. How can I fix this? Any reply helps. Sorry for my bad description and thanks in advance!
mp_potential_step(oPlayer.x, oPlayer.y, walksp, false)
Now while moving towards the player enemies would obviously go through a wall because I didn't setup any code for collision. I used Spalding's code for wall collision
if (place_meeting(x+walksp, y, oWall))
{
while (!place_meeting(x+sign(walksp), y, oWall))
{
x = x + sign(walksp);
}
walksp = 0;
}
Now, the enemies will stop when colliding with the wall, but they don't move anymore after that. What I mean is when they collide with a wall, they just stick to it. They do move around, look and shoot at the player, but they don't move. How can I fix this? Any reply helps. Sorry for my bad description and thanks in advance!