![]() |
Routines |
| Prev: A826 | Up: Map | Next: A891 |
|
The handler for entity types 0C to 0F, which are the domes. A dome is the slower of the two types of enemy that wander about at random; it can take up to 20 steps in a frame.
|
||||||||
| MoveDome | A833 | CALL NextSpriteNumber | Move on to the next sprite using NextSpriteNumber. | |||||
| A836 | CALL RemoveDistantEntity | Remove the entity if it is far from the camera using RemoveDistantEntity. | ||||||
| A839 | CALL GetPosition | Fetch the position of the entity. | ||||||
| A83C | LD B,$20 | The dome can take up to 20 steps in this frame. | ||||||
|
This entry point is used by the routine at MoveSaucer.
This entry point is shared by both kinds of enemy.
|
||||||||
| MoveEnemy_Step | A83E | CALL TryMove | Take a step using TryMove. | |||||
| A841 | JR NZ,MoveEnemy_Turn | Jump if the enemy has been blocked. | ||||||
| A843 | CALL CheckEnemyOverlap | Check whether the enemy has run into another entity using CheckEnemyOverlap. | ||||||
| A846 | JR C,MoveEnemy_Collide | Jump if it has, to turn it round. | ||||||
| A848 | LD A,E | Jump if the enemy is not at the start of a cell. | ||||||
| A849 | OR L | |||||||
| A84A | JR NZ,MoveEnemy_Store | |||||||
| A84C | LD A,(IX+$07) | Fetch the time and direction of the enemy... | ||||||
| A84F | SUB $10 | ...take away one cell... | ||||||
| A851 | LD (IX+$07),A | ...and store it. | ||||||
| A854 | AND $F0 | Jump to choose a new direction if the time has run out. | ||||||
| A856 | JR Z,MoveEnemy_Turn | |||||||
| A858 | LD A,B | Loop back to take another step if there are steps left. | ||||||
| A859 | AND A | |||||||
| A85A | JR NZ,MoveEnemy_Step | |||||||
| MoveEnemy_Store | A85C | CALL SetPosition | Store the position of the enemy using SetPosition. | |||||
| A85F | JP AddEntity | Jump to AddEntity. | ||||||
| MoveEnemy_Turn | A862 | LD A,(IX+$07) | Fetch the time and direction of the enemy... | |||||
| A865 | AND $0F | ...keep the direction only... | ||||||
| A867 | LD (IX+$07),A | ...and store it. | ||||||
| A86A | LD A,($9615) | Fetch the frame counter... | ||||||
| A86D | AND $03 | ...and use it as a random direction. | ||||||
| A86F | CP (IX+$07) | Compare it with the current direction. | ||||||
| A872 | JR NZ,MoveDome_NewDirection | Jump if they are different. | ||||||
| A874 | INC A | Otherwise turn a quarter of a turn. | ||||||
| A875 | AND $03 | Keep the direction within four. | ||||||
| MoveDome_NewDirection | A877 | LD C,A | Keep the new direction. | |||||
| A878 | LD A,($9617) | Fetch the random number... | ||||||
| A87B | AND $F0 | ...and use the upper bits as the time to keep going in this direction. | ||||||
| A87D | JR NZ,MoveDome_SetTime | |||||||
| A87F | OR $10 | Use a time of one cell if that is zero. | ||||||
| MoveDome_SetTime | A881 | OR C | Combine the time with the new direction... | |||||
| A882 | LD (IX+$07),A | ...and store them. | ||||||
| A885 | JR MoveEnemy_Store | Jump back to store the position. | ||||||
| MoveEnemy_Collide | A887 | CALL ReverseDirection | Turn the enemy round using ReverseDirection. | |||||
| A88A | CALL AddEntity | Draw it using AddEntity. | ||||||
| A88D | RET NC | Return if it is off the screen. | ||||||
| A88E | JP MakeBumpSound | Make the sound of a bump using MakeBumpSound. | ||||||
| Prev: A826 | Up: Map | Next: A891 |