![]() |
Routines |
| Prev: 53757 | Up: Map | Next: 53933 |
|
The handler of the object types 168 to 171, which are creatures that harm the player and wander about the room in the same way as RunWanderer. Bit 0 of the type is turned around each frame, to make the creature walk, and bit 1 is used to show which way it is going.
|
||||||||
|
Flip the walk frame, then move the creature.
|
||||||||
| RunFourFrameWanderer | 53841 | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | |||||
| 53844 | CALL SetDeadlyFlags | Call SetDeadlyFlags to make the creature harm the player. | ||||||
| 53847 | CALL ApplyGravityAndMove | Call ApplyGravityAndMove to apply gravity to the creature and move it. | ||||||
| 53850 | LD A,(IX+0) | Fetch the type of the creature. | ||||||
| 53853 | XOR %00000001 | Turn bit 0 around. | ||||||
| 53855 | LD (IX+0),A | Set the type. | ||||||
| 53858 | LD A,(IX+3) | Jump to RunFourFrameWanderer_Test if the creature is at least 129 up. | ||||||
| 53861 | CP 129 | |||||||
| 53863 | JR NC,RunFourFrameWanderer_Test | |||||||
| 53865 | LD (IX+3),129 | Put the creature at a height of 129. | ||||||
| 53869 | LD (IX+11),0 | Set the speed along z to zero. | ||||||
|
Pick a new direction when the creature is stopped.
|
||||||||
| RunFourFrameWanderer_Test | 53873 | LD A,(IX+9) | Jump to SetWipeAndDrawFlags to flag the creature as moved if it is moving. | |||||
| 53876 | OR (IX+10) | |||||||
| 53879 | JP NZ,SetWipeAndDrawFlags | |||||||
| 53882 | LD A,R | Fetch a random number from the refresh register. | ||||||
| 53884 | AND %00001000 | Keep bit 3. | ||||||
| 53886 | SUB 4 | Make it 252 or 4. | ||||||
| 53888 | BIT 1,(IX+12) | Jump to RunFourFrameWanderer_AlongX if the creature was stopped along y. | ||||||
| 53892 | JR NZ,RunFourFrameWanderer_AlongX | |||||||
| 53894 | LD (IX+10),A | Set the speed along y. | ||||||
| 53897 | SET 1,(IX+0) | Set the bit of the type that goes with going forwards along y. | ||||||
| 53901 | RES 6,(IX+7) | Clear the flag for the sprite being mirrored. | ||||||
| 53905 | JR RunFourFrameWanderer_Direction | Jump to RunFourFrameWanderer_Direction. | ||||||
| RunFourFrameWanderer_AlongX | 53907 | LD (IX+9),A | Set the speed along x. | |||||
| 53910 | RES 1,(IX+0) | Clear the bit of the type that goes with going forwards along x. | ||||||
| 53914 | SET 6,(IX+7) | Set the flag for the sprite being mirrored. | ||||||
| RunFourFrameWanderer_Direction | 53918 | AND A | Jump to SetWipeAndDrawFlags to flag the creature as moved when it is going forwards. | |||||
| 53919 | JP P,SetWipeAndDrawFlags | |||||||
| 53922 | LD A,(IX+0) | Fetch the type of the creature. | ||||||
| 53925 | XOR %00000010 | Turn bit 1 of the type around, as the creature is going backwards. | ||||||
| 53927 | LD (IX+0),A | Set the type. | ||||||
| 53930 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the creature as moved. | ||||||
| Prev: 53757 | Up: Map | Next: 53933 |