I have this code to initialize NPCS in my game if you’re in their sight range
onClipEvent(load) {
working = false;
sight = 40;
}
onClipEvent(enterFrame) {
if(_level0.guy._x - this._x < sight and _level0.guy._x - this._x > -sight and _level0.guy._y - this._y < sight and _level0.guy._y - this._y > -sight) {
working = true;
}
if(working == true) {
trace("Working");
}
}
Anyone know why its not working?