🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

A C64 Game - Step 91

posted in New Old Things
Published March 16, 2013
Advertisement

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



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

Previous Entry A C64 Game - Step 90
1 likes 1 comments

Comments

Zonacas
great job :)
March 21, 2013 11:00 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement