![]() |
Routines |
| Prev: 44615 | Up: Map | Next: 44666 |
|
Used by the routine at PlayerMovement.
Sets the direction and animation of an attacking Sabreman. If the X velocity is positive then bit 3 of the sprite ID is set and the player attacks to the right, and if it is negative then bit 3 is reset. Every four frames the sprite is changed to one of the first eight frames at random.
|
||||||||
| AnimateAttack | 44619 | LD A,(IX+6) | Fetch the X velocity of the player. | |||||
| 44622 | AND A | Jump to AnimateAttack_Frame if the player is not moving left or right. | ||||||
| 44623 | JR Z,AnimateAttack_Frame | |||||||
| 44625 | JP M,AnimateAttack_Left | Jump to AnimateAttack_Left if the player is moving left. | ||||||
| 44628 | LD A,(IX+0) | Fetch the sprite ID of the player. | ||||||
| 44631 | OR %00001000 | Set bit 3 (attacking to the right). | ||||||
| AnimateAttack_Store | 44633 | LD (IX+0),A | Set the new sprite ID of the player. | |||||
| AnimateAttack_Frame | 44636 | LD A,(23672) | Fetch the low byte of FRAMES. | |||||
| 44639 | AND %00000011 | Keep only bits 0-1. | ||||||
| 44641 | RET NZ | Return if this is not every fourth frame. | ||||||
| 44642 | LD C,(IX+0) | Fetch the sprite ID of the player into C. | ||||||
| 44645 | LD A,(38549) | Fetch the random seed from RandomNumber. | ||||||
| 44648 | AND %00000111 | Keep only bits 0-2. | ||||||
| 44650 | LD B,A | Stash the random animation frame in B. | ||||||
| 44651 | LD A,C | Fetch the sprite ID of the player. | ||||||
| 44652 | AND %11111000 | Keep only bits 3-7. | ||||||
| 44654 | OR B | Merge in the animation frame. | ||||||
| 44655 | LD (IX+0),A | Set the new sprite ID of the player. | ||||||
| 44658 | RET | Return. | ||||||
| AnimateAttack_Left | 44659 | LD A,(IX+0) | Fetch the sprite ID of the player. | |||||
| 44662 | AND %11110111 | Keep only bits 0-2 and 4-7, which resets bit 3 (attacking to the left). | ||||||
| 44664 | JR AnimateAttack_Store | Jump to AnimateAttack_Store. | ||||||
| Prev: 44615 | Up: Map | Next: 44666 |