T
TinShigi
Guest
Hi again! I've made an enemy that will start shooting if the player gets in a certain range of visibility and won't stop until they leave, but unfortunately it seems to include behind itself as part of that radius too and I need to get it to stop that. Does anyone have any suggestions?
"dir" is the variable im using for every entity I have to keep track of which way they should be facing.
Code:
//Ataque
var radius = 100;
var sight = !collision_line(x, y, x+radius*dir, y, par_solid, false, true);
var InsideRadius = distance_to_point(obj_player.x,obj_player.y) < radius;
if(sight & InsideRadius){
if canshoot = 0 {
instance_create (x+6*dir,y,obj_sfireball)
canshoot = 25;
}
}
if canshoot >0 {canshoot --;}