I have the following code, and it happens that not every target is shot at the end.
spawnX and spawnY are random integers.
I defined target and sniper earlier
shoot is a method to spawn a bullet.
addObject(target, spawnX, spawnY); sniper.shoot();