I'm attempting to make a simple roulette sprite (click the actor and it cycles through sprites, until clicked again) but im stuck on even beginning the loop. I can't tell why this isn't working, but from debugging it seems like the while loop is breaking immediately. My best guess is that mousePressed is still returning true at that point? but i dont see why it would be. id appreciate any help
public void act() { if (Greenfoot.mousePressed(this)) { RollNewNumber(); } } public void RollNewNumber() { rolling = true; while (rolling) { if (Greenfoot.mousePressed(this)) { rolling = false; } //do some cycling code } }