Constructor
new EnemyBoss(game, fleet, bombFactory, startX, startY, direction, id)
Create an enemy boss ship.
Parameters:
Name | Type | Description |
---|---|---|
game |
SpaceInvaders | The current game. |
fleet |
EnemyFleet | Factory that created this instance. |
bombFactory |
EnemyBombFactory | Factory to create enemy bombs. |
startX |
number | Starting X position. |
startY |
number | Starting Y position. |
direction |
number | Direction ship is moving. |
id |
string | Unique DOM ID. |
- Source:
Extends
Methods
kill()
Kills the enemy ship and starts the death animation loop, updates Score.
- Inherited From:
- Source:
move()
Process the movememnt logic - Move till edge, move down for 25 frames, move back other direction.
- Inherited From:
- Source:
startBombCountdown()
Reset the bomb counter to a random number, drops 1 each game loop.
When it reaches 0 the update loop will trigger a new bomb to be
created from the EnemyBombFactory.
- Inherited From:
- Source:
update() → {boolean}
Main update loop called every animation frame.
Dying - If the ship is dying rotate and shrink it until width < 5
Hit Points - If < 0 start the dying process
Bomb launch - Check the countdown and if < 0 make new bomb
Collision detection - player ship and shieldblock
- Inherited From:
- Source:
Returns:
Success or failure.
- Type
- boolean