Colisions added

This commit is contained in:
Pecusx
2024-08-12 09:15:54 +02:00
parent 5b90cf9800
commit 03610e2c44
5 changed files with 691 additions and 31 deletions
+89 -31
View File
@@ -13,6 +13,7 @@ DIFF_LEVELS = 16
.zpvar DinoWalkPhase .byte
.zpvar DinoState .byte ; 0/1 - walk, 2/3 - crouch, 4... - jump
.zpvar JumpPhase .byte
.zpvar Hit .byte
;---------------------------------------------------
icl 'lib/ATARISYS.ASM'
icl 'lib/MACRO.ASM'
@@ -63,38 +64,16 @@ WorldTable
FirstSTART
jsr GenerateCharsets
jsr SetGameScreen
jsr SetStart
mva #0 diff_level
; test only (some object in the world)
lda #1 ;bird0
sta WorldTable+10
lda #4 ;cactus
sta WorldTable+20
lda #4+$80 ; cactus (second char)
sta WorldTable+21
;
ldx #5 ; position
ldy #0 ; shape
jsr ShowDino
ldx #10 ; position
ldy #1 ; shape
jsr ShowDino
ldx #15 ; position
ldy #2 ; shape
jsr ShowDino
ldx #20 ; position
ldy #3 ; shape
jsr ShowDino
ldx #25 ; position
ldy #4 ; shape
jsr ShowDino
mva #$50 screen+$700+32
jsr FadeColors
NewGame
jsr SetStart
EndLoop
;lda #$32
;sta COLBAK
jsr WorldToScreen
jsr ShowDino
lda Hit
bne EndGame
;lda #$5f
;sta COLBAK
jsr CheckJoy
@@ -121,7 +100,9 @@ EndLoop
waitRTC ; or waitRTC ?
mva #4 hscrol
jmp EndLoop
halt
EndGame
key
jmp NewGame
rts
;-----------------------------------------------
@@ -325,14 +306,38 @@ ObjectLoop
DinoLoop
lda (temp_w),y
bmi @+
lda screen+$400,x ; check obstacle
beq NotHit0a
lda #$5b ; make hit mark
sta Hit
bne Hit0a
NotHit0a
lda (temp_w),y
Hit0a
sta screen+$400,x
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$500,x
beq NotHit0b
lda #$5b ; hit mark
sta Hit
bne Hit0b
NotHit0b
lda (temp_w),y
Hit0b
sta screen+$500,x
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$600,x
beq NotHit0c
lda #$5b ; hit mark
sta Hit
bne Hit0c
NotHit0c
lda (temp_w),y
Hit0c
sta screen+$600,x
@ adw temp_w #5
lda (temp_w),y
@@ -348,7 +353,7 @@ Jump
ldy JumpPhase
lda DinoJumpTr,y
cmp #2
beq jPhase2
jeq jPhase2
cmp #3
jeq jPhase3
cmp #4
@@ -362,14 +367,38 @@ DinoLoop1
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$400,x ; check obstacle
beq NotHit1a
lda #$5b ; make hit mark
sta Hit
bne Hit1a
NotHit1a
lda (temp_w),y
Hit1a
sta screen+$400,x
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$500,x ; check obstacle
beq NotHit1b
lda #$5b ; make hit mark
sta Hit
bne Hit1b
NotHit1b
lda (temp_w),y
Hit1b
sta screen+$500,x
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$600,x ; check obstacle
beq NotHit1c
lda #$5b ; make hit mark
sta Hit
bne Hit1c
NotHit1c
lda (temp_w),y
Hit1c
sta screen+$600,x
@ sbw temp_w #15
inx
@@ -390,10 +419,26 @@ DinoLoop2
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$400,x ; check obstacle
beq NotHit2a
lda #$5b ; make hit mark
sta Hit
bne Hit2a
NotHit2a
lda (temp_w),y
Hit2a
sta screen+$400,x
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$500,x ; check obstacle
beq NotHit2b
lda #$5b ; make hit mark
sta Hit
bne Hit2b
NotHit2b
lda (temp_w),y
Hit2b
sta screen+$500,x
@ sbw temp_w #15
inx
@@ -418,6 +463,14 @@ DinoLoop3
@ adw temp_w #5
lda (temp_w),y
bmi @+
lda screen+$400,x ; check obstacle
beq NotHit3a
lda #$5b ; make hit mark
sta Hit
bne Hit3a
NotHit3a
lda (temp_w),y
Hit3a
sta screen+$400,x
@ sbw temp_w #15
inx
@@ -490,10 +543,15 @@ Down
jsr ClearWorld
lda #0
sta DinoWalkPhase
lda #0
sta DinoState
sta COLOR1
sta diff_level
sta Hit
rts
.endp
;-----------------------------------------------
.proc FadeColors
ldy #0
sty COLOR1
FadeColor
sty COLOR2
sty COLOR4