![]() |
Routines |
| Prev: 9AF9 | Up: Map | Next: 9B37 |
|
Used by the routine at StartNastie.
Chooses a random position for an actor which is about to appear in the player's room, both the X and Y coordinates are between 30 and AF. The position is rejected if the actor would overlap the player (see TestPlayerTouchingActor) or an object in the room (see SlideActorPastObjects).
|
||||||||||||||
|
Use a random X position.
|
||||||||||||||
| ChoosePosition | 9B0D | LD A,($9695) | Fetch the random seed from RandomNumber. | |||||||||||
| 9B10 | AND %01111111 | Keep only bits 0-6. | ||||||||||||
| 9B12 | ADD A,$30 | Add 30. | ||||||||||||
| 9B14 | LD E,A | Copy the X position to E. | ||||||||||||
|
See Less Enemies.
|
||||||||||||||
| 9B15 | LD (IX+$03),A | Set the X position of the actor. | ||||||||||||
|
This entry point is used by the routine at PlaceFlame.
Use a Y position based on the frame counter.
|
||||||||||||||
| ChoosePosition_SetY | 9B18 | LD A,($5C78) | Fetch the frame counter from FRAMES. | |||||||||||
| 9B1B | AND %01111111 | Keep only bits 0-6. | ||||||||||||
| 9B1D | ADD A,$30 | Add 30. | ||||||||||||
| 9B1F | LD D,A | Copy the Y position to D. | ||||||||||||
| 9B20 | LD (IX+$04),A | Set the Y position of the actor. | ||||||||||||
|
This entry point is used by the routine at PlaceFlame_InRow.
Put the actor in the player's room and test the position.
|
||||||||||||||
| ChoosePosition_Test | 9B23 | LD A,($9703) | Fetch the player's room from 9703. | |||||||||||
| 9B26 | LD (IX+$01),A | Set the room of the actor to the player's room. | ||||||||||||
| 9B29 | LD BC,$1717 | Set the height and width of the actor in B and C to 17. | ||||||||||||
| 9B2C | CALL TestPlayerTouchingActor | Check whether the actor overlaps the player. | ||||||||||||
| 9B2F | RET C | Return if the actor would overlap the player. | ||||||||||||
| 9B30 | LD BC,$1717 | Set the height and width of the actor in B and C to 17. | ||||||||||||
| 9B33 | CALL SlideActorPastObjects | Check whether the actor overlaps an object in the room. | ||||||||||||
| 9B36 | RET | Return. | ||||||||||||
| Prev: 9AF9 | Up: Map | Next: 9B37 |