mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-27 17:29:49 +00:00
ootw: alien pacing
This commit is contained in:
parent
63d9addd5c
commit
f835003606
48
ootw/alien.s
48
ootw/alien.s
@ -28,6 +28,7 @@ A_STANDING = 0
|
||||
A_WALKING = 1
|
||||
A_RUNNING = 2
|
||||
A_CROUCHING = 3
|
||||
A_TURNING = 4
|
||||
|
||||
;=======================================
|
||||
; Move alien based on current state
|
||||
@ -56,8 +57,8 @@ move_alien_walking:
|
||||
inc alien_state+ALIEN_GAIT,X ; cycle through animation
|
||||
|
||||
lda alien_state+ALIEN_GAIT,X
|
||||
and #$7
|
||||
cmp #$4 ; only walk roughly 1/8 of time
|
||||
and #$f
|
||||
cmp #$8 ; only walk roughly 1/8 of time
|
||||
bne alien_no_move_walk
|
||||
|
||||
lda alien_state+ALIEN_DIRECTION,X
|
||||
@ -104,12 +105,14 @@ astate_table_lo:
|
||||
.byte <alien_walking ; 01
|
||||
.byte <alien_running ; 02
|
||||
.byte <alien_crouching ; 03
|
||||
.byte <alien_turning ; 04
|
||||
|
||||
astate_table_hi:
|
||||
.byte >alien_standing
|
||||
.byte >alien_walking
|
||||
.byte >alien_running
|
||||
.byte >alien_crouching
|
||||
.byte >alien_standing ; 00
|
||||
.byte >alien_walking ; 01
|
||||
.byte >alien_running ; 02
|
||||
.byte >alien_crouching ; 03
|
||||
.byte >alien_turning ; 04
|
||||
|
||||
; Urgh, make sure this doesn't end up at $FF or you hit the
|
||||
; NMOS 6502 bug
|
||||
@ -181,13 +184,14 @@ alien_crouching:
|
||||
|
||||
alien_walking:
|
||||
lda alien_state+ALIEN_GAIT,X
|
||||
cmp #32
|
||||
cmp #64
|
||||
bcc alien_gait_fine ; blt
|
||||
|
||||
lda #0
|
||||
sta alien_state+ALIEN_GAIT,X
|
||||
|
||||
alien_gait_fine:
|
||||
lsr
|
||||
lsr
|
||||
and #$fe
|
||||
|
||||
@ -227,6 +231,36 @@ alien_run_gait_fine:
|
||||
|
||||
jmp finally_draw_alien
|
||||
|
||||
;===============================
|
||||
; Turning
|
||||
;================================
|
||||
|
||||
alien_turning:
|
||||
|
||||
dec alien_state+ALIEN_GAIT,X
|
||||
bpl alien_draw_turning
|
||||
|
||||
lda #0
|
||||
sta alien_state+ALIEN_GAIT,X
|
||||
|
||||
; switch direction
|
||||
lda alien_state+ALIEN_DIRECTION,X
|
||||
eor #$1
|
||||
sta alien_state+ALIEN_DIRECTION,X
|
||||
|
||||
lda #A_WALKING
|
||||
sta alien_state+ALIEN_STATE,X
|
||||
|
||||
alien_draw_turning:
|
||||
lda #<alien_turning_sprite
|
||||
sta INL
|
||||
|
||||
lda #>alien_turning_sprite
|
||||
sta INH
|
||||
|
||||
jmp finally_draw_alien
|
||||
|
||||
|
||||
|
||||
;=============================
|
||||
; Actually Draw Alien
|
||||
|
@ -149,6 +149,28 @@ guard_patrol:
|
||||
; guard patroling
|
||||
; CAGE_GUARD=15+
|
||||
|
||||
; switch direction if at end
|
||||
lda alien0_direction
|
||||
bne patrolling_right
|
||||
patrolling_left:
|
||||
lda alien0_x
|
||||
cmp #22
|
||||
bcs patrolling_move ; bge
|
||||
|
||||
lda #A_TURNING
|
||||
sta alien0_state
|
||||
|
||||
jmp patrolling_move
|
||||
patrolling_right:
|
||||
|
||||
lda alien0_x
|
||||
cmp #34
|
||||
bcc patrolling_move ; blt
|
||||
|
||||
lda #A_TURNING
|
||||
sta alien0_state
|
||||
|
||||
patrolling_move:
|
||||
jsr move_alien
|
||||
|
||||
jsr draw_alien
|
||||
@ -549,7 +571,7 @@ changing_guard11_sprite:
|
||||
|
||||
changing_guard12_sprite:
|
||||
.byte 4,9
|
||||
.byte $22,$02,$02,$22
|
||||
.byte $22,$A2,$A2,$22
|
||||
.byte $72,$57,$75,$22
|
||||
.byte $77,$07,$00,$A2
|
||||
.byte $AA,$77,$00,$AA
|
||||
@ -561,7 +583,7 @@ changing_guard12_sprite:
|
||||
|
||||
changing_guard13_sprite:
|
||||
.byte 4,9
|
||||
.byte $22,$02,$02,$22
|
||||
.byte $22,$A2,$A2,$22
|
||||
.byte $72,$57,$75,$22
|
||||
.byte $77,$07,$00,$A2
|
||||
.byte $AA,$00,$77,$AA
|
||||
|
@ -272,3 +272,19 @@ alien_crouch2:
|
||||
.byte $54,$f4,$f4
|
||||
|
||||
|
||||
|
||||
;=====================
|
||||
;=====================
|
||||
; TURNING
|
||||
;=====================
|
||||
;=====================
|
||||
alien_turning_sprite:
|
||||
.byte $5,$8
|
||||
.byte $aa,$57,$77,$aa,$aa
|
||||
.byte $0a,$05,$00,$0a,$aa
|
||||
.byte $77,$00,$00,$55,$aa
|
||||
.byte $77,$00,$00,$55,$aa
|
||||
.byte $aa,$00,$00,$a5,$aa
|
||||
.byte $aa,$77,$55,$aa,$aa
|
||||
.byte $07,$aa,$05,$aa,$aa
|
||||
.byte $00,$aa,$00,$aa,$aa
|
||||
|
Loading…
Reference in New Issue
Block a user