1 So I created a simple game where the player can shoot a laser that locks on to the targets and destroys them after a certain time. However whenever I recast my laser after I destroyed all the targets, it keeps locking on to (0,0), even though nothing is there. I of course thought about putting another condition using 'AND' conditions so that the laser only fires when targets exist, but that wasn't possible because there was already an 'OR' condition there. Please help.
2 Also I have another question: How do you distinguish each object? So originally I thought of casting the lasers to only the targets within a certain distance from the player, but I didn't know how to let the game distinguish the targets that are within the distance, so if I set the action to destroy the targets, it will literally destroy every target in the whole game. There definitely must be a possible way but I can't figure it out... please help.
on the #1 question, the turet is reseting to 0,0 cause your code has no default value to target if has no target in sight, you need to do something like if enemy.count <=0 set target to self.x,self.y or something like that or aim it at the center of screen set target to X originalwindowwidth/2 Y originalwindowheight/2 that is dead center of the screen.
on the #2 you need to use for each enemy loop.