Prev: 52857 Up: Map Next: 52923
52873: Update Spore
The routine for objects of type 64 to 79, 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, 5 hundred points are added to the score.
Wander, then flip the sprite if the view is turned.
UpdateSpore 52873 LD B,7 Use 7 as the number of random bits for the velocity.
52875 CALL ChooseRandomVelocity Choose a new random velocity when the timer has run out.
52878 CALL SetDirectionFromVelocity Make the spore face the way that it is moving.
52881 CALL MoveObject Move the spore.
52884 CALL NextSpriteNumber Animate the spore.
52887 LD A,(48058) Check whether the view is turned round, to flip the sprite to match.
52890 RRCA
52891 RRCA
52892 AND 64
52894 LD C,A
52895 LD A,(IX+7) Set or clear the flip flag of the spore.
52898 AND 191
52900 OR C
52901 LD (IX+7),A
Vanish, burst, or hurt the player.
52904 LD C,3 Set the distance to 3 cells and check whether the spore is that close to the player.
52906 CALL CheckPlayerClose
52909 JR NC,BurstSporeAndShot_Remove Jump to BurstSporeAndShot_Remove to remove the spore if it is further away.
52911 CALL CheckShotHit Check whether a shot has hit the spore, and jump to BurstSporeAndShot if it has.
52914 JR C,BurstSporeAndShot
52916 CALL CheckPlayerCollision Check whether the spore is touching the player, and return if it is not.
52919 RET NC
52920 CALL BurstSporeAndShot_Score Add the points for the spore to the score.
Prev: 52857 Up: Map Next: 52923