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

2013/11/21

New Characteristic in new level

pr2alede pr2alede

2013/11/21

#
I'd like certain objectsto have new characteristic when a new level is created i.e in the next level the worms can move. How can I do this, I have tried with the following code but I know it's completely off.
    public void act() 
    {
        
        if(getWorld()==crabWorld()){
            move();      
    }    
}
}
Gevater_Tod4711 Gevater_Tod4711

2013/11/21

#
You can use the instanceof operator to check what class an object is. Try it like this:
public void act()   
    {  
          
        if(getWorld() instanceof crabWorld){  //crabWorld has to be the class name of your world;
            move();        
    }   
pr2alede pr2alede

2013/11/21

#
Great that has worked
You need to login to post a reply.