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

2015/4/29

Code for changing levels? Help?

Jodie Jodie

2015/4/29

#
Hi I am doing a project for school and I am incorporating different levels into my green foot, but I don't know how to change to the next level after I have collected what is required. Can anyone please help me?
azazeel azazeel

2015/4/29

#
suggestion : import counter class from greenfoot menu and give object named for example level, make it public static modifier, place at World Class so it should be : //at world class public class MyWorld extends World{ public static Counter level = new Counter("level:"); ..... prepare(){ addObject(level,50,20); } } //at necessary class when should go next level MyWorld.level.add(1);
azazeel azazeel

2015/4/29

#
i think just google it by keyword : greenfoot level. and you will get the clue clearly
danpost danpost

2015/4/29

#
You could make your level worlds subclasses of my Level class (a support superclass that facilitates many aspects of a level changing scenario). It is in my Super Level Support Class scenario. It is well documented and will let you know what can be changed and what cannot; as well as what is needed in each of your level worlds (subclasses of Level). Look over the classes within my scenario to get an idea of what is going on. I tried to keep things to a minimum so as not to overcomplicate things as it is being looked over. You will notice that there is very little code in the Level subclasses as well as the Bug class -- mostly the basics of what is needed. If you decide to use it, I will be more than willing to assist in the incorporation of it into your scenario.
You need to login to post a reply.