mirror of
https://github.com/jeremysrand/BuGS.git
synced 2024-05-29 08:41:26 +00:00
Add the ability to shoot. Detect shot collisions with mushrooms and shoot the mushrooms. Remove the ability to randomly shoot the mushrooms because that debug is no longer needed. Fix a bug where the number of infield mushrooms was not being updated for mushrooms which were shot until gone.
This commit is contained in:
parent
4e6bad0ae7
commit
64f96896f7
|
@ -279,11 +279,6 @@ checkKey_loop2 anop
|
||||||
beq checkKey_shootSpider
|
beq checkKey_shootSpider
|
||||||
cmp #'P'
|
cmp #'P'
|
||||||
beq checkKey_shootSpider
|
beq checkKey_shootSpider
|
||||||
|
|
||||||
cmp #'m'
|
|
||||||
beq checkKey_shootMushroom
|
|
||||||
cmp #'M'
|
|
||||||
beq checkKey_shootMushroom
|
|
||||||
|
|
||||||
cmp #'g'
|
cmp #'g'
|
||||||
beq checkKey_game
|
beq checkKey_game
|
||||||
|
@ -307,9 +302,6 @@ checkKey_shootSpider anop
|
||||||
|
|
||||||
checkKey_shootCentipede anop
|
checkKey_shootCentipede anop
|
||||||
jmp shootRandomSegment
|
jmp shootRandomSegment
|
||||||
|
|
||||||
checkKey_shootMushroom anop
|
|
||||||
jmp shootRandomMushroom
|
|
||||||
|
|
||||||
checkKey_quit anop
|
checkKey_quit anop
|
||||||
stz shouldQuit
|
stz shouldQuit
|
||||||
|
|
|
@ -56,12 +56,17 @@ shootMushroom entry
|
||||||
sbc #4
|
sbc #4
|
||||||
sta tileType,x
|
sta tileType,x
|
||||||
bne shootMushroom_done
|
bne shootMushroom_done
|
||||||
jmp scoreAddOne
|
bra shootMushroom_empty
|
||||||
|
|
||||||
shootMushroom_poisoned anop
|
shootMushroom_poisoned anop
|
||||||
bne shootMushroom_poisonedNoScore
|
bne shootMushroom_poisonedNoScore
|
||||||
lda #TILE_EMPTY
|
lda #TILE_EMPTY
|
||||||
sta tileType,x
|
sta tileType,x
|
||||||
|
shootMushroom_empty anop
|
||||||
|
cpx #SPIDER_STARTING_TOP_ROW_OFFSET
|
||||||
|
blt shootMushrom_notInfield
|
||||||
|
dec numInfieldMushrooms
|
||||||
|
shootMushrom_notInfield anop
|
||||||
jmp scoreAddOne
|
jmp scoreAddOne
|
||||||
|
|
||||||
shootMushroom_poisonedNoScore anop
|
shootMushroom_poisonedNoScore anop
|
||||||
|
@ -72,25 +77,5 @@ shootMushroom_poisonedNoScore anop
|
||||||
|
|
||||||
shootMushroom_done anop
|
shootMushroom_done anop
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
|
||||||
shootRandomMushroom entry
|
|
||||||
lda prevRandomMushroom
|
|
||||||
cmp #RHS_FIRST_TILE_OFFSET
|
|
||||||
bge shootRandomMushroom_doRandom
|
|
||||||
tax
|
|
||||||
bra shootRandomMushroom_testTile
|
|
||||||
|
|
||||||
shootRandomMushroom_doRandom anop
|
|
||||||
jsl randomMushroomOffset
|
|
||||||
tax
|
|
||||||
shootRandomMushroom_testTile anop
|
|
||||||
lda tileType,x
|
|
||||||
beq shootRandomMushroom_doRandom
|
|
||||||
stx prevRandomMushroom
|
|
||||||
jmp shootMushroom
|
|
||||||
|
|
||||||
|
|
||||||
prevRandomMushroom dc i2'RHS_FIRST_TILE_OFFSET'
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,6 +43,8 @@ playerLevelStart entry
|
||||||
sta mouseX
|
sta mouseX
|
||||||
lda #STARTING_MOUSE_Y
|
lda #STARTING_MOUSE_Y
|
||||||
sta mouseY
|
sta mouseY
|
||||||
|
lda #1
|
||||||
|
sta mouseDown
|
||||||
dec numLives
|
dec numLives
|
||||||
lda #P1_LIVES_OFFSET
|
lda #P1_LIVES_OFFSET
|
||||||
sec
|
sec
|
||||||
|
@ -223,16 +225,24 @@ updatePlayer_doneY anop
|
||||||
|
|
||||||
; The X and Y register also has a bit in each which indicates whether a
|
; The X and Y register also has a bit in each which indicates whether a
|
||||||
; mouse button is down or not.
|
; mouse button is down or not.
|
||||||
|
|
||||||
txa
|
txa
|
||||||
and #$0080
|
and #$0080
|
||||||
beq updatePlayer_mouseDown
|
beq updatePlayer_mouseDown
|
||||||
tya
|
tya
|
||||||
and #$0080
|
and #$0080
|
||||||
bne updatePlayer_skipDeltas
|
beq updatePlayer_mouseDown
|
||||||
|
lda #1
|
||||||
|
sta mouseDown
|
||||||
|
bra updatePlayer_skipDeltas
|
||||||
updatePlayer_mouseDown anop
|
updatePlayer_mouseDown anop
|
||||||
jsl maybeShoot
|
stz mouseDown
|
||||||
|
|
||||||
updatePlayer_skipDeltas anop
|
updatePlayer_skipDeltas anop
|
||||||
|
lda mouseDown
|
||||||
|
bne updatePlayer_notShooting
|
||||||
|
jsl maybeShoot
|
||||||
|
updatePlayer_notShooting anop
|
||||||
lda mouseY
|
lda mouseY
|
||||||
asl a
|
asl a
|
||||||
tay
|
tay
|
||||||
|
@ -326,6 +336,7 @@ updatePlayer_done anop
|
||||||
|
|
||||||
playerFrameCount dc i2'0'
|
playerFrameCount dc i2'0'
|
||||||
playerExplosionOffset dc i2'0'
|
playerExplosionOffset dc i2'0'
|
||||||
|
mouseDown dc i2'0'
|
||||||
|
|
||||||
|
|
||||||
SHIP_EXPLOSION_LAST_OFFSET equ 7*4
|
SHIP_EXPLOSION_LAST_OFFSET equ 7*4
|
||||||
|
|
|
@ -72,13 +72,100 @@ updateShot_shifted anop
|
||||||
sta tileDirty,x
|
sta tileDirty,x
|
||||||
jmp >drawHalfShotShift
|
jmp >drawHalfShotShift
|
||||||
|
|
||||||
|
|
||||||
updateShot_notNone anop
|
updateShot_notNone anop
|
||||||
|
cmp #SHOT_STATE_START_SHOOTING
|
||||||
|
bne updateShot_shooting
|
||||||
|
lda SHOT_STATE_SHOOTING
|
||||||
|
sta shotState
|
||||||
|
lda #1
|
||||||
|
and mouseX
|
||||||
|
sta shotShifted
|
||||||
|
bne updateShot_startShootingShifted
|
||||||
|
lda mouseAddress
|
||||||
|
sec
|
||||||
|
sbc #TILE_PIXEL_HEIGHT*SCREEN_BYTES_PER_ROW-1
|
||||||
|
sta shotAddress
|
||||||
|
bra updateShot_findDirty
|
||||||
|
updateShot_startShootingShifted anop
|
||||||
|
lda mouseAddress
|
||||||
|
sec
|
||||||
|
sbc #TILE_PIXEL_HEIGHT*SCREEN_BYTES_PER_ROW-2
|
||||||
|
sta shotAddress
|
||||||
|
updateShot_findDirty anop
|
||||||
|
sec
|
||||||
|
sbc #SCREEN_ADDRESS
|
||||||
|
and #$fffc
|
||||||
|
tax
|
||||||
|
lda >screenToTileOffset,x
|
||||||
|
sta shotTileOffsetAbove
|
||||||
|
tax
|
||||||
|
lda tileBelow,x
|
||||||
|
sta shotTileOffsetBelow
|
||||||
|
bra updateShot_drawShot
|
||||||
|
|
||||||
|
updateShot_shooting anop
|
||||||
|
lda shotAddress
|
||||||
|
sec
|
||||||
|
sbc #TILE_PIXEL_HEIGHT*SCREEN_BYTES_PER_ROW
|
||||||
|
sta shotAddress
|
||||||
|
cmp #SCREEN_ADDRESS-6*SCREEN_BYTES_PER_ROW
|
||||||
|
bge updateShot_updateDirty
|
||||||
|
lda #SHOT_STATE_NONE
|
||||||
|
sta shotState
|
||||||
|
rtl
|
||||||
|
|
||||||
|
updateShot_updateDirty anop
|
||||||
|
ldx shotTileOffsetAbove
|
||||||
|
stx shotTileOffsetBelow
|
||||||
|
lda tileAbove,x
|
||||||
|
cmp #INVALID_TILE_NUM
|
||||||
|
beq updateShot_drawShot
|
||||||
|
sta shotTileOffsetAbove
|
||||||
|
|
||||||
|
updateShot_drawShot anop
|
||||||
|
lda #TILE_STATE_DIRTY
|
||||||
|
ldx shotTileOffsetAbove
|
||||||
|
sta tileDirty,x
|
||||||
|
ldx shotTileOffsetBelow
|
||||||
|
sta tileDirty,x
|
||||||
|
ldy shotAddress
|
||||||
|
lda shotShifted
|
||||||
|
bne updateShot_drawShifted
|
||||||
|
jsl drawShot
|
||||||
|
bra updateShot_checkCollision
|
||||||
|
updateShot_drawShifted anop
|
||||||
|
jsl drawShotShift
|
||||||
|
|
||||||
|
updateShot_checkCollision anop
|
||||||
|
bne updateShot_collision
|
||||||
|
rtl
|
||||||
|
updateShot_collision anop
|
||||||
|
and #$3333
|
||||||
|
bne updateShot_maybeMushroom
|
||||||
|
; TODO - Write the code to test for a collision with fleas, spiders, scorpions or centipede segments
|
||||||
|
bra updateShot_done
|
||||||
|
|
||||||
|
updateShot_maybeMushroom anop
|
||||||
|
txa
|
||||||
|
sec
|
||||||
|
sbc #SCREEN_ADDRESS
|
||||||
|
and #$fffc
|
||||||
|
tax
|
||||||
|
lda >screenToTileOffset,x
|
||||||
|
tax
|
||||||
|
lda tileType,x
|
||||||
|
beq updateShot_done
|
||||||
|
lda #SHOT_STATE_NONE
|
||||||
|
sta shotState
|
||||||
|
jsl shootMushroom
|
||||||
|
updateShot_done anop
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
|
||||||
shotState dc i2'SHOT_STATE_NONE'
|
shotState dc i2'SHOT_STATE_NONE'
|
||||||
shotShifted dc i2'0'
|
shotShifted dc i2'0'
|
||||||
shotAddress dc i2'0'
|
shotAddress dc i2'0'
|
||||||
|
shotTileOffsetAbove dc i2'0'
|
||||||
|
shotTileOffsetBelow dc i2'0'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user