![]() |
Routines |
| Prev: 53012 | Up: Map | Next: 53096 |
|
The handler of the object type 89, which is a spark that harms the player. It falls to the floor, and then moves about at random, in a new direction along x and y each time that it is stopped. The sprite of it is turned over every other frame.
|
||||||||
|
Fall, then flip the sprite on every other frame.
|
||||||||
| RunWanderingSpark | 53026 | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | |||||
| 53029 | CALL SetDeadlyFlags | Call SetDeadlyFlags to make the spark harm the player. | ||||||
| 53032 | LD (IX+11),0 | Set the speed along z to zero. | ||||||
| 53036 | CALL ApplyGravityAndMove | Call ApplyGravityAndMove to apply gravity to the spark and move it. | ||||||
| 53039 | RES 6,(IX+7) | Set the sprite to be the right way round. | ||||||
| 53043 | LD A,(42773) | Fetch the frame counter. | ||||||
| 53046 | AND %00000001 | Keep bit 0. | ||||||
| 53048 | JR Z,RunWanderingSpark_Test | Jump to RunWanderingSpark_Test if it is an even frame. | ||||||
| 53050 | SET 6,(IX+7) | Turn the sprite over. | ||||||
|
Pick a new direction when the spark is stopped.
|
||||||||
| RunWanderingSpark_Test | 53054 | BIT 0,(IX+12) | Jump to RunWanderingSpark_Turn if the spark was stopped along x. | |||||
| 53058 | JR NZ,RunWanderingSpark_Turn | |||||||
| 53060 | BIT 1,(IX+12) | Jump to RunWanderingSpark_Turn if the spark was stopped along y. | ||||||
| 53064 | JR NZ,RunWanderingSpark_Turn | |||||||
| 53066 | LD A,(IX+9) | Jump to RunWanderingSpark_Finish if the spark is moving. | ||||||
| 53069 | OR (IX+10) | |||||||
| 53072 | JR NZ,RunWanderingSpark_Finish | |||||||
| RunWanderingSpark_Turn | 53074 | LD A,(42765) | Fetch the random seed. | |||||
| 53077 | AND %00001000 | Keep bit 3. | ||||||
| 53079 | SUB 4 | Make it 252 or 4. | ||||||
| 53081 | LD (IX+9),A | Set it as the speed along x. | ||||||
| 53084 | LD A,R | Fetch a random number from the refresh register. | ||||||
| 53086 | AND %00001000 | Keep bit 3. | ||||||
| 53088 | SUB 4 | Make it 252 or 4. | ||||||
| 53090 | LD (IX+10),A | Set it as the speed along y. | ||||||
| RunWanderingSpark_Finish | 53093 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the spark as moved. | |||||
| Prev: 53012 | Up: Map | Next: 53096 |