I have two objects in my tower defense game that are giving me trouble. One is called runner, the other is called gun. The gun is supposed to turn and fire at the runner when one comes within 256 pixels. Using debug, these are the two options I have been able to come up with to check this (the first test takes NOT true to be in range):
runner.x > instance_nearest(x,y,gun).x+256 || runner.x < instance_nearest(x,y,gun).x-256 || runner.y > instance_nearest(x,y,gun).y+256 || runner.y < instance_nearest( x,y,gun).y-256and
runner.x < instance_nearest(x,y,gun).x+256 && runner.x > instance_nearest(x,y,gun).x-256 && runner.y < instance_nearest(x,y,gun).y+256 && runner.y > instance_nearest( x,y,gun).y-256These work most of the time, but randomly return the opposite value of what they should for about 5 seconds, though that time changes each time. I can't see anything triggering them to change, can anyone tell me what I've done wrong, or just post an alternative test that can check if runner comes inside the range circle?
Thanks, Fairthorne











