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

2016/3/1

Need help with kill proximity

tissuepaper tissuepaper

2016/3/1

#
in SpaceAttack, we changed the player and bomb image, and now the bomb kills the player when it is somewhat close to it, rather than when it hits it.
public void killPlayer()
    {
        Actor player = getOneIntersectingObject(Player.class);
        if(player != null)
        {
            player.setImage("explosion.png");
            getWorld().addObject(new Gameover(), 300, 200);
            getWorld().removeObject(this);
            Greenfoot.stop();
        }
    }
You need to login to post a reply.