Hi,
I'm tying to make an enemy and a gun only become visible when within a certain range of my player.
The enemy works fine but not the gun. I've tried many different things but I either get errors or guns being drawn at every position the enemy moves.
The gun object is created at the create event for the enemy.
In the step event I have this code:
I have this code in the draw event for my enemy:
What would be the best way to make the gun disappear too?
Thanks in advance,
Tom
I'm tying to make an enemy and a gun only become visible when within a certain range of my player.
The enemy works fine but not the gun. I've tried many different things but I either get errors or guns being drawn at every position the enemy moves.
The gun object is created at the create event for the enemy.
Code:
gun = instance_create_layer(x, y, "Weapons", oPistol);
Code:
with(gun)
{
x = other.x;
y = other.y;
}
Code:
if(instance_exists(oPlayer))
{
if(distance_to_object(oPlayer)<150)
{
draw_self();
}
}
Thanks in advance,
Tom