Prev: BF95 Up: Map Next: C02C
BFF1: Update Ghost
The routine for objects of type 88 to 8B, the ghosts. A ghost drifts towards the player and hurts the player if it touches. It vanishes when the player moves more than three cells away, and turns into a burst (scoring 10 hundred points) when a shot hits it.
UpdateGhost BFF1 CALL PlayGhostSound Play the ghost's sound if the ghost has been drawn in the view.
BFF4 CALL SetVelocityTowardsPlayer Make the ghost drift towards the player.
BFF7 CALL SetDirectionFromVelocity Move the ghost.
BFFA BIT 0,(IX+$07) Jump to UpdateGhost_Burst if the ghost has been hit by something.
BFFE JR NZ,UpdateGhost_Burst
C000 CALL MoveObject Check whether the ghost has run into the scenery.
C003 CALL NextSpriteNumber Animate the ghost.
C006 LD C,$03 Set the distance at which the ghost gives up to 03 cells.
C008 CALL CheckPlayerClose Check whether the ghost is close to the player.
C00B JR NC,UpdateGhost_Vanish Jump to UpdateGhost_Vanish if the player is further away than that.
C00D CALL CheckShotHit Check whether a shot has hit the ghost.
C010 JR C,UpdateGhost_ShotBurst Jump to UpdateGhost_ShotBurst if it has.
C012 CALL CheckPlayerCollision Check whether the ghost is touching the player.
C015 RET NC Return if it is not.
C016 JP HurtPlayer Hurt the player (see HurtPlayer).
UpdateGhost_Vanish C019 LD (IX+$00),$00 Remove the ghost, because the player has got away from it.
C01D RET Return.
A shot has hit the ghost.
UpdateGhost_ShotBurst C01E LD (IY+$00),$0C Turn the shot that hit the ghost into a burst.
UpdateGhost_Burst C022 LD (IX+$00),$0C Turn the ghost into a burst.
C026 LD BC,$0010 Set the points for destroying a ghost.
C029 JP AddToScore Jump to AddToScore to add the points to the score.
Prev: BF95 Up: Map Next: C02C