Skip to navigation

Elite on the BBC Micro and NES

Main loop: Main flight loop (Part 10 of 16)

[Elite-A, Parasite]

Name: Main flight loop (Part 10 of 16) [Show more] Type: Subroutine Category: Main loop Summary: For each nearby ship: Remove if scooped, or process collisions Deep dive: Program flow of the main game loop
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file

The main flight loop covers most of the flight-specific aspects of Elite. This section covers the following: * Continue looping through all the ships in the local bubble, and for each one: * Remove scooped item after both successful and failed scooping attempts * Process collisions
LDA auto \ If the docking computer is on, then auto will be &FF, AND #%00000100 \ so this will set A = 1, a tiny amount of damage EOR #%00000101 \ \ If the docking computer is off, then auto will be 0, \ so this will set A = 5, a small amount of damage BNE MA63 \ Jump to MA63 to process the damage in A (this BNE is \ effectively a JMP as A will never be zero) .MA58 \ If we get here, we have collided with something in a \ potentially fatal way LDA #64 \ Call n_hit to apply a hit of strength 64 to the ship JSR n_hit \ we just collided with JSR anger_8c \ Call anger_8c to make the ship angry .n_crunch \ If we get here, we have collided with something, so we \ need to take a hit to our shields LDA #128 \ Set A = 128 to indicate a fairly large amount of \ damage .MA63 JSR OOPS \ The amount of damage is in A, so call OOPS to reduce \ our shields, and if the shields are gone, there's a \ chance of cargo loss or even death JSR EXNO3 \ Make the sound of colliding with the other ship and \ fall through into MA26 to try targeting a missile