![]() |
Routines |
| Prev: 49257 | Up: Map | Next: 49361 |
|
The routine for objects of type 112 to 127, the creatures. A creature wanders about the village and hurts the player if it touches. It vanishes when the player is more than three cells away. When a shot hits it, the kind of the shot and the kind of the creature are added together to choose one of four things to happen to it (see HitOutcomeTable).
|
||||
| UpdateCreature | 49283 | LD A,(IX+5) | Set the velocity of the creature from its speed and the way it faces. | |
| 49286 | CALL SetVelocityFromSpeed | |||
| 49289 | CALL TestMove | Check whether the creature has run into the scenery. | ||
| 49292 | BIT 0,(IX+7) | Check whether it did. | ||
| 49296 | CALL NZ,PlayBumpSound | Play the bump sound if it did. | ||
| 49299 | RES 1,(IX+7) | Clear the flag that shows that the creature has been drawn, ready for the next frame. | ||
| 49303 | CALL MoveObject | Move the creature. | ||
| 49306 | CALL UpdateDirection | Turn the creature to a new direction if it has gone far enough in this one. | ||
| 49309 | CALL SetSpriteFromDirection | Choose the picture of the creature from the way it faces. | ||
| 49312 | LD C,3 | Set the distance at which the creature gives up to 3 cells. | ||
| 49314 | CALL CheckPlayerClose | Check whether the creature is close to the player. | ||
| 49317 | JR NC,UpdateCreature_Vanish | Jump to UpdateCreature_Vanish if the player is further away than that. | ||
| 49319 | CALL CheckShotHit | Check whether a shot has hit the creature. | ||
| 49322 | JR C,UpdateCreature_Hit | Jump to UpdateCreature_Hit if one has. | ||
| 49324 | CALL CheckPlayerCollision | Check whether the creature is touching the player. | ||
| 49327 | RET NC | Return if it is not. | ||
| 49328 | LD BC,37 | Set the points that touching a creature costs. | ||
| 49331 | CALL AddToScore | Add the points to the score. | ||
| 49334 | JP HurtPlayer | Hurt the player (see HurtPlayer). | ||
|
A shot has hit the creature. Add together the kind of the creature and the kind of the shot (its type divided by four) to choose what happens.
|
||||
| UpdateCreature_Hit | 49337 | LD A,(IX+0) | Work out the kind of the creature, by dividing its type by four. | |
| 49340 | SRL A | |||
| 49342 | SRL A | |||
| 49344 | LD C,A | Keep it in C. | ||
| 49345 | LD A,(IY+0) | Work out the kind of the shot, by dividing its type by four. | ||
| 49348 | SRL A | |||
| 49350 | SRL A | |||
| 49352 | ADD A,C | Add the two kinds together. | ||
| 49353 | AND %00000011 | Keep the result between 0 and 3. | ||
| 49355 | LD BC,49361 | Point at the table of outcomes. | ||
| 49358 | JP JumpToTableRoutine | Jump to the outcome that was chosen. | ||
| Prev: 49257 | Up: Map | Next: 49361 |