/* * Created on Apr 14, 2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ /** * @author ta6 * * All children must implement CollisionMap interface */ public abstract class Enemy extends Entity implements CollisionMap{ protected int health; protected int lives; protected boolean isalive; public Enemy() { location = new Point2d(); speed = new Vector2d(); scale = new Vector2d(); spin = 0; setInvisible(); health = 0; lives = 0; isalive = false; BoundaryBox = new Boundary(); } public Enemy(int x, int y) { location = new Point2d(x, y); speed = new Vector2d(); scale = new Vector2d(); spin = 0; setInvisible(); health = 0; lives = 0; isalive = false; BoundaryBox = new Boundary(); } public abstract void OnPlayerCollision(Player p); public abstract void OnEnemyCollision(Enemy e); public abstract void OnItemCollision(Item i); public abstract void OnBorderCollision(Border b); public boolean isAlive() { return isalive; } public void setdead() { isalive = false; } public void setalive() { isalive = true; } public int gethealth() { return health; } public void sethealth(int amount) { health = amount; } public void addhealth(int amount) { health+=amount; } public void subhealth(int amount) { health-=amount; } public int getlives() { return lives; } public void setlives(int amount) { lives = amount; } public void addlives(int amount) { lives+=amount; } public void sublives(int amount) { lives-=amount; } }