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

2013/6/27

Keep score in new world

1
2
danpost danpost

2013/6/29

#
If using the Goal class, you should probably have the goal look for Mario and remove him when intersection occurs. The world class code can still check for lack of Mario in the world and set the new level.
davemib123 davemib123

2013/6/29

#
@ Danpost, suggestion is good, but I will need some practice on Greenfoot first :). Zamoht that works great. If on level 2 I want to put a boundary for Mario to not go past (i.e. end of game and must go in castle) but the player jumps over this. I know how to set the left-boundary but how do I set the right boundary specific to just level 2. I've tried this out:
 public void boundary()
    {
        if(getX()<=21){
            setLocation (21, getY());
        }
        Levels L = (Levels)getWorld();
        if(L.setupLevel(2)){
            if(getX()>=348){
                setLocation (348, getY());
            }
        }
    }
but setupLevel(2) causes an incompatible type.
davemib123 davemib123

2013/6/29

#
nevermind, got that sorted :) @danpost got it working as you described with Goal.class. Thanks for the tip :)
You need to login to post a reply.
1
2