Jump to content
  • Advertisement
  • entries
    104
  • comments
    103
  • views
    262352

A C64 Game - Step 91

Sign in to follow this  
Endurion

1948 views

Aaaand the torso gets to fight back too, not only sit put.


step91.png


Time to reuse existing code again. The torso will spit out bats just like the last two bossed did. SPRITE_MODE_POS is used to stop the attacking mode and revert back to movement.

A contains the number of boss parts killed (so 4 = 2 legs plus 2 arms):

          cmp #4 
          bne + 
          
          ;attack with bats 
          lda SPRITE_CHAR_POS_X,x 
          sta PARAM1 
          lda SPRITE_CHAR_POS_Y,x 
          clc 
          adc #4 
          sta PARAM2 
          inc PARAM2 
          stx PARAM10 
          jsr GenerateRandomNumber 
          and #$01 
          beq .NoBatLeft 
          
          jsr FindEmptySpriteSlot 
          beq ++ 
          
          lda #TYPE_BAT_ATTACKING 
          sta PARAM3 
          jsr SpawnObject 
          lda #0 
          sta SPRITE_DIRECTION,x
          
.NoBatLeft 
          jsr GenerateRandomNumber 
          and #$01 
          beq .NoBatRight 
          
          jsr FindEmptySpriteSlot 
          beq ++ 
          
          jsr SpawnObject 
          lda #1 
          sta SPRITE_DIRECTION,x
          
++ 
.NoBatRight 
          ldx CURRENT_INDEX 
          lda SPRITE_MODE_POS,x 
          cmp #20 
          bne +++ 
          
          dec SPRITE_STATE,x 
          lda #0 
          sta SPRITE_MODE_POS,x
          
+++ 
          rts
+



That's all there is for this step :)

step91.zip

Previous Step Next Step

 
Sign in to follow this  


1 Comment


Recommended Comments

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!