Skip to navigation

Gameplay: ApplyTactics (Part 3 of 8)

Name: ApplyTactics (Part 3 of 8) [Show more] Type: Subroutine Category: Gameplay Summary: If the enemy has any residual energy, try expending it onto the landscape in the form of a tree (and end tactics if successful)
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.tact6 STX viewingObject \ Set the viewing object to the enemy we are processing, \ so everything is done from their viewpoint from now on JSR ExpendEnemyEnergy \ Drain one unit of energy from the enemy and expend it \ onto the landscape by spawning a tree, if possible \ \ This ensures that if an enemy has absorbed energy from \ somewhere, it always dissipates back into the \ landscape it when it gets the chance \ \ If we can't spawn a tree because we are about to pan \ the screen and the tree would spawn in a position that \ would be visible on-screen, then the routine does not \ expend energy or spawn a tree, and instead it gives up \ and aborts applying tactics for this gameplay loop \ \ If we successfully spawned a tree then the object \ number of the tree is in X BCS tact7 \ If the call to ExpendEnemyEnergy returned with the C \ flag set, then either the enemy didn't have any energy \ to expend or we couldn't spawn a tree, so jump to part \ 4 to keep applying tactics JMP tact25 \ Otherwise that's enough tactics for this iteration, so \ jump to tact25 with X set to the object number of \ the tree to update it on-screen with a dithered effect \ and return from the subroutine using a tail call