F
Fluke
Guest
So I have a horizontal scroller shooter and when the enemies pass the player on the left, I want them to carry on going. At the moment, the enemies head towards the player as intended from the right. However, once one reaches the left side of the player, all stop moving towards the player and go straight left until the ones to the left of the player are destroyed. I know it has something to do with referencing each instance of the object individually, I just don't know how to do that. Help would be appreciated, thanks.
This is the code I am using as of now (Player is Aircraft1 and enemy is LondonAir):
This is the code I am using as of now (Player is Aircraft1 and enemy is LondonAir):
var dir
if instance_exists(obj_Aircraft1)
{
dir=point_direction(x, y, obj_Aircraft1.x, obj_Aircraft1.y)
//If player is to the right
if (obj_Aircraft1.x>obj_LondonAir.x){
speed=7;
direction=180;
shoot=0;
}
if (obj_Aircraft1.x<obj_LondonAir.x){
speed=7
direction=dir
}
alarm[0]=room_speed
};
if instance_exists(obj_Aircraft1)
{
dir=point_direction(x, y, obj_Aircraft1.x, obj_Aircraft1.y)
//If player is to the right
if (obj_Aircraft1.x>obj_LondonAir.x){
speed=7;
direction=180;
shoot=0;
}
if (obj_Aircraft1.x<obj_LondonAir.x){
speed=7
direction=dir
}
alarm[0]=room_speed
};