Jump to content

  • Log In with Google      Sign In   
  • Create Account






A C64 Game - Step 86

Posted by Endurion, in C64 09 February 2013 · 468 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 Posted Image



Attached Image


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		



Previous Step Next Step

Attached Files






April 2014 »

S M T W T F S
  12345
6789101112
13141516 17 1819
20212223242526
27282930   

Recent Entries

Recent Comments

PARTNERS