G
guitarmonkeys14
Guest
Hey everyone,
I am currently making a top down shooter in which I have successfully made the enemy always follow the character. I have hit the point where I feel comfortable enough figuring out my own ways of making everything happen.
Initially I wanted to do something along the lines of an If obj_player exists, but I could find anything along those lines with Drag and Drop. So, I decided to link the enemies movement to whether the player had HP or not, I just wonder if this is the best and most efficient way.
This causes a script error after my player is killed, but I think that is because the enemies have nothing to point towards. I don't think this will be an issue down the line because I will have a respawn/restart feature shortly.
Ideally I would like to find a way to make the enemy continue straight down mindlessly when the obj_player is destroyed.
Suggestions please??
I am currently making a top down shooter in which I have successfully made the enemy always follow the character. I have hit the point where I feel comfortable enough figuring out my own ways of making everything happen.
Initially I wanted to do something along the lines of an If obj_player exists, but I could find anything along those lines with Drag and Drop. So, I decided to link the enemies movement to whether the player had HP or not, I just wonder if this is the best and most efficient way.
This causes a script error after my player is killed, but I think that is because the enemies have nothing to point towards. I don't think this will be an issue down the line because I will have a respawn/restart feature shortly.
Code:
// If Variable
with(obj_player) var l0C47E57A_0 = HP > 0;
if(l0C47E57A_0)
{
// Set Point Direction
direction = point_direction(x, y, (obj_player.x), (obj_player.y));
// Set Instance Rotation
image_angle = point_direction(x, y, obj_player.x, obj_player.y);
// Set Speed
speed = 1;
}
Ideally I would like to find a way to make the enemy continue straight down mindlessly when the obj_player is destroyed.
Suggestions please??