Hi All,
I am trying to implement a boss in my game, but for the life of me I can not figure how to kill it. So far I have this:
What do you guys think?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class miniBoss here. * * @author (your name) * @version (a version number or a date) */ public class miniBoss extends Enemies { private int Shield; private int Score; private int life; protected void takeLife() { this.life -= 1; if (this.life <= 0) getWorld().removeObject(this); } /** * Act - do whatever the miniBoss wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { this.Score = 10; this.life = 2; checkCollision(); } public void checkCollision() { Actor collided = getOneIntersectingObject(shipMissile.class); if (collided != null) { ((City) getWorld()).addScore(20); getWorld().addObject(new explosionLarge(), getX(), getY()); getWorld().removeObject(collided); takeLife(); } } }