Skip to navigation


Scoring: ScoreHitPoints

Name: ScoreHitPoints [Show more] Type: Subroutine Category: Scoring Summary: Award points for destroying an alien, and remove the alien from its slot and the radar, if required
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ExplodeAlien calls ScoreHitPoints
.ScoreHitPoints LDA #255 \ Set A to a negative number so we can clear out the \ alien slot below LDY hitObjectId \ Set Y to the ID of the object we just hit with our \ bullets CPY #30 \ If Y is not 30, then jump to hitp1 to clear out the BNE hitp1 \ slot LDX alienSlot \ Set X to the number of the alien in slot 30 JMP hitp2 \ Jump to hitp2 to skip the following .hitp1 \ If we get here then we just hit an alien in slot 31 \ to 33 LDX alienSlot-30,Y \ Set X to the number of the alien in slot Y STA alienSlot-30,Y \ Store A (which is negative) in slot Y to empty the \ slot .hitp2 STA alienObjectId,X \ Reset the object ID associated with the alien that \ we just hit (i.e. the one in the range 16 to 29) CPY #33 \ If Y is not 33, then jump to hitp3 as only alien 33 BNE hitp3 \ appears on the radar JSR ResetRadar \ Remove the alien from the radar LDA #3 \ Set A = 3 and jump down to hitp5 to award 30 points BNE hitp5 \ for destroying the flying alien (this BNE is \ effectively a JMP as A is never zero) .hitp3 LDX feedingStage \ Set X to feedingStage, the feeding stage of the alien \ we just hit (if it isn't dormant or flying) CPY #31 \ If Y >= 31, i.e. this is not alien 30, then jump to BCS hitp4 \ hitp4 to award a score based on the alien's feeding \ stage LDA dormantAlienScore \ This is alien 30, which is always dormant, so fetch JMP hitp5 \ the score for killing a dormant alien (400 points) \ and jump down to hitp5 to increase the score .hitp4 LDA alienScore,X \ Fetch the score for killing an alien in the feeding \ state in A (0 = fattest alien, 3 = slimmest alien) .hitp5 LDX #0 \ Add A * 10 points to the score by calling UpdateScore JSR UpdateScore \ with (X A) = (0 A) = A RTS \ Return from the subroutine