Jump to content
  • Advertisement
  • entries
    104
  • comments
    102
  • views
    259434

A C64 Game - Step 92

Sign in to follow this  
Endurion

1608 views

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

step92.png

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

 
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!