mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-13 03:29:32 +00:00
keen: sort of got collision going on mars map
This commit is contained in:
parent
17ed65c383
commit
ed5053bb1e
|
@ -54,7 +54,7 @@ mars.o: mars.s zp.inc hardware.inc game_over.s \
|
|||
gr_fade.s \
|
||||
mars_keyboard.s draw_tilemap.s \
|
||||
mars_sfx.s longer_sound.s \
|
||||
text_help.s \
|
||||
text_help.s tilemap_lookup.s \
|
||||
maps/mars_map.zx02 graphics/parts.gr.zx02
|
||||
ca65 -o mars.o mars.s -l mars.lst
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ title
|
|||
|
||||
mars map
|
||||
~~~~~~~~
|
||||
+ make tiles for first level and green level impassable
|
||||
+ animate stars
|
||||
+ enforce collision detection
|
||||
+ proper smooth movement
|
||||
|
|
|
@ -6,5 +6,5 @@ LOAD_KEEN2 = 3
|
|||
|
||||
tiles = $9000
|
||||
big_tilemap = $9400
|
||||
tilemap = $BC00
|
||||
small_tilemap = $BC00
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ tilemap_outer_loop:
|
|||
|
||||
tilemap_loop:
|
||||
ldx TILEMAP_OFFSET ; get actual tile number
|
||||
lda tilemap,X ; from tilemap
|
||||
lda small_tilemap,X ; from tilemap
|
||||
|
||||
asl ; *4 ; point to tile to draw (4 bytes each)
|
||||
asl
|
||||
|
@ -144,7 +144,7 @@ skip_odd_row:
|
|||
sta cptl1_smc+2 ; set proper row in big tilemap
|
||||
|
||||
|
||||
lda #<tilemap
|
||||
lda #<small_tilemap
|
||||
sta cptl2_smc+1 ; reset small tilemap to row0
|
||||
|
||||
cp_tilemap_outer_loop:
|
||||
|
|
|
@ -41,7 +41,7 @@ enemy_is_out:
|
|||
ldy enemy_data_tilex,X
|
||||
load_foot1_smc:
|
||||
|
||||
lda tilemap,Y
|
||||
lda small_tilemap,Y
|
||||
cmp #HARDTOP_TILES
|
||||
bcs no_enemy_fall ; if hardtop tile, don't fall
|
||||
|
||||
|
@ -135,7 +135,7 @@ enemy_facing_right:
|
|||
ldy enemy_data_tilex,X
|
||||
iny ; to the right
|
||||
load_right_foot_smc:
|
||||
lda tilemap,Y
|
||||
lda small_tilemap,Y
|
||||
cmp #ALLHARD_TILES
|
||||
bcc no_right_barrier ; skip if no right barrier
|
||||
|
||||
|
@ -188,7 +188,7 @@ enemy_facing_left:
|
|||
ldy enemy_data_tilex,X
|
||||
dey ; look to the left
|
||||
load_left_foot_smc:
|
||||
lda tilemap,Y
|
||||
lda small_tilemap,Y
|
||||
cmp #ALLHARD_TILES
|
||||
bcc no_left_barrier ; skip if no right barrier
|
||||
|
||||
|
|
|
@ -676,6 +676,8 @@ parts_zx02:
|
|||
.include "mars_sfx.s"
|
||||
.include "longer_sound.s"
|
||||
|
||||
.include "tilemap_lookup.s"
|
||||
|
||||
mars_data_zx02:
|
||||
.incbin "maps/mars_map.zx02"
|
||||
|
||||
|
|
|
@ -111,6 +111,26 @@ check_left:
|
|||
|
||||
left_pressed:
|
||||
|
||||
; check if allowed to move left
|
||||
|
||||
ldx MARS_TILEY
|
||||
dex ; look one up
|
||||
|
||||
lda tilemap_lookup_high,X
|
||||
sta INH
|
||||
lda tilemap_lookup_low,X
|
||||
sta INL
|
||||
|
||||
ldy MARS_TILEX
|
||||
dey
|
||||
|
||||
lda (INL),Y
|
||||
|
||||
cmp #32
|
||||
bcs done_left_pressed
|
||||
|
||||
|
||||
|
||||
lda TILEMAP_X
|
||||
beq keen_walk_left
|
||||
|
||||
|
@ -152,6 +172,45 @@ check_right:
|
|||
|
||||
right_pressed:
|
||||
|
||||
; check if allowed to move right
|
||||
|
||||
ldx MARS_TILEY
|
||||
dex ; look one up
|
||||
|
||||
lda tilemap_lookup_high,X
|
||||
sta INH
|
||||
lda tilemap_lookup_low,X
|
||||
sta INL
|
||||
|
||||
ldy MARS_TILEX
|
||||
iny
|
||||
|
||||
lda (INL),Y
|
||||
|
||||
cmp #32
|
||||
bcs done_right_pressed
|
||||
|
||||
|
||||
lda MARS_TILEY
|
||||
sta INH
|
||||
lda #$0
|
||||
lsr INH
|
||||
ror
|
||||
sta INL
|
||||
|
||||
lda INH
|
||||
clc
|
||||
adc #>big_tilemap
|
||||
sta INH
|
||||
ldy MARS_TILEX
|
||||
iny
|
||||
|
||||
lda (INL),Y
|
||||
|
||||
cmp #32
|
||||
bcs done_right_pressed
|
||||
|
||||
|
||||
|
||||
move_right:
|
||||
lda TILEMAP_X
|
||||
|
@ -202,6 +261,26 @@ check_up:
|
|||
bne check_down
|
||||
|
||||
up_pressed:
|
||||
|
||||
; check if allowed to move up
|
||||
|
||||
ldx MARS_TILEY
|
||||
dex ; look one up
|
||||
|
||||
lda tilemap_lookup_high,X
|
||||
sta INH
|
||||
lda tilemap_lookup_low,X
|
||||
sta INL
|
||||
|
||||
ldy MARS_TILEX
|
||||
|
||||
lda (INL),Y
|
||||
|
||||
cmp #32
|
||||
bcs done_up_pressed
|
||||
|
||||
|
||||
|
||||
lda MARS_TILEY
|
||||
cmp #0 ; not needed
|
||||
beq move_keen_up
|
||||
|
@ -251,6 +330,24 @@ check_down:
|
|||
bne check_space
|
||||
down_pressed:
|
||||
|
||||
; check if allowed to move down
|
||||
|
||||
ldx MARS_TILEY
|
||||
inx ; look one down
|
||||
|
||||
lda tilemap_lookup_high,X
|
||||
sta INH
|
||||
lda tilemap_lookup_low,X
|
||||
sta INL
|
||||
|
||||
ldy MARS_TILEX
|
||||
|
||||
lda (INL),Y
|
||||
|
||||
cmp #32
|
||||
bcs done_down_pressed
|
||||
|
||||
|
||||
sec
|
||||
lda MARS_TILEY
|
||||
sbc TILEMAP_Y
|
||||
|
@ -324,4 +421,3 @@ no_keypress:
|
|||
bit KEYRESET
|
||||
rts
|
||||
|
||||
|
||||
|
|
57
games/keen/tilemap_lookup.s
Normal file
57
games/keen/tilemap_lookup.s
Normal file
|
@ -0,0 +1,57 @@
|
|||
|
||||
|
||||
; we could calculate this if necessary
|
||||
|
||||
tilemap_lookup_high:
|
||||
.byte (>big_tilemap)+ 0,(>big_tilemap)+ 0 ; 0,1
|
||||
.byte (>big_tilemap)+ 1,(>big_tilemap)+ 1 ; 2,3
|
||||
.byte (>big_tilemap)+ 2,(>big_tilemap)+ 2 ; 4,5
|
||||
.byte (>big_tilemap)+ 3,(>big_tilemap)+ 3 ; 6,7
|
||||
.byte (>big_tilemap)+ 4,(>big_tilemap)+ 4 ; 8,9
|
||||
.byte (>big_tilemap)+ 5,(>big_tilemap)+ 5 ; 10,11
|
||||
.byte (>big_tilemap)+ 6,(>big_tilemap)+ 6 ; 12,13
|
||||
.byte (>big_tilemap)+ 7,(>big_tilemap)+ 7 ; 14,15
|
||||
.byte (>big_tilemap)+ 8,(>big_tilemap)+ 8 ; 16,17
|
||||
.byte (>big_tilemap)+ 9,(>big_tilemap)+ 9 ; 18,19
|
||||
.byte (>big_tilemap)+10,(>big_tilemap)+ 0 ; 20,21
|
||||
.byte (>big_tilemap)+11,(>big_tilemap)+11 ; 22,23
|
||||
.byte (>big_tilemap)+12,(>big_tilemap)+12 ; 24,25
|
||||
.byte (>big_tilemap)+13,(>big_tilemap)+13 ; 26,27
|
||||
.byte (>big_tilemap)+14,(>big_tilemap)+14 ; 28,29
|
||||
.byte (>big_tilemap)+15,(>big_tilemap)+15 ; 30,31
|
||||
.byte (>big_tilemap)+16,(>big_tilemap)+16 ; 32,33
|
||||
.byte (>big_tilemap)+17,(>big_tilemap)+17 ; 34,35
|
||||
.byte (>big_tilemap)+18,(>big_tilemap)+18 ; 36,37
|
||||
.byte (>big_tilemap)+19,(>big_tilemap)+19 ; 38,39
|
||||
.byte (>big_tilemap)+20,(>big_tilemap)+20 ; 40,41
|
||||
.byte (>big_tilemap)+21,(>big_tilemap)+21 ; 42,43
|
||||
.byte (>big_tilemap)+22,(>big_tilemap)+22 ; 44,45
|
||||
.byte (>big_tilemap)+23,(>big_tilemap)+23 ; 46,47
|
||||
.byte (>big_tilemap)+24,(>big_tilemap)+24 ; 48,49
|
||||
.byte (>big_tilemap)+25,(>big_tilemap)+25 ; 50,51
|
||||
.byte (>big_tilemap)+26,(>big_tilemap)+26 ; 52,53
|
||||
.byte (>big_tilemap)+27,(>big_tilemap)+27 ; 54,55
|
||||
.byte (>big_tilemap)+28,(>big_tilemap)+28 ; 56,57
|
||||
.byte (>big_tilemap)+29,(>big_tilemap)+29 ; 58,59
|
||||
.byte (>big_tilemap)+30,(>big_tilemap)+30 ; 60,61
|
||||
.byte (>big_tilemap)+31,(>big_tilemap)+31 ; 62,63
|
||||
.byte (>big_tilemap)+32,(>big_tilemap)+32 ; 64,65
|
||||
.byte (>big_tilemap)+33,(>big_tilemap)+33 ; 66,67
|
||||
.byte (>big_tilemap)+34,(>big_tilemap)+34 ; 68,69
|
||||
.byte (>big_tilemap)+35,(>big_tilemap)+35 ; 70,71
|
||||
.byte (>big_tilemap)+36,(>big_tilemap)+36 ; 72,73
|
||||
.byte (>big_tilemap)+37,(>big_tilemap)+37 ; 74,75
|
||||
.byte (>big_tilemap)+38,(>big_tilemap)+38 ; 76,77
|
||||
.byte (>big_tilemap)+39,(>big_tilemap)+39 ; 78,79
|
||||
|
||||
tilemap_lookup_low:
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
||||
.byte $00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80,$00,$80
|
Loading…
Reference in New Issue
Block a user