ootw: implement kicking and crouching

Apple II keyboard auto-repeat behavior makes this interesting
This commit is contained in:
Vince Weaver 2019-01-18 11:33:23 -05:00
parent fcbca64cb6
commit 540d9e795c
7 changed files with 132 additions and 30 deletions

View File

@ -4,12 +4,11 @@
30 PRINT "ORIGINAL BY ERIC CHAHI"
40 PRINT "INSPIRED BY PAUL NICHOLAS PICO-8 VERSION"
50 PRINT
60 PRINT "WASD OR ARROWS TO MOVE"
70 PRINT "SPACEBAR FOR ACTION"
60 HTAB 9:PRINT "WASD OR ARROWS TO MOVE"
70 HTAB 10:PRINT "SPACEBAR FOR ACTION"
80 PRINT:PRINT
85 HTAB 10:PRINT " ______"
90 HTAB 10:PRINT "A \/\/\/ PRODUCTION"
92 PRINT
95 HTAB 12:PRINT "APPLE ][ FOREVER"
100 PRINT CHR$ (4)"BRUN OOTW"

View File

@ -1,6 +1,6 @@
; Ootw for Apple II
; Ootw for Apple II Lores
; by Vince "Deater" Weaver
; by Vince "Deater" Weaver <vince@deater.net>
.include "zp.inc"
.include "hardware.inc"
@ -14,6 +14,8 @@ ootw:
sta GAME_OVER
sta EQUAKE_PROGRESS
sta EARTH_OFFSET
sta KICKING
sta CROUCHING
lda #22
sta PHYSICIST_Y

View File

@ -215,14 +215,17 @@ done_cavern:
;======================================
; handle keypress
; handle keypress (cavern)
;======================================
handle_keypress_cavern:
lda KEYPRESS ; 4
bpl no_keypress_c ; 3
bmi keypress_cavern ; 3
rts
keypress_cavern:
; -1
and #$7f ; clear high bit
@ -243,6 +246,9 @@ check_left_c:
cmp #$8 ; left arrow
bne check_right_c
left_c:
lda #0
sta CROUCHING
lda DIRECTION
bne face_left_c
@ -271,8 +277,11 @@ check_right_c:
cmp #'D'
beq right_c
cmp #$15
bne unknown_c
bne check_down_c
right_c:
lda #0
sta CROUCHING
lda DIRECTION
beq face_right_c
@ -296,6 +305,29 @@ face_right_c:
sta DIRECTION
jmp done_keypress_c
check_down_c:
cmp #'S'
beq down_c
cmp #$0A
bne check_space_c
down_c:
lda #48
sta CROUCHING
lda #0
sta GAIT
jmp done_keypress_c
check_space_c:
cmp #' '
beq space_c
cmp #$15
bne unknown_c
space_c:
lda #15
sta KICKING
lda #0
sta GAIT
unknown_c:
done_keypress_c:
bit KEYRESET ; clear the keyboard strobe ; 4

View File

@ -329,8 +329,11 @@ done_pool:
handle_keypress_pool:
lda KEYPRESS ; 4
bpl no_keypress ; 3
bmi keypress_pool ; 3
rts
keypress_pool:
; -1
and #$7f ; clear high bit
@ -351,6 +354,9 @@ check_left:
cmp #$8 ; left arrow
bne check_right
left:
lda #0
sta CROUCHING
lda DIRECTION
bne face_left
@ -375,8 +381,11 @@ check_right:
cmp #'D'
beq right
cmp #$15
bne unknown
bne check_down
right:
lda #0
sta CROUCHING
lda DIRECTION
beq face_right
@ -391,8 +400,6 @@ too_far_right:
rts
just_fine_right:
inc GAIT
inc GAIT
jmp done_keypress
@ -404,6 +411,29 @@ face_right:
sta DIRECTION
jmp done_keypress
check_down:
cmp #'S'
beq down
cmp #$0A
bne check_space
down:
lda #48
sta CROUCHING
lda #0
sta GAIT
jmp done_keypress
check_space:
cmp #' '
beq space
cmp #$15
bne unknown
space:
lda #15
sta KICKING
lda #0
sta GAIT
unknown:
done_keypress:
bit KEYRESET ; clear the keyboard strobe ; 4

View File

@ -178,38 +178,40 @@ crouch_progression:
crouch1:
.byte $3,$8
.byte $aa,$aa,$aa
.byte $aa,$9a,$9a
.byte $aa,$99,$bb
.byte $9a,$9a,$aa
.byte $bb,$99,$aa
.byte $aa,$0b,$aa
.byte $aa,$bb,$aa
.byte $aa,$bb,$aa
.byte $aa,$44,$44
.byte $f4,$fc,$5a
.byte $44,$44,$aa
.byte $5a,$fc,$f4
crouch2:
.byte $3,$8
.byte $aa,$aa,$aa
.byte $aa,$aa,$aa
.byte $aa,$9a,$9a
.byte $aa,$99,$bb
.byte $0a,$0b,$aa
.byte $00,$bb,$aa
.byte $aa,$4b,$ba
.byte $f4,$f4,$54
.byte $9a,$9a,$aa
.byte $bb,$99,$aa
.byte $aa,$0b,$0a
.byte $aa,$bb,$00
.byte $ba,$4b,$aa
.byte $54,$f4,$f4
;=======================
; Kicking
; note: he needs to be facing left by default
kick1:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$99,$bb,$aa
.byte $aa,$0b,$aa,$aa
.byte $aa,$0b,$ba,$aa
.byte $ba,$00,$ab,$bb
.byte $aa,$44,$aa,$aa
.byte $ca,$a4,$44,$aa
.byte $5c,$5a,$f4,$af
.byte $aa,$bb,$99,$aa
.byte $aa,$aa,$0b,$aa
.byte $aa,$ba,$0b,$aa
.byte $bb,$ab,$00,$ba
.byte $aa,$aa,$44,$aa
.byte $aa,$44,$a4,$ca
.byte $af,$f4,$5a,$5c
;=======================

View File

@ -4,6 +4,40 @@
draw_physicist:
; FIXME: what happens if crouch+kick
; or crouch+walk?
check_if_still_kicking:
lda KICKING
beq check_crouching
kicking:
lda #<kick1
sta INL
lda #>kick1
sta INH
dec KICKING
jmp finally_draw_him
check_crouching:
lda CROUCHING
beq walking
crouching:
; FIXME: we have an animation?
lda #<crouch2
sta INL
lda #>crouch2
sta INH
jmp finally_draw_him
walking:
lda GAIT
and #$f
sta GAIT
@ -15,6 +49,7 @@ draw_physicist:
lda phys_walk_progression+1,X
sta INH
finally_draw_him:
lda PHYSICIST_X
sta XPOS

View File

@ -140,6 +140,8 @@ EQUAKE_PROGRESS = $E6
EARTH_OFFSET = $E7
BOULDER_X = $E8
BOULDER_Y = $E9
CROUCHING = $EA
KICKING = $EB
;SHIPY = $E4
;YADD = $E5
;LOOP = $E6