![]() |
Routines |
| Prev: 27030 | Up: Map | Next: 27141 |
|
The handler for the chocolate (IDs 16 and 17), which drifts about in random directions. Every 16 frames a new random direction is picked and stored in byte 6 of the actor (bit 0 is set for down, and bit 1 is set for right). The speeds are changed by one every other frame towards that direction, up to a maximum speed of 2 in either direction.
While the chocolate is still entering from the right of the screen (a horizontal co-ordinate of 196 or more) it is only moved.
|
||||||||
| HandleChocolate | 27092 | CALL StoreEntity | Record the position of the sprite using StoreEntity. | |||||
| 27095 | LD HL,24347 | Point HL at ActorsInPlay. | ||||||
| 27098 | INC (HL) | Increase the number of actors in play by one. | ||||||
| 27099 | LD A,(IX+1) | Fetch the horizontal co-ordinate. | ||||||
| 27102 | CP 196 | Jump to ChangeActorSpeeds_Move if the chocolate is still entering from the right. | ||||||
| 27104 | JR NC,ChangeActorSpeeds_Move | |||||||
| 27106 | CALL TestCharlieCollision | Test whether the actor has hit Charlie using TestCharlieCollision. | ||||||
| 27109 | DEC E | Has Charlie been hit (is E now zero)? | ||||||
| 27110 | JP Z,LoseHat | Jump to LoseHat if Charlie has been hit. | ||||||
| 27113 | CALL TestFlourCollision | Test whether a flour shot has hit the actor using TestFlourCollision. | ||||||
| 27116 | BIT 7,(IX+0) | Jump to HandleHitActor if the actor has been hit. | ||||||
| 27120 | JP NZ,HandleHitActor | |||||||
| 27123 | LD (IX+3),66 | Set the actor colour to 66 (red). | ||||||
| 27127 | LD A,(IX+7) | Fetch the frame counter (byte 7 of the actor). | ||||||
| 27130 | AND %00001111 | Keep only bits 0-3. | ||||||
| 27132 | JR NZ,ChangeActorSpeeds | Jump to ChangeActorSpeeds if the counter is not a multiple of 16. | ||||||
| 27134 | LD A,R | Fetch a random number. | ||||||
| 27136 | AND %00000011 | Keep only bits 0-1. | ||||||
| 27138 | LD (IX+6),A | Set a random direction (byte 6 of the actor). | ||||||
| Prev: 27030 | Up: Map | Next: 27141 |