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

2013/12/22

remove health

1
2
danpost danpost

2013/12/22

#
I simplified the 'act' method to this:
public void act()
{
    if(Hit())  
    {  
        removeHealth();
        getWorld().removeObject(this);
        return;       
    }  
    int x = Greenfoot.getRandomNumber(2);  
    move(-x);  
    if(atWorldEdge()) getWorld().removeObject(this);   
}
NaomiMenzo NaomiMenzo

2013/12/22

#
Thanks Danpost! i knew the act part could be simplified, but i didn't know how to. The error messages are gone, and i think i can continue with this scenario. Thanks again and Happy Holidays!
You need to login to post a reply.
1
2