I'm making a game where i want to add another actor every time the score is divisible 5. The problem is that if i do not add an extra point every time the condition is met, actors will continue to be added until the condition is no longer met, which results in there being added hundreds of actors.
So: How do i add only a single actor when the condition is met instead of hundreds being added? I want to have the following happen without the "counter.add(1);" part.
public void tryToEat() { if( canSee(Fisk.class)) { eat(Fisk.class); counter.add(1); createNewFisk(); } if(counter.getValue() % 5 == 0 & counter.getValue() > 0) { counter.add(1); addFarligFisk(); } }