mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-01-04 23:30:06 +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
|
||||
cmp #'P'
|
||||
beq checkKey_shootSpider
|
||||
|
||||
cmp #'m'
|
||||
beq checkKey_shootMushroom
|
||||
cmp #'M'
|
||||
beq checkKey_shootMushroom
|
||||
|
||||
cmp #'g'
|
||||
beq checkKey_game
|
||||
@ -307,9 +302,6 @@ checkKey_shootSpider anop
|
||||
|
||||
checkKey_shootCentipede anop
|
||||
jmp shootRandomSegment
|
||||
|
||||
checkKey_shootMushroom anop
|
||||
jmp shootRandomMushroom
|
||||
|
||||
checkKey_quit anop
|
||||
stz shouldQuit
|
||||
|
@ -56,12 +56,17 @@ shootMushroom entry
|
||||
sbc #4
|
||||
sta tileType,x
|
||||
bne shootMushroom_done
|
||||
jmp scoreAddOne
|
||||
bra shootMushroom_empty
|
||||
|
||||
shootMushroom_poisoned anop
|
||||
bne shootMushroom_poisonedNoScore
|
||||
lda #TILE_EMPTY
|
||||
sta tileType,x
|
||||
shootMushroom_empty anop
|
||||
cpx #SPIDER_STARTING_TOP_ROW_OFFSET
|
||||
blt shootMushrom_notInfield
|
||||
dec numInfieldMushrooms
|
||||
shootMushrom_notInfield anop
|
||||
jmp scoreAddOne
|
||||
|
||||
shootMushroom_poisonedNoScore anop
|
||||
@ -72,25 +77,5 @@ shootMushroom_poisonedNoScore anop
|
||||
|
||||
shootMushroom_done anop
|
||||
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
|
||||
|
@ -43,6 +43,8 @@ playerLevelStart entry
|
||||
sta mouseX
|
||||
lda #STARTING_MOUSE_Y
|
||||
sta mouseY
|
||||
lda #1
|
||||
sta mouseDown
|
||||
dec numLives
|
||||
lda #P1_LIVES_OFFSET
|
||||
sec
|
||||
@ -223,16 +225,24 @@ updatePlayer_doneY anop
|
||||
|
||||
; The X and Y register also has a bit in each which indicates whether a
|
||||
; mouse button is down or not.
|
||||
|
||||
txa
|
||||
and #$0080
|
||||
beq updatePlayer_mouseDown
|
||||
tya
|
||||
and #$0080
|
||||
bne updatePlayer_skipDeltas
|
||||
beq updatePlayer_mouseDown
|
||||
lda #1
|
||||
sta mouseDown
|
||||
bra updatePlayer_skipDeltas
|
||||
updatePlayer_mouseDown anop
|
||||
jsl maybeShoot
|
||||
stz mouseDown
|
||||
|
||||
updatePlayer_skipDeltas anop
|
||||
lda mouseDown
|
||||
bne updatePlayer_notShooting
|
||||
jsl maybeShoot
|
||||
updatePlayer_notShooting anop
|
||||
lda mouseY
|
||||
asl a
|
||||
tay
|
||||
@ -326,6 +336,7 @@ updatePlayer_done anop
|
||||
|
||||
playerFrameCount dc i2'0'
|
||||
playerExplosionOffset dc i2'0'
|
||||
mouseDown dc i2'0'
|
||||
|
||||
|
||||
SHIP_EXPLOSION_LAST_OFFSET equ 7*4
|
||||
|
@ -72,13 +72,100 @@ updateShot_shifted anop
|
||||
sta tileDirty,x
|
||||
jmp >drawHalfShotShift
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
shotState dc i2'SHOT_STATE_NONE'
|
||||
shotShifted dc i2'0'
|
||||
shotAddress dc i2'0'
|
||||
shotTileOffsetAbove dc i2'0'
|
||||
shotTileOffsetBelow dc i2'0'
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user