This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Gingervitis
wrote ...
2013/6/8
Static fields
Gingervitis
2013/6/8
#
Is there a way to make a static int reset itself? I always have to set it back to 0 every time i want to replay my game.
bourne
2013/6/9
#
Setting it back to 0 is pretty much how you do it.
private static int number = 0; public void newGame() { ... number = 0; }
Gingervitis
2013/6/9
#
It is that simple? And you put that in the act method?
Gingervitis
2013/6/9
#
When I did that the value did not change at all. It stayed at zero.
danpost
2013/6/9
#
bourne did not place it in the act method; he put it in the world constructor.
You need to login to post a reply.
X