A C64 Game - Step 92

posted in New Old Things
Published March 23, 2013
Advertisement

Poor Sam was left out again. Now he can kill the boss too.



Since the boss is a special beast you wouldn't want Sam just to stand there and kill him without any reaction.

We add a new variable BOSS_HELD, similar to the SPRITE_HELD value.
So if SAM hurts the enemy, and it's the boss, the boss is released from Sam's grip:

          dec SPRITE_HP,x 
          beq .EnemyKilled 
          
          ;enemy was hurt 
          lda BOSS_HELD beq .EnemyWasHurt 
          
          ;release if end boss 
          jmp .SamNotFirePushed


BOSS_HELD is set to 1 if Sam has the boss in his force grip. We check if the sprite caught is the last boss or one of his parts:

.EnemyHit 
          ;enemy hit! 
          stx SPRITE_HELD 
          ldy SPRITE_HELD 
          inc SPRITE_HELD 
          lda SPRITE_ACTIVE,y 
          cmp #TYPE_BOSS7 
          beq .HoldingBoss 
          
          cmp #TYPE_BOSS_PART 
          beq .HoldingBoss 
          
          jmp .NotHoldingBoss 
          
.HoldingBoss 
          sty BOSS_HELD 
          inc BOSS_HELD
          
.NotHoldingBoss

Therefore we also need to clear the bit in case the enemy or Sam is killed:


!zone KillEnemy
KillEnemy 
          ;is the enemy currently held? 
          ldy SPRITE_HELD 
          dey 
          sty PARAM4 
          cpx PARAM4 
          bne .WasNotHeld 
          
          lda #0 
          sta SPRITE_HELD 
          sta BOSS_HELD

Obviously the boss should not move when being caught, so in BehaviourBoss7 we add an early bail out:


.NoHitBack 
          lda BOSS_HELD beq + 
          rts
          
+

The step also adds a few bug fixes, as in the boss not auto-moving the bats he spawned (as if they were body parts).


Have fun!

step92.zip

Previous Step Next Step

Previous Entry A C64 Game - Step 91
1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement