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

2018/4/13

Bomberman

krys_wr krys_wr

2018/4/13

#
Hey, I'm doing a school work and I programmed Bomberman so far. I've got a problem, how the players get killed by the fire. My code so far is: public void life(){ if(getOneIntersectingObject(fire.class)!=null){ (getWorld()).removeObject(this); Greenfoot.setWorld(new GameOverP2()); } } if anybody knows how to fix this prob or has another idea, I would be thankful for any help.
nolttr21 nolttr21

2018/4/13

#
try using this instead
public void life()
{
            if(isTouching(fire.class))
{
                getWorld().removeObject(this);
                Greenfoot.setWorld(new GameOverP2());
            }
        }
also make sure that this is in your act method
life();
krys_wr krys_wr

2018/4/13

#
It worked thank you
You need to login to post a reply.