keen: working on making generic level engine

This commit is contained in:
Vince Weaver 2024-04-14 23:52:16 -04:00
parent fbaec2928b
commit 2c2d0cf017
8 changed files with 67 additions and 51 deletions

View File

@ -69,7 +69,7 @@ level1.o: level1.s zp.inc hardware.inc \
maps/level1_map.zx02 \ maps/level1_map.zx02 \
status_bar.s draw_keen.s move_keen.s gr_putsprite_crop.s \ status_bar.s draw_keen.s move_keen.s gr_putsprite_crop.s \
draw_tilemap.s tilemap_lookup.s \ draw_tilemap.s tilemap_lookup.s \
level1_sfx.s longer_sound.s \ level1_sfx.s longer_sound.s level1_data.inc \
keyboard.s handle_laser.s keyboard.s handle_laser.s
ca65 -o level1.o level1.s -l level1.lst ca65 -o level1.o level1.s -l level1.lst
@ -85,7 +85,7 @@ level2.o: level2.s zp.inc hardware.inc \
maps/level2_map.zx02 \ maps/level2_map.zx02 \
status_bar.s draw_keen.s move_keen.s gr_putsprite_crop.s \ status_bar.s draw_keen.s move_keen.s gr_putsprite_crop.s \
draw_tilemap.s tilemap_lookup.s \ draw_tilemap.s tilemap_lookup.s \
level1_sfx.s longer_sound.s \ level1_sfx.s longer_sound.s level2_data.inc \
keyboard.s handle_laser.s keyboard.s handle_laser.s
ca65 -o level2.o level2.s -l level2.lst ca65 -o level2.o level2.s -l level2.lst

View File

@ -14,13 +14,13 @@ mars map
+ mark completed levels + mark completed levels
at start, over-write finished levels with blue tiles at start, over-write finished levels with blue tiles
check completed levels when action and not let you re-enter check completed levels when action and not let you re-enter
level1 level engine
~~~~~~ ~~~~~~~~~~~~~
+ fix so works again + make generic
sound effects sound effects
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
+ effect for transporter
movement: movement:
~~~~~~~~~ ~~~~~~~~~
@ -33,7 +33,7 @@ enemies
shooting shooting
~~~~~~~~ ~~~~~~~~
+ collision with enemies + FIX collision with enemies
+ shoot enemies + shoot enemies
pogo pogo

View File

@ -22,11 +22,21 @@ laser_check_tiles:
clc clc
lda LASER_TILEY lda LASER_TILEY
adc #>big_tilemap tay
sta INH
lda LASER_TILEX lda tilemap_lookup_high,Y
sta INH
lda tilemap_lookup_low,Y
clc
adc LASTER_TILEX
sta INL sta INL
; adc #>big_tilemap
; sta INH
; lda LASER_TILEX
; sta INL
ldy #0 ldy #0
lda (INL),Y lda (INL),Y
cmp #ALLHARD_TILES cmp #ALLHARD_TILES
@ -105,9 +115,12 @@ laser_sideways_sprite:
; laser enemies ; laser enemies
;======================= ;=======================
; see if laser hits any enemies ; see if laser hits any enemies
; FIXME: this is broken
laser_enemies: laser_enemies:
ldy #0 ldy #0 ; which enemy
laser_enemies_loop: laser_enemies_loop:
; see if out ; see if out
@ -118,7 +131,7 @@ laser_enemies_loop:
; get local tilemap co-ord ; get local tilemap co-ord
sec sec
lda enemy_data_tilex,Y lda enemy_data_tilex,Y
sbc TILEMAP_X sbc TILEMAP_X ; compare enemy size?
sta TILE_TEMP sta TILE_TEMP
@ -151,13 +164,10 @@ hit_something:
jmp exit_laser_enemy jmp exit_laser_enemy
done_laser_enemy: done_laser_enemy:
iny
tya cpy #NUM_ENEMIES
clc
adc #8
tay
cpy #(NUM_ENEMIES*8)
bne laser_enemies_loop bne laser_enemies_loop
exit_laser_enemy: exit_laser_enemy:
rts rts

View File

