Hi my issue is mostly sceen when ever you crear a level by destroying an enemy they are supposed to respawn once on certain lvels or not at all. howver if you play taht level again, they respawn an extra time. sometimes this ccures on the first time, but its not as often. does anyone have a solution to this?
my Respawn code for my world level 3 is as fallow. in this level the enemy is not supposed to respawn, however does when played again. then it functions normally. the respawn method is called form this worlds act method. s
/** * Respawn Enemy at a random location after 250 cycles only if there is no enemys */ private void respawn() { if (getObjects(Ufo.class).size() !=1) { changeValue(); hpt++; if(hpt ==250) { addObject(new Ufo (95,2), 563,Greenfoot.getRandomNumber(325)+75); hpt =0; hpE = 4; } } }