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

2014/4/29

How would I go about counting removal of actors? Please help!

yonathanz yonathanz

2014/4/29

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Gun here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class gun extends Actor
{
   
    public void eat() 
    {
         Actor beaty;
        beaty=getOneObjectAtOffset(0, 0, beaty.class);
            if (beaty != null)
        {
            World Background;
            Background=getWorld();
            Background.removeObject(beaty);
           
        }
    
       
       /* Actor block;
        block=getOneObjectAtOffset(0,0,block.class);
        if (block != null)
        {
           World sand_land;
            sand_land=getWorld();
            sand_land.removeObject(block);
    }
    */
}
    

    private int direction, speed;
    public gun(int dir)
    {
        direction = dir;
        speed = 10;
    }
   // public int eaten=0;
    //public int bombedFire=0;
    
    public void act()
    {
        setRotation(direction);
        move(speed);
        eat();
        //bombedFire();
        
    }
    }    
each time the gun actor removes the beaty actor, I want the counter to increase. I don't have anything in the beaty actor. I also have a score board actor created.
You need to login to post a reply.