ootw: can change direction

This commit is contained in:
Vince Weaver 2019-01-14 00:34:45 -05:00
parent db98514eaa
commit 1d1d2e2554
3 changed files with 37 additions and 10 deletions

View File

@ -61,6 +61,9 @@ title_screen:
lda #20
sta ADV_X
lda #1
sta DIRECTION
game_loop:
; check keyboard
@ -73,14 +76,24 @@ game_loop:
; draw adventurer
lda #>stand_right
lda DIRECTION
beq stand_left
stand_right:
lda #>adv_stand_right
sta INH
lda #<stand_right
lda #<adv_stand_right
sta INL
jmp done_walking
stand_left:
lda #>adv_stand_left
sta INH
lda #<adv_stand_left
sta INL
done_walking:
lda ADV_X
sta XPOS
lda ADV_Y
@ -136,18 +149,34 @@ check_left:
cmp #$8 ; left arrow
bne check_right
left:
lda DIRECTION
bne face_left
dec ADV_X
jmp done_keypress
face_left:
lda #0
sta DIRECTION
jmp done_keypress
check_right:
cmp #'D'
beq right
cmp #$15
bne unknown
right:
lda DIRECTION
beq face_right
inc ADV_X
jmp done_keypress
face_right:
lda #1
sta DIRECTION
jmp done_keypress
unknown:
done_keypress:
bit KEYRESET ; clear the keyboard strobe ; 4

View File

@ -1,4 +1,4 @@
stand_right:
adv_stand_right:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$99,$bb,$aa
@ -9,7 +9,7 @@ stand_right:
.byte $aa,$44,$aa,$aa
.byte $aa,$f4,$fa,$aa
stand_left:
adv_stand_left:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa

View File

@ -147,14 +147,12 @@ DISP_PAGE = $ED
DRAW_PAGE = $EE
OFFSET = $EF
;FIRST = $F0
ADV_X = $F1
ADV_Y = $F2
ADV_X = $F0
ADV_Y = $F1
SPRITETEMP = $F2
XPOS = $F3
YPOS = $F4
DIRECTION = $F5
TEMP = $FA
TEMPY = $FB
INL = $FC