Prev: CE79 Up: Map Next: CEBB
CE89: Update Spore
The routine for objects of type 40 to 4F, the spores. A spore wanders about at random, and vanishes when the player is more than three cells away. If a shot hits it, both the spore and the shot burst. If the player touches it, the spore bursts and the player is hurt. Either way, 05 hundred points are added to the score.
Wander, then flip the sprite if the view is turned.
UpdateSpore CE89 LD B,$07 Use 07 as the number of random bits for the velocity.
CE8B CALL ChooseRandomVelocity Choose a new random velocity when the timer has run out.
CE8E CALL SetDirectionFromVelocity Make the spore face the way that it is moving.
CE91 CALL MoveObject Move the spore.
CE94 CALL NextSpriteNumber Animate the spore.
CE97 LD A,($BBBA) Check whether the view is turned round, to flip the sprite to match.
CE9A RRCA
CE9B RRCA
CE9C AND $40
CE9E LD C,A
CE9F LD A,(IX+$07) Set or clear the flip flag of the spore.
CEA2 AND $BF
CEA4 OR C
CEA5 LD (IX+$07),A
Vanish, burst, or hurt the player.
CEA8 LD C,$03 Set the distance to 03 cells and check whether the spore is that close to the player.
CEAA CALL CheckPlayerClose
CEAD JR NC,BurstSporeAndShot_Remove Jump to BurstSporeAndShot_Remove to remove the spore if it is further away.
CEAF CALL CheckShotHit Check whether a shot has hit the spore, and jump to BurstSporeAndShot if it has.
CEB2 JR C,BurstSporeAndShot
CEB4 CALL CheckPlayerCollision Check whether the spore is touching the player, and return if it is not.
CEB7 RET NC
CEB8 CALL BurstSporeAndShot_Score Add the points for the spore to the score.
Prev: CE79 Up: Map Next: CEBB