![]() |
Routines |
| Prev: CF14 | Up: Map | Next: CF68 |
|
The handler of the object type 59, 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 | CF22 | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | |||||
| CF25 | CALL SetDeadlyFlags | Call SetDeadlyFlags to make the spark harm the player. | ||||||
| CF28 | LD (IX+$0B),$00 | Set the speed along z to zero. | ||||||
| CF2C | CALL ApplyGravityAndMove | Call ApplyGravityAndMove to apply gravity to the spark and move it. | ||||||
| CF2F | RES 6,(IX+$07) | Set the sprite to be the right way round. | ||||||
| CF33 | LD A,($A715) | Fetch the frame counter. | ||||||
| CF36 | AND %00000001 | Keep bit 0. | ||||||
| CF38 | JR Z,RunWanderingSpark_Test | Jump to RunWanderingSpark_Test if it is an even frame. | ||||||
| CF3A | SET 6,(IX+$07) | Turn the sprite over. | ||||||
|
Pick a new direction when the spark is stopped.
|
||||||||
| RunWanderingSpark_Test | CF3E | BIT 0,(IX+$0C) | Jump to RunWanderingSpark_Turn if the spark was stopped along x. | |||||
| CF42 | JR NZ,RunWanderingSpark_Turn | |||||||
| CF44 | BIT 1,(IX+$0C) | Jump to RunWanderingSpark_Turn if the spark was stopped along y. | ||||||
| CF48 | JR NZ,RunWanderingSpark_Turn | |||||||
| CF4A | LD A,(IX+$09) | Jump to RunWanderingSpark_Finish if the spark is moving. | ||||||
| CF4D | OR (IX+$0A) | |||||||
| CF50 | JR NZ,RunWanderingSpark_Finish | |||||||
| RunWanderingSpark_Turn | CF52 | LD A,($A70D) | Fetch the random seed. | |||||
| CF55 | AND %00001000 | Keep bit 3. | ||||||
| CF57 | SUB $04 | Make it FC or 04. | ||||||
| CF59 | LD (IX+$09),A | Set it as the speed along x. | ||||||
| CF5C | LD A,R | Fetch a random number from the refresh register. | ||||||
| CF5E | AND %00001000 | Keep bit 3. | ||||||
| CF60 | SUB $04 | Make it FC or 04. | ||||||
| CF62 | LD (IX+$0A),A | Set it as the speed along y. | ||||||
| RunWanderingSpark_Finish | CF65 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the spark as moved. | |||||
| Prev: CF14 | Up: Map | Next: CF68 |