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

2013/11/25

Rmoving Objects

Lime25Sour Lime25Sour

2013/11/25

#
I would like it so when you click the 3 key you remove the actor You. Here is the code so far:
public class You extends Actor
{
    public void act()
    {
        SetImageMale();
        SetImageFemale();
        Remove();
    }

    void SetImageMale() 
    {
        if(Greenfoot.isKeyDown("1")) 
        {  
            setImage(new GreenfootImage("youm.png"));  
        } 
    }

    void SetImageFemale() 
    { 
        if(Greenfoot.isKeyDown("2")) 
        {  
            setImage(new GreenfootImage("youf.png"));  
        } 
    }

    public void Remove() 
    {  
        if(Greenfoot.isKeyDown("3"))
         {
             
         }
    }
}
Lime25Sour Lime25Sour

2013/11/25

#
Sorry i meant Removing Objects!
danpost danpost

2013/11/25

#
Look at the 'eat' method of the Animal class.
You need to login to post a reply.