monkey: can now face all directions

This commit is contained in:
Vince Weaver 2020-09-17 20:34:27 -04:00
parent a827c0e27d
commit d143b22a23
3 changed files with 30 additions and 10 deletions

View File

@ -39,7 +39,7 @@ guybrush_down2_sprite:
.byte $dA,$dA,$dA
.byte $dd,$bb,$dd
.byte $fA,$6b,$fA
.byte $bf,$00,$bf
.byte $bf,$0f,$bf
.byte $0b,$00,$Ab
.byte $f0,$AA,$f0
.byte $A0,$AA,$0f

View File

@ -278,12 +278,25 @@ no_keypress:
;============================
handle_return:
; check if walking verb
jsr set_destination
rts
;==============================
; set destination
;==============================
set_destination:
lda CURSOR_X
sta DESTINATION_X
lda CURSOR_Y
and #$FE ; has to be even
sta DESTINATION_Y
; FIXME: adjust for bounds
rts
@ -324,6 +337,9 @@ change_location:
asl
tay
;==========================
; update location pointer
lda (LOCATIONS_L),Y
sta LOCATION_STRUCT_L
iny
@ -331,13 +347,9 @@ change_location:
sta LOCATION_STRUCT_H
;=============================
; change direction
;=============================
change_direction:
;==========================
; load new background
done_split:
ldy #0
lda (LOCATION_STRUCT_L),Y

View File

@ -118,9 +118,13 @@ move_guybrush_x:
beq guybrush_lr_done
bcs move_guybrush_right
move_guybrush_left:
lda #DIR_LEFT
sta GUYBRUSH_DIRECTION
dec GUYBRUSH_X
jmp move_guybrush_y
move_guybrush_right:
lda #DIR_RIGHT
sta GUYBRUSH_DIRECTION
inc GUYBRUSH_X
jmp move_guybrush_y
@ -135,12 +139,16 @@ move_guybrush_y:
cmp GUYBRUSH_Y
beq guybrush_ud_done
bcs move_guybrush_up
move_guybrush_down:
bcs move_guybrush_down
move_guybrush_up:
lda #DIR_UP
sta GUYBRUSH_DIRECTION
dec GUYBRUSH_Y
dec GUYBRUSH_Y
jmp done_move_guybrush
move_guybrush_up:
move_guybrush_down:
lda #DIR_DOWN
sta GUYBRUSH_DIRECTION
inc GUYBRUSH_Y
inc GUYBRUSH_Y
jmp done_move_guybrush