@ -7,11 +7,9 @@
.include "hardware.inc" .include "hardware.inc"
.include "common_defines.inc" .include "common_defines.inc"
.include "level1_data.inc"
MAX_TILE_X = 96 ; 116 - 20 level1_start:
MAX_TILE_Y = 5 ; (34 - 24)/2 (maybe?)
keen_start:
;=================== ;===================
; init screen ; init screen
@ -49,14 +47,11 @@ keen_start:
lda #4 lda #4
sta DRAW_PAGE sta DRAW_PAGE
; Level 1 ; set starting location
; start at 2,24 (remember tiles 2 bytes high even though 4 pixels)
; but with reference to starting tilemap (0,5) should be
; 2,8?
lda #1 lda #START_KEEN_TILEX
sta KEEN_TILEX sta KEEN_TILEX
lda #13 lda #START_KEEN_TILEY
sta KEEN_TILEY sta KEEN_TILEY
lda #0 ; offset from tile location lda #0 ; offset from tile location
@ -84,9 +79,9 @@ keen_start:
; we copy in full screen, 40x48 = 20x12 tiles ; we copy in full screen, 40x48 = 20x12 tiles
; we start out assuming position is 0,5 ; we start out assuming position is 0,5
lda #0 lda #START_TILEMAP_X
sta TILEMAP_X sta TILEMAP_X
lda #5 lda #START_TILEMAP_Y
sta TILEMAP_Y sta TILEMAP_Y
jsr copy_tilemap_subset jsr copy_tilemap_subset

View File

@ -0,0 +1,12 @@
; Level 1 (Border Town)
MAX_TILE_X = 96 ; 116 - 20
MAX_TILE_Y = 5 ; (34 - 24)/2 (maybe?)
START_KEEN_TILEX = 1
START_KEEN_TILEY = 13
START_TILEMAP_X = 0
START_TILEMAP_Y = 5
NUM_ENEMIES = 8

View File

@ -1,5 +1,3 @@
NUM_ENEMIES = 8
;======================= ;=======================
; move enemies ; move enemies

View File

@ -7,11 +7,10 @@
.include "hardware.inc" .include "hardware.inc"
.include "common_defines.inc" .include "common_defines.inc"
.include "level2_data.inc"
MAX_TILE_X = 96 ; 116 - 20
MAX_TILE_Y = 5 ; (34 - 24)/2 (maybe?)
keen_start: level2_start:
;=================== ;===================
; init screen ; init screen
@ -49,14 +48,11 @@ keen_start:
lda #4 lda #4
sta DRAW_PAGE sta DRAW_PAGE
; Level 1 ; set starting location
; start at 2,24 (remember tiles 2 bytes high even though 4 pixels)
; but with reference to starting tilemap (0,5) should be
; 2,8?
lda #1 lda #START_KEEN_TILEX
sta KEEN_TILEX sta KEEN_TILEX
lda #13 lda #START_KEEN_TILEY
sta KEEN_TILEY sta KEEN_TILEY
lda #0 ; offset from tile location lda #0 ; offset from tile location
@ -84,9 +80,9 @@ keen_start:
; we copy in full screen, 40x48 = 20x12 tiles ; we copy in full screen, 40x48 = 20x12 tiles
; we start out assuming position is 0,5 ; we start out assuming position is 0,5
lda #0 lda #START_TILEMAP_X
sta TILEMAP_X sta TILEMAP_X
lda #5 lda #START_TILEMAP_Y
sta TILEMAP_Y sta TILEMAP_Y
jsr copy_tilemap_subset jsr copy_tilemap_subset
@ -232,10 +228,7 @@ skip_end_sound:
level1_gameover: level1_gameover:
; mars plays this ; mars plays the sound
; ldy #SFX_GAMEOVERSND
; jsr play_sfx
lda #GAME_OVER lda #GAME_OVER
sta LEVEL_OVER sta LEVEL_OVER
@ -252,10 +245,6 @@ level1_levelover:
; includes ; includes
;========================== ;==========================
; level graphics
;level1_bg_zx02:
; .incbin "graphics/level1_bg.gr.zx02"
.include "text_print.s" .include "text_print.s"
.include "gr_offsets.s" .include "gr_offsets.s"
.include "gr_fast_clear.s" .include "gr_fast_clear.s"

View File

@ -0,0 +1,12 @@
; Level 2 (First Shrine)
MAX_TILE_X = 96 ; 116 - 20
MAX_TILE_Y = 26 ; 26 (maybe?)
START_KEEN_TILEX = 1
START_KEEN_TILEY = 13
START_TILEMAP_X = 0
START_TILEMAP_Y = 5
NUM_ENEMIES = 8