![]() |
Routines |
| Prev: C069 | Up: Map | Next: C0D1 |
|
The routine for objects of type 70 to 7F, 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 | C083 | LD A,(IX+$05) | Set the velocity of the creature from its speed and the way it faces. | |
| C086 | CALL SetVelocityFromSpeed | |||
| C089 | CALL TestMove | Check whether the creature has run into the scenery. | ||
| C08C | BIT 0,(IX+$07) | Check whether it did. | ||
| C090 | CALL NZ,PlayBumpSound | Play the bump sound if it did. | ||
| C093 | RES 1,(IX+$07) | Clear the flag that shows that the creature has been drawn, ready for the next frame. | ||
| C097 | CALL MoveObject | Move the creature. | ||
| C09A | CALL UpdateDirection | Turn the creature to a new direction if it has gone far enough in this one. | ||
| C09D | CALL SetSpriteFromDirection | Choose the picture of the creature from the way it faces. | ||
| C0A0 | LD C,$03 | Set the distance at which the creature gives up to 03 cells. | ||
| C0A2 | CALL CheckPlayerClose | Check whether the creature is close to the player. | ||
| C0A5 | JR NC,UpdateCreature_Vanish | Jump to UpdateCreature_Vanish if the player is further away than that. | ||
| C0A7 | CALL CheckShotHit | Check whether a shot has hit the creature. | ||
| C0AA | JR C,UpdateCreature_Hit | Jump to UpdateCreature_Hit if one has. | ||
| C0AC | CALL CheckPlayerCollision | Check whether the creature is touching the player. | ||
| C0AF | RET NC | Return if it is not. | ||
| C0B0 | LD BC,$0025 | Set the points that touching a creature costs. | ||
| C0B3 | CALL AddToScore | Add the points to the score. | ||
| C0B6 | 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 | C0B9 | LD A,(IX+$00) | Work out the kind of the creature, by dividing its type by four. | |
| C0BC | SRL A | |||
| C0BE | SRL A | |||
| C0C0 | LD C,A | Keep it in C. | ||
| C0C1 | LD A,(IY+$00) | Work out the kind of the shot, by dividing its type by four. | ||
| C0C4 | SRL A | |||
| C0C6 | SRL A | |||
| C0C8 | ADD A,C | Add the two kinds together. | ||
| C0C9 | AND %00000011 | Keep the result between 00 and 03. | ||
| C0CB | LD BC,$C0D1 | Point at the table of outcomes. | ||
| C0CE | JP JumpToTableRoutine | Jump to the outcome that was chosen. | ||
| Prev: C069 | Up: Map | Next: C0D1 |