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

A 64 Game - Step 67

Sign in to follow this  
Endurion

1823 views

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.

step67.png

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

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!