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
DarkSoulDemon
wrote ...
2014/9/14
Level Variable
DarkSoulDemon
2014/9/14
#
Is there a way of making a Level variable. I would be very greatfull if someone helped thank you.
danpost
2014/9/14
#
Usually, an instance int field is used in the game world.
DarkSoulDemon
2014/9/14
#
How would I code that.
danpost
2014/9/14
#
Usually with this:
public static int level;
with this in the initial constructor:
level = 1;
If a new instance of this class could be set later, you will probably need another constructor with a parameter to distinguish a remake of the world as compared to the initial world.
DarkSoulDemon
2014/9/14
#
so where would i put that would it be within the counter or world or would it be a class on its own. Sorry i am relatively new to java.
danpost
2014/9/14
#
danpost wrote...
Usually, an
instance
int field is used
in the game world
.
I had said this previously. I crossed off 'instance' because I suggested it be a class field (static) afterwards.
DarkSoulDemon
2014/9/14
#
danpost you are a LEGEND THANK YOU
You need to login to post a reply.
X