Why can't i get my code to loop? What should i use for the loop?
public void antaltrykknap1()
{
Knap1 knap1 = (Knap1)getWorld().getObjects(Knap1.class).get(0);
World TurtleWorld;
TurtleWorld = getWorld();
TurtleWorld space = (TurtleWorld)TurtleWorld;
Counter counter = space.getCounter();
int antaltryk1 = 0;
if (Greenfoot.mousePressed(knap1))
{
antaltryk1++;
}
if (Greenfoot.mousePressed(knap1) && counter.moneys>=10)//&& antaltryk1>=1)
{
//if (counter.moneys>=10)
for(;;)
{
//while (antaltryk1 >= 1)
//{
counter.moneys++;
Greenfoot.delay(1);
break;
//}
}
}
}
