.tact15 \ If we get here then we drain energy from the target \ object in targetObject JSR DrainObjectEnergy \ Drain energy from the target object into the enemy, \ transforming it into an object with an energy level \ of one unit less (if applicable) \ \ This updates enemyEnergy with the drained energy, so \ it can be expended back onto the landscape later on \ \ It also sets X to the object number of the target that \ has been drained of energy (and which has therefore \ been transformed into a different object type) BCS tact17 \ If DrainObjectEnergy set the C flag then the enemy \ just drained the player object, so jump to \ MoveOnToNextEnemy via tact17 to move on to the next \ enemy in the next iteration of the gameplay loop, as \ we don't need to update the player object on-screen \ (as we never see the player object) LDY enemyObject \ Set enemyTacticTimer for the enemy to 30 so we wait LDA #30 \ for 30 * 0.06 = 1.8 seconds before applying tactics STA enemyTacticTimer,Y \ to the enemy again JMP tact25 \ Jump to tact25 in part 10 with X set to the number \ of the object that was drained so we update it \ on-screen with a dithered effect (as it has now been \ transformed into a different type of object) and \ return from the subroutineName: ApplyTactics (Part 6 of 10) [Show more] Type: Subroutine Category: Gameplay Summary: Drain energy from a target object Deep dive: Enemy timers and state variablesContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Subroutine DrainObjectEnergy (category: Gameplay)
Drain energy from an object into an enemy, transforming it into an object with an energy level of one unit less (if applicable)
[X]
Variable enemyObject in workspace Zero page
The object number of the enemy to which we are applying tactics in this iteration around the main loop (0-7)
[X]
Variable enemyTacticTimer in workspace Main variable workspace
A timer for each enemy that counts down every 0.06
[X]
Label tact17 in subroutine ApplyTactics (Part 7 of 10)
[X]
Entry point tact25 in subroutine ApplyTactics (Part 10 of 10) (category: Gameplay)
Dither the updated object #X onto the screen, with bit 7 of drawLandscape determining whether the object is drawn on its own (bit 7 set) or with the surrounding landscape (bit 7 clear)