keen: can squish yorps

This commit is contained in:
Vince Weaver 2024-04-06 02:18:42 -04:00
parent d5efc2135a
commit c960ca1b16
6 changed files with 123 additions and 57 deletions

View File

@ -1,5 +1,5 @@
5 HOME
10 PRINT "LOADING KEEN V0.01"
10 PRINT "LOADING KEEN V0.04"
20 PRINT " KEEN1 PROOF-OF-CONCEPT DEMAKE"
30 PRINT:PRINT
70 PRINT "BASED ON KEEN1 BY ID"

View File

@ -76,12 +76,17 @@ enemy_new_state:
enemy_action:
lda enemy_data_state,X
cmp #YORP_STUNNED
beq goto_done_move_enemy
cmp #YORP_SEARCH
beq enemy_search
cmp #YORP_JUMP
beq enemy_jump
bne enemy_walk
goto_done_move_enemy:
jmp done_move_enemy
enemy_search:
lda enemy_data_direction,X
eor #$FF
@ -284,6 +289,18 @@ draw_proper_enemy:
; lda enemy_sprites+1,X
; sta INH
lda enemy_data_state,Y
cmp #YORP_STUNNED
bne draw_enemy_walk
lda #<yorp_sprite_stunned
sta INL
lda #>yorp_sprite_stunned
jmp draw_enemy_common
draw_enemy_walk:
lda enemy_data_direction,Y
bmi draw_enemy_left
@ -368,6 +385,8 @@ YORP = 0
YORP_WALK = 0
YORP_JUMP = 1
YORP_SEARCH = 2
YORP_WALK2 = 3
YORP_STUNNED= 4
LEFT = $FF
RIGHT = $1

View File

@ -5,6 +5,8 @@
check_items:
jsr check_yorp
;===================
; check head first
;===================
@ -58,9 +60,12 @@ check_feet_tilex:
; check if going out door
jsr check_door
; check if touching enemy
; check if touching fixed enemy
jsr check_enemy
; check yorp
; jsr check_yorp
; check item
jsr check_item
@ -70,13 +75,16 @@ check_feet_tilex1:
; check if going out door
jsr check_door
; check if touching enemy
; check if touching fixed enemy
jsr check_enemy
; check yorp
; jsr check_yorp
; check items
jsr check_item
rts ; FIXME: fallthrough
; rts ; FIXME: fallthrough
@ -166,7 +174,7 @@ done_check_door:
;=============================
; check if feet touching enemy
; check if touching enemy
;=============================
; level1 at least you can't touch with head?
check_enemy:
@ -179,25 +187,73 @@ check_enemy:
touched_enemy:
; actual level over handled elsewhere
lda #TOUCHED_ENEMY
sta LEVEL_OVER
; ldy #SFX_KEENDIESND
; jsr play_sfx
; ; TODO: ANIMATION
; ; keen turns to head, flies up screen
; ; play game over music if out of keens
; lda KEENS
; bpl done_check_enemy
; ldy #SFX_GAMEOVERSND
; jsr play_sfx
done_check_enemy:
rts
;==================================
; check if feet touching yorp head
;==================================
check_yorp:
ldx #0
check_yorp_loop:
lda enemy_data_out,X
beq no_yorp_stomp
lda enemy_data_state,X
cmp #YORP_STUNNED
beq no_yorp_stomp
lda enemy_data_tilex,X
cmp KEEN_TILEX
bne no_yorp_stomp
;==================
; K 0+1=1
; K Y
; Y
lda enemy_data_tiley,X
sec
sbc #1
cmp KEEN_TILEY
bne no_yorp_stomp
yes_yorp_stomp:
; this trashes X,Y
txa
pha
ldy #SFX_YORPBOPSND
jsr play_sfx
pla
tax
lda #YORP_STUNNED
sta enemy_data_state,X
lda #255
sta enemy_data_count,X
no_yorp_stomp:
inx
cpx #NUM_ENEMIES
bne check_yorp_loop
done_check_yorp:
rts
score_lookup:
.byte $00,$01,$10,$05,$02,$50 ; BCD
; 0 = laser gun
@ -207,40 +263,3 @@ score_lookup:
; 4 = carbonated beverage 200 pts
; ? = bear 5000 pts
.if 0
; bit of a hack
; TODO: auto-generate at startup
div20_table:
.byte 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0
.byte 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1
.byte 2,2,2,2,2, 2,2,2,2,2, 2,2,2,2,2, 2,2,2,2,2
.byte 3,3,3,3,3, 3,3,3,3,3, 3,3,3,3,3, 3,3,3,3,3
.byte 4,4,4,4,4, 4,4,4,4,4, 4,4,4,4,4, 4,4,4,4,4
.byte 5,5,5,5,5, 5,5,5,5,5, 5,5,5,5,5, 5,5,5,5,5
.byte 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6
.byte 7,7,7,7,7, 7,7,7,7,7, 7,7,7,7,7, 7,7,7,7,7
.byte 8,8,8,8,8, 8,8,8,8,8, 8,8,8,8,8, 8,8,8,8,8
.byte 9,9,9,9,9, 9,9,9,9,9, 9,9,9,9,9, 9,9,9,9,9
.byte 10,10,10,10,10, 10,10,10,10,10, 10,10,10,10,10, 10,10,10,10,10
.byte 11,11,11,11,11, 11,11,11,11,11, 11,11,11,11,11, 11,11,11,11,11
.byte 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12 ;, 12,12,12,12,12
mod20_table:
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
.endif

View File

@ -6,6 +6,7 @@ SFX_GUNCLICK = 4
SFX_KEENLANDSND= 5
SFX_KEENJUMPSND= 6
SFX_BUMPHEADSND= 7
SFX_YORPBOPSND = 8
;==========================
; plays soundfx
;==========================
@ -52,11 +53,11 @@ play_done:
sounds_low:
.byte <KEENDIESND,<LVLDONESND, <GAMEOVERSND,<GOTITEMSND,<GUNCLICK
.byte <KEENLANDSND,<KEENJUMPSND,<BUMPHEADSND
.byte <KEENLANDSND,<KEENJUMPSND,<BUMPHEADSND,<YORPBOPSND
sounds_high:
.byte >KEENDIESND,>LVLDONESND, >GAMEOVERSND,>GOTITEMSND,>GUNCLICK
.byte >KEENLANDSND,>KEENJUMPSND,>BUMPHEADSND
.byte >KEENLANDSND,>KEENJUMPSND,>BUMPHEADSND,>YORPBOPSND
KEENDIESND:
.byte 20,1 ; 1169.8
@ -476,3 +477,30 @@ BUMPHEADSND:
.byte 184,1 ; 133.5
.byte 186,1 ; 131.7
.byte 255,255
YORPBOPSND:
.byte 102,1 ; 239.6
.byte 104,1 ; 234.0
.byte 106,3 ; 231.2
.byte 107,2 ; 228.6
.byte 104,1 ; 234.0
.byte 103,1 ; 236.7
.byte 101,1 ; 242.5
.byte 99,1 ; 245.5
.byte 97,1 ; 251.7
.byte 94,1 ; 258.3
.byte 92,3 ; 265.2
.byte 0,14 ; 0.0
.byte 8,3 ; 2840.9
.byte 0,4 ; 0.0
.byte 25,3 ; 947.0
.byte 0,4 ; 0.0
.byte 9,3 ; 2485.8
.byte 0,5 ; 0.0
.byte 24,3 ; 994.3
.byte 0,4 ; 0.0
.byte 9,3 ; 2485.8
.byte 0,3 ; 0.0
.byte 24,3 ; 994.3
.byte 0,5 ; 0.0
.byte 4,3 ; 4971.6
.byte 255,255

View File

@ -29,7 +29,7 @@ keen_sprites.inc: keen_sprites.png
$(PNG2SPRITES) keen_sprites.png yorp_sprite_walking_right 11 22 4 8 >> keen_sprites.inc
$(PNG2SPRITES) keen_sprites.png yorp_sprite_standing 11 32 4 8 >> keen_sprites.inc
$(PNG2SPRITES) keen_sprites.png keen_sprite_squish 16 32 4 8 >> keen_sprites.inc
$(PNG2SPRITES) keen_sprites.png yorp_sprite_stunned 21 2 4 8 >> keen_sprites.inc
####

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB