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

A C64 Game - Step 86

Sign in to follow this  
Endurion

1904 views

And something different for a change: Added road side stones to the story pages to make it look a bit neater.

Looks better in motion :)

step86.png

It's actually pretty simple: We add a stone in front and one in the back. Store positions and update them every frame with different deltas.

Start with the position value variables:

MOVE_STONES 
          !byte 0
          
MOVE_STONE_POS_BACK 
          !byte 0
          
MOVE_STONE_POS_FRONT 
          !byte 0


...and the actual code.

STONE_BACK_DISTANCE = 20
STONE_FRONT_DISTANCE = 24 
          lda MOVE_STONES 
          bne + 
          jmp .NoStones
          
+ 

          ;background
          ldy #19 
          lda SCREEN_LINE_OFFSET_TABLE_LO,y 
          sta ZEROPAGE_POINTER_1 
          sta ZEROPAGE_POINTER_2 
          lda SCREEN_LINE_OFFSET_TABLE_HI,y 
          sta ZEROPAGE_POINTER_1 + 1 
          clc
          adc #( ( SCREEN_COLOR - SCREEN_CHAR ) >> 8 ) 
          sta ZEROPAGE_POINTER_2 + 1 
          ldy MOVE_STONE_POS_BACK
          
- 
          lda #32 
          sta (ZEROPAGE_POINTER_1),y 
          tya
          clc 
          adc #STONE_BACK_DISTANCE 
          tay
          cpy #39 
          bcc - 
          
          lda MOVE_STONE_POS_BACK 
          clc
          adc #1
          
- 
          cmp #STONE_BACK_DISTANCE 
          bcc + 
          sec 
          sbc #STONE_BACK_DISTANCE 
          jmp - 
          
+
          sta MOVE_STONE_POS_BACK 
          ldy MOVE_STONE_POS_BACK
          
-
          lda #149
          sta (ZEROPAGE_POINTER_1),y 
          lda #8 
          sta (ZEROPAGE_POINTER_2),y 
          tya
          clc
          adc #STONE_BACK_DISTANCE
          tay
          cpy
          #39
          bcc - 
          
          ;foreground
          ldy #22
          lda SCREEN_LINE_OFFSET_TABLE_LO,y
          sta ZEROPAGE_POINTER_1 
          sta ZEROPAGE_POINTER_2 
          lda SCREEN_LINE_OFFSET_TABLE_HI,y 
          sta ZEROPAGE_POINTER_1 + 1 
          clc
          adc #( ( SCREEN_COLOR - SCREEN_CHAR ) >> 8 ) 
          sta ZEROPAGE_POINTER_2 + 1 
          
          ldy MOVE_STONE_POS_FRONT
          
-
          lda #32
          sta (ZEROPAGE_POINTER_1),y 
          tya 
          clc
          adc #STONE_FRONT_DISTANCE 
          tay
          cpy #39
          bcc - 
          
          lda MOVE_STONE_POS_FRONT 
          clc
          adc #2
          
-
          cmp #STONE_FRONT_DISTANCE
          bcc +
          sec
          sbc #STONE_FRONT_DISTANCE 
          jmp -
          
+
          sta MOVE_STONE_POS_FRONT 
          ldy MOVE_STONE_POS_FRONT
          
-
          lda #148
          sta (ZEROPAGE_POINTER_1),y 
          lda #9
          sta (ZEROPAGE_POINTER_2),y
          tya 
          clc
          adc #STONE_FRONT_DISTANCE 
          tay
          cpy #39
          bcc - 
          
.NoStones 


step86.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.

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!