Game Development Reference
In-Depth Information
m_lastUpdate = now;
}
/**
* Scans for any player nearby.
* Called from within the update method
*
*/
protected function scan(delta:Number):void {
}
/**
* Chase the current attacker, if not close enough.
* Called from within the update method
*
*/
protected function chase(delta:Number):void {
}
In the base Monster class, we leave the implementation empty and implement the
methods in the ActiveMonster class by overriding the two methods. As the passive
monster also inherits what goes into the Monster class, we leave the scan and chase
methods empty so that we don't change the behavior of the passive monster.
Here is a listing of our ActiveMonster:
package world
{
public class ActiveMonster extends Monster
{
public function ActiveMonster(
attackPower:Number,
attackRate:Number,
maxLife:Number,
respawnRate:Number,
lifeUpdateRate:Number)
{
super(attackPower,
attackRate,
maxLife,
respawnRate,
lifeUpdateRate);
}
/**
* Scans for any player nearby.
 
Search WWH ::




Custom Search