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

2017/4/25

Counter which always goes up

BrianOK BrianOK

2017/4/25

#
not sure how to do this but I need a counter, which always goes up around 100point a second until I die. I also have health that might make some issue. Any help to try to do this. thanks
Super_Hippo Super_Hippo

2017/4/25

#
Have a variable:
private int counter = 0;
In the act method, increase it by 2:
counter+=2;
Now you have a counter which increases by 2 every act cycle (about 110 per second).
You need to login to post a reply.