🎉 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 67

posted in New Old Things
Published September 08, 2012
Advertisement

And per popular request now we also have a Game Over sequence. We add the missing letters and add a short loop displaying and animating the sprites.



At the beginning of CheckForHighscore (which is called on game over) we add a short loop. This snippet calls a sub routine to set up the sprites and then animates the letter for a short period.

          ;display game over
          jsr DisplayGameOver

          ;animate
          lda #0
          sta SPRITE_STATE

.GameOverDelay
          jsr WaitFrame

          lda SPRITE_STATE
          and #$1f
          tax
          ldy #0
          lda #8
          sta PARAM2

-
          lda PATH_8_DY,x
          and #$80
          bne +

          lda PATH_8_DY,x
          clc
          adc #110
--
          sta VIC_SPRITE_Y_POS,y
          jmp ++


+
          lda PATH_8_DY,x
          and #$7f
          sta PARAM1

          lda #110
          sec
          sbc PARAM1
          jmp --

++
          iny
          iny

          inx
          inx
          txa
          and #$1f
          tax

          dec PARAM2
          bne -

          inc SPRITE_STATE
          bne .GameOverDelay


          ;check for highscore
          lda #0
          sta VIC_SPRITE_ENABLE


Here's the sub routine to set up the sprites:

;------------------------------------------------------------
;displays game over
;------------------------------------------------------------
!zone DisplayGameOver
DisplayGameOver
          ldx #0
          ldy #0

-
          lda GETREADY_SPRITE_X_POS,x
          sta VIC_SPRITE_X_POS,y
          lda GETREADY_SPRITE_COLOR,x
          sta VIC_SPRITE_COLOR,x
          iny
          iny
          inx
          cpx #8
          bne -

          lda #110
          sta VIC_SPRITE_Y_POS
          sta VIC_SPRITE_Y_POS + 2
          sta VIC_SPRITE_Y_POS + 4
          sta VIC_SPRITE_Y_POS + 6
          sta VIC_SPRITE_Y_POS + 8
          sta VIC_SPRITE_Y_POS + 10
          sta VIC_SPRITE_Y_POS + 12
          sta VIC_SPRITE_Y_POS + 14

          lda #SPRITE_G
          sta SPRITE_POINTER_BASE
          lda #SPRITE_A
          sta SPRITE_POINTER_BASE + 1
          lda #SPRITE_M
          sta SPRITE_POINTER_BASE + 2
          lda #SPRITE_E
          sta SPRITE_POINTER_BASE + 3
          sta SPRITE_POINTER_BASE + 6
          lda #SPRITE_O
          sta SPRITE_POINTER_BASE + 4
          lda #SPRITE_V
          sta SPRITE_POINTER_BASE + 5
          lda #SPRITE_R
          sta SPRITE_POINTER_BASE + 7

          lda #0
          sta VIC_SPRITE_MULTICOLOR
          lda #$80
          sta VIC_SPRITE_X_EXTEND
          lda #$ff
          sta VIC_SPRITE_ENABLE
          sta VIC_SPRITE_EXPAND_X
          sta VIC_SPRITE_EXPAND_Y
          rts


Well, that's that :)

step67.zip

Previous Step Next Step

Previous Entry A C64 Game - Step 66
0 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