Skip to navigation

Aviator on the BBC Micro

The Theme: alienState

Name: alienState [Show more] Type: Variable Category: The Theme Summary: The state of each of the eight aliens Deep dive: Alien feeding and growth patterns
All eight aliens start in the dormant state (state 0). They effectively live in alien slot 30, which uses an object group to manage all the alien objects. Dormant aliens are promoted to state 1 in the UpdateAliens routine. One alien will be promoted and will start feeding once there is a vacancy in one of the alien slots 31 and 32. A vacancy is produced when an alien is promoted into alien slot 33 (preparing to take off), or when a feeding alien is destroyed. Once an alien is in state 1, the state gets incremented in the UpdateAliens routine on 2 of every 256 main loop iterations, until it reaches 22. An alien is only promoted from state 22 if slot 33 becomes vacant, at which point it is bumped up to state 23 (preparing to take off). Once an alien is in state 23, the state gets incremented in the UpdateAliens routine on 2 of every 256 main loop iterations, until it reaches 27, at which point it will take off and head for the town (see the AlienInAcornsville routine), before eventually descending to the town at state 28. 0 Dormant 1-7 Feeding stage 1 8-11 Feeding stage 2 12-15 Feeding stage 3 16-21 Feeding stage 4 22 The alien has finished feeding and is ready to move to the next stage (preparing to take off). As there can be only one alien flying towards the town at any one time, we have to wait for the attack slot (slot 33) to become vacant, at which point an alien in this state will be put into slot 33, and its state bumped up to 23 23-26 Preparing to take off 27 Flying towards Acornsville 28 Descending towards Acornsville for the final attack
.alienState EQUB &5B, &5A \ Zeroed in ResetVariables EQUB &59, &58 EQUB &7D, &7C EQUB &7B, &7A