This site requires JavaScript, please enable it in your browser!
Greenfoot back
iDragon3o6
iDragon3o6 wrote ...

2020/11/6

Every second

iDragon3o6 iDragon3o6

2020/11/6

#
Hello, does anyone know how I can start a method every second?
danpost danpost

2020/11/6

#
iDragon3o6 wrote...
Hello, does anyone know how I can start a method every second?
Define an int timer field:
private int timer = 0;
and start your method with these lines:
 timer = (timer+1)%60;
if (timer != 0) return;
iDragon3o6 iDragon3o6

2020/11/7

#
Thank you!
You need to login to post a reply.