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
screenwidth = screenBytes*8 ; Max screenwidth = 512!!!
TankWidth = 8
;----------------------------------------------
; Player/missile memory
PMGraph = $0800 ; real PM start = $0b00
+2 -2
View File
@@ -1137,10 +1137,10 @@ FallingRight
bvs EndRightFall
; we finish falling right if the tank reached the edge of the screen
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 @+
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
NotRightEdge
; tank is falling right - modify coorinates
BIN
View File
Binary file not shown.
+10 -8
View File
@@ -343,7 +343,7 @@ BurnedCheckLoop
@
bcs TankOutOfFire
; 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 @+
mwa #0 xdraw ; left screen edge
@
@@ -2623,10 +2623,10 @@ pressedRight
jsr DrawTankNr
mva #0 Erase
lda XtankstableH,x
cmp #>(screenwidth-12) ; tank width correction +4
cmp #>(screenwidth-TankWidth-4) ; tank width correction +4
bne @+
lda XtankstableL,x
cmp #<(screenwidth-12) ; tank width correction +4 pixels
cmp #<(screenwidth-TankWidth-4) ; tank width correction +4 pixels
@ bcs RightScreenEdge
inc XtankstableL,x
sne:inc XtankstableH,x
@@ -2686,10 +2686,10 @@ pressedSpace
; left or right from center of screen ?
ldy #0
lda XtankstableH,x
cmp #>((screenwidth/2)-8)
cmp #>((screenwidth/2)-TankWidth)
bne @+
lda XtankstableL,x
cmp #<((screenwidth/2)-8)
cmp #<((screenwidth/2)-TankWidth)
@ bcc TankOnLeftSide
TankOnRightSide
dey
@@ -2865,11 +2865,13 @@ CheckCollisionWithTankLoop
lda xtankstableL,x
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)
; it is tricky but fast and much shorter
clc
adc #8
lda xtankstableL,x
adc #TankWidth
tay
lda xtankstableH,x
adc #0
@@ -2910,7 +2912,7 @@ CheckCollisionWithShieldedTank
bcs LeftFromTheTank
tya ;add 16 double byte
clc
adc #16
adc #TankWidth+4+4
tay
lda xtankstableH,x
adc #0