Skip to navigation

Gameplay: ApplyTactics (Part 6 of 10)

Name: ApplyTactics (Part 6 of 10) [Show more] Type: Subroutine Category: Gameplay Summary: Drain energy from a target object Deep dive: Enemy timers and state variables
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.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 subroutine