Tank Hit fix

And TankWidth as variable (definition).
This commit is contained in:
Pecusx
2022-09-02 23:38:56 +02:00
parent dc9c724521
commit 13e15426fc
4 changed files with 13 additions and 10 deletions
+1
View File
@@ -4,6 +4,7 @@ screenheight = 200
screenBytes = 40 screenBytes = 40
screenwidth = screenBytes*8 ; Max screenwidth = 512!!! screenwidth = screenBytes*8 ; Max screenwidth = 512!!!
TankWidth = 8
;---------------------------------------------- ;----------------------------------------------
; Player/missile memory ; Player/missile memory
PMGraph = $0800 ; real PM start = $0b00 PMGraph = $0800 ; real PM start = $0b00
+2 -2
View File
@@ -1137,10 +1137,10 @@ FallingRight
bvs EndRightFall bvs EndRightFall
; we finish falling right if the tank reached the edge of the screen ; we finish falling right if the tank reached the edge of the screen
lda XtanksTableH,x lda XtanksTableH,x
cmp #>(screenwidth-8-2) ; 2 pixels correction due to a barrel wider than tank cmp #>(screenwidth-TankWidth-2) ; 2 pixels correction due to a barrel wider than tank
bne @+ bne @+
lda XtanksTableL,x lda XtanksTableL,x
cmp #<(screenwidth-8-2) ; 2 pixels correction due to a barrel wider than tank cmp #<(screenwidth-TankWidth-2) ; 2 pixels correction due to a barrel wider than tank
@ bcs EndRightFall @ bcs EndRightFall
NotRightEdge NotRightEdge
; tank is falling right - modify coorinates ; tank is falling right - modify coorinates
BIN
View File
Binary file not shown.
+10 -8
View File
@@ -343,7 +343,7 @@ BurnedCheckLoop
@ @
bcs TankOutOfFire bcs TankOutOfFire
; let's calculate left edge of the fire ; let's calculate left edge of the fire
sbw xcircle #(napalmRadius+8+4-4) xdraw ; 10 pixels on left + character width (tank) + half character - correction sbw xcircle #(napalmRadius+TankWidth+4-4) xdraw ; 10 pixels on left + character width (tank) + half character - correction
bpl @+ bpl @+
mwa #0 xdraw ; left screen edge mwa #0 xdraw ; left screen edge
@ @
@@ -2623,10 +2623,10 @@ pressedRight
jsr DrawTankNr jsr DrawTankNr
mva #0 Erase mva #0 Erase
lda XtankstableH,x lda XtankstableH,x
cmp #>(screenwidth-12) ; tank width correction +4 cmp #>(screenwidth-TankWidth-4) ; tank width correction +4
bne @+ bne @+
lda XtankstableL,x lda XtankstableL,x
cmp #<(screenwidth-12) ; tank width correction +4 pixels cmp #<(screenwidth-TankWidth-4) ; tank width correction +4 pixels
@ bcs RightScreenEdge @ bcs RightScreenEdge
inc XtankstableL,x inc XtankstableL,x
sne:inc XtankstableH,x sne:inc XtankstableH,x
@@ -2686,10 +2686,10 @@ pressedSpace
; left or right from center of screen ? ; left or right from center of screen ?
ldy #0 ldy #0
lda XtankstableH,x lda XtankstableH,x
cmp #>((screenwidth/2)-8) cmp #>((screenwidth/2)-TankWidth)
bne @+ bne @+
lda XtankstableL,x lda XtankstableL,x
cmp #<((screenwidth/2)-8) cmp #<((screenwidth/2)-TankWidth)
@ bcc TankOnLeftSide @ bcc TankOnLeftSide
TankOnRightSide TankOnRightSide
dey dey
@@ -2865,11 +2865,13 @@ CheckCollisionWithTankLoop
lda xtankstableL,x lda xtankstableL,x
cmp xdraw cmp xdraw
@ @
bcs LeftFromTheTank ;add 8 double byte bcs LeftFromTheTank
; add 8 double byte
; now we use Y as low byte and A as high byte of checked position (right edge of tank) ; now we use Y as low byte and A as high byte of checked position (right edge of tank)
; it is tricky but fast and much shorter ; it is tricky but fast and much shorter
clc clc
adc #8 lda xtankstableL,x
adc #TankWidth
tay tay
lda xtankstableH,x lda xtankstableH,x
adc #0 adc #0
@@ -2910,7 +2912,7 @@ CheckCollisionWithShieldedTank
bcs LeftFromTheTank bcs LeftFromTheTank
tya ;add 16 double byte tya ;add 16 double byte
clc clc
adc #16 adc #TankWidth+4+4
tay tay
lda xtankstableH,x lda xtankstableH,x
adc #0 adc #0