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

2012/12/14

Shot damage

mncomic mncomic

2012/12/14

#
My game is coming along nicely thanks toy the great suggestions... How do I fox the code to have my tanks sustain a couple hits before exploding? Thanks
erdelf erdelf

2012/12/15

#
make a health variable and something like the following in your act code:
if(getOneIntersectingImage(Bullet.class)!= null)
{
    getWorld().removeObject(getOneIntersectingImage(Bullet.class));
health-=10;
}
mncomic mncomic

2012/12/15

#
Thanks erdelf...do I place this in the tank code or bullet?
erdelf erdelf

2012/12/15

#
tank
You need to login to post a reply.