Rev 931 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.burutaru.game.entities;
/** Base abstract class for all kinds of enemy-hurting projectiles (including enemy-hurting explosions. */
public abstract class Projectile
{
// Constants========================================================================================
// Embedded Types===================================================================================
// Fields===========================================================================================
private int mDamage = 0;
private boolean mIsAlive = false;
// Methods==========================================================================================
public Projectile(int damage)
{
mDamage = damage;
mIsAlive = true;
}
/** Process the damaging of an enemy that has been touched by this projectile. */
public void consumeHit(Enemy enemy)
{
enemy.hit(mDamage);
// either the projectile vanishes after hitting an enemy or it doesnt
}
// Getters/Setters==================================================================================
/** Get the damaging amount of this weapon. */
public final int getDamage() { return mDamage; }
/** Check if the projectile is still active/alive. */
public final boolean isAlive() { return mIsAlive; }
}