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

2018/1/19

Restarting current level

Paul12345 Paul12345

2018/1/19

#
So i'm trying to restart the level every time my character dies . The problem is that i have a Levels class in which i made all the levels as subclasses so i need a way of getting my current level so i can set the world to a new version of my current level . Or a way of storing the current level at the start and setting the world to the stored version when i die.
danpost danpost

2018/1/19

#
Make the Levels class the initial start-up world and have three constructor methods for it. The first with no parameters to zero the level int field and create and set the first level world active, and the other two to override the constructors of the World class (to pass on construction of the subclasses). Then you can make the level int field a static one, so it remains unaffected during level changes. If you are not quite sure about what I am trying to say to do, refer to my Level class, in this scenario.
Paul12345 Paul12345

2018/1/19

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