ootw: first steps at alien laser firing

This commit is contained in:
Vince Weaver 2019-08-22 11:54:21 -04:00
parent 7d6e13343c
commit 02b123ccfa
6 changed files with 137 additions and 1 deletions

View File

@ -68,6 +68,7 @@ ootw_c2.o: ootw_c2.s \
gr_copy.s gr_copy_offset.s gr_fast_clear.s gr_pageflip.s gr_unrle.s \
gr_hlin.s gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
keyboard.s gr_run_sequence.s audio.s \
alien_laser.s \
physicist.s alien.s friend.s \
collision.s door.s laser.s shield.s blast.s gun.s \
ootw_c2_miners.s \
@ -105,7 +106,7 @@ ootw_c4.o: ootw_c4.s \
gr_unrle.s gr_hlin.s \
gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
keyboard.s gr_run_sequence.s physicist.s \
collision.s alien.s \
collision.s alien.s alien_laser.s \
ootw_c4_city.s ootw_c4_action.s \
door.s laser.s shield.s blast.s gun.s charger.s \
ootw_graphics/sprites/physicist.inc \

View File

@ -144,6 +144,13 @@ move_alien_standing:
cmp alien_y,X
bne done_move_alien_standing
;=================
; delay a bit so it doesn't happen instantaneously
lda FRAMEL
and #$3f
bne done_move_alien_standing
lda PHYSICIST_X
cmp alien_x,X
bcs alien_face_right
@ -157,14 +164,23 @@ alien_face_right:
alien_done_facing:
sta alien_direction,X
; change to shooting
lda #A_SHOOTING
sta alien_state,X
done_move_alien_standing:
jmp done_move_alien
;======================
; shooting
move_alien_shooting:
jmp done_move_alien
@ -177,6 +193,7 @@ astate_table_lo:
.byte <alien_yelling ; 05
.byte <alien_shooting_up; 06
.byte <alien_disintegrating; 07
.byte <alien_shooting ; 08
astate_table_hi:
.byte >alien_standing ; 00
@ -187,6 +204,7 @@ astate_table_hi:
.byte >alien_yelling ; 05
.byte >alien_shooting_up; 06
.byte >alien_disintegrating; 07
.byte >alien_shooting ; 08
; Urgh, make sure this doesn't end up at $FF or you hit the
; NMOS 6502 bug
@ -247,6 +265,20 @@ alien_standing:
jmp finally_draw_alien
;==================================
; SHOOTING
;==================================
alien_shooting:
lda #<alien_shoot_sprite
sta INL
lda #>alien_shoot_sprite
sta INH
jmp finally_draw_alien
;===================================
; CROUCHING

84
ootw/alien_laser.s Normal file
View File

@ -0,0 +1,84 @@
; Handle alien laser
; uses laser1 slot
; should handle multiple at once?
;laser1_out: .byte $0
;laser1_start: .byte $0
;laser1_end: .byte $0
;laser1_y: .byte $0
;laser1_direction: .byte $0
;laser1_count: .byte $0
;=========================
; fire alien laser
;=========================
; which alien in X
fire_alien_laser:
lda laser1_out
bne done_fire_alien_laser
; activate laser slot
inc laser1_out
; reset count
lda #0
sta laser1_count
; set y
; assume for now no crouching
lda alien_y,X
clc
adc #4
sta laser1_y
; set direction
lda alien_direction,X
sta laser1_direction
beq alien_laser_left
bne alien_laser_right
; set x
alien_laser_left:
jsr calc_gun_left_collision
lda alien_x,X
; dex
sta laser1_end
; txa
sec
sbc #10
sta laser1_start
jmp done_fire_alien_laser
alien_laser_right:
jsr calc_gun_right_collision
lda alien_x,X
clc
adc #5
sta laser1_start
clc
adc #10
sta laser1_end
done_fire_alien_laser:
rts

View File

@ -13,12 +13,29 @@
; should handle shooting while crouching
laser_out:
laser0_out: .byte $0
laser1_out: .byte $0
laser_start:
laser0_start: .byte $0
laser1_start: .byte $0
laser_end:
laser0_end: .byte $0
laser1_end: .byte $0
laser_y:
laser0_y: .byte $0
laser1_y: .byte $0
laser_direction:
laser0_direction: .byte $0
laser1_direction: .byte $0
laser_cout:
laser0_count: .byte $0
laser1_count: .byte $0
;=========================
; fire laser

View File

@ -132,6 +132,7 @@ end_message:
.include "gun.s"
.include "blast.s"
.include "laser.s"
.include "alien_laser.s"
.include "shield.s"
.include "door.s"
.include "collision.s"

View File

@ -110,6 +110,7 @@ end_message:
.include "blast.s"
.include "collision.s"
.include "dummy_friend.s"
.include "alien_laser.s"
.include "ootw_c4_action.s"