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 $dA,$dA,$dA
.byte $dd,$bb,$dd .byte $dd,$bb,$dd
.byte $fA,$6b,$fA .byte $fA,$6b,$fA
.byte $bf,$00,$bf .byte $bf,$0f,$bf
.byte $0b,$00,$Ab .byte $0b,$00,$Ab
.byte $f0,$AA,$f0 .byte $f0,$AA,$f0
.byte $A0,$AA,$0f .byte $A0,$AA,$0f

View File

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

View File

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