mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-02-06 21:30:21 +00:00
Add support for shooting fleas. When a flea is shot once, it accelerates its drop to the bottom. On the second shot, it explodes.
This commit is contained in:
parent
8d2fbda733
commit
b813253c83
@ -7,7 +7,7 @@
|
|||||||
<key>Binary.xcscheme_^#shared#^_</key>
|
<key>Binary.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>3</integer>
|
<integer>1</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>BuGS.xcscheme_^#shared#^_</key>
|
<key>BuGS.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
@ -17,12 +17,12 @@
|
|||||||
<key>DiskImage.xcscheme_^#shared#^_</key>
|
<key>DiskImage.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>1</integer>
|
<integer>2</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>doNotBuild.xcscheme_^#shared#^_</key>
|
<key>doNotBuild.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>2</integer>
|
<integer>3</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
11
BuGS/game.s
11
BuGS/game.s
@ -33,8 +33,8 @@ gameLoop anop
|
|||||||
jsl drawDirtyNonGameTiles
|
jsl drawDirtyNonGameTiles
|
||||||
|
|
||||||
jsl updateFlea
|
jsl updateFlea
|
||||||
|
|
||||||
jsl checkKeyboard
|
jsl checkKeyboard
|
||||||
|
|
||||||
jsl waitForVbl
|
jsl waitForVbl
|
||||||
|
|
||||||
lda shouldQuit
|
lda shouldQuit
|
||||||
@ -654,6 +654,11 @@ checkKey_loop2 anop
|
|||||||
cmp #'F'
|
cmp #'F'
|
||||||
beq checkKey_addFlea
|
beq checkKey_addFlea
|
||||||
|
|
||||||
|
cmp #'s'
|
||||||
|
beq checkKey_shootFlea
|
||||||
|
cmp #'S'
|
||||||
|
beq checkKey_shootFlea
|
||||||
|
|
||||||
lda colourPalette
|
lda colourPalette
|
||||||
inc a
|
inc a
|
||||||
cmp #$000e
|
cmp #$000e
|
||||||
@ -668,6 +673,10 @@ checkKey_addFlea anop
|
|||||||
jsl addFlea
|
jsl addFlea
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
checkKey_shootFlea anop
|
||||||
|
jsl shootFlea
|
||||||
|
rtl
|
||||||
|
|
||||||
checkKey_quit anop
|
checkKey_quit anop
|
||||||
stz shouldQuit
|
stz shouldQuit
|
||||||
|
|
||||||
|
@ -80,12 +80,22 @@ drawFlea_done anop
|
|||||||
|
|
||||||
|
|
||||||
fleaJump entry
|
fleaJump entry
|
||||||
|
cmp #fleaState_falling
|
||||||
|
bne fleaJump_explosion
|
||||||
|
|
||||||
lda fleaJumpTable,x
|
lda fleaJumpTable,x
|
||||||
sta jumpInst+1
|
sta jumpInst+1
|
||||||
|
|
||||||
lda fleaJumpTable+2,x
|
lda fleaJumpTable+2,x
|
||||||
sta jumpInst+3
|
sta jumpInst+3
|
||||||
|
bra jumpInst
|
||||||
|
|
||||||
|
fleaJump_explosion anop
|
||||||
|
lda explosionJumpTable,x
|
||||||
|
sta jumpInst+1
|
||||||
|
|
||||||
|
lda explosionJumpTable+2,x
|
||||||
|
sta jumpInst+3
|
||||||
jumpInst jmp >flea1
|
jumpInst jmp >flea1
|
||||||
nop
|
nop
|
||||||
|
|
||||||
@ -93,9 +103,25 @@ jumpInst jmp >flea1
|
|||||||
updateFlea entry
|
updateFlea entry
|
||||||
lda fleaState
|
lda fleaState
|
||||||
bne updateFlea_cont
|
bne updateFlea_cont
|
||||||
rtl
|
|
||||||
|
|
||||||
updateFlea_cont anop
|
updateFlea_cont anop
|
||||||
|
cmp #fleaState_falling
|
||||||
|
beq updateFlea_cont2
|
||||||
|
|
||||||
|
; Handle explosion
|
||||||
|
lda fleaSprite
|
||||||
|
clc
|
||||||
|
adc #$4
|
||||||
|
sta fleaSprite
|
||||||
|
cmp #$15
|
||||||
|
bge updateFlea_explosionDone
|
||||||
|
rtl
|
||||||
|
|
||||||
|
updateFlea_explosionDone anop
|
||||||
|
stz fleaState
|
||||||
|
rtl
|
||||||
|
|
||||||
|
updateFlea_cont2 anop
|
||||||
lda fleaHeightInTile
|
lda fleaHeightInTile
|
||||||
beq updateFlea_nextTile
|
beq updateFlea_nextTile
|
||||||
dec a
|
dec a
|
||||||
@ -104,11 +130,6 @@ updateFlea_cont anop
|
|||||||
bra updateFlea_nextAction
|
bra updateFlea_nextAction
|
||||||
|
|
||||||
updateFlea_bottomOfTile anop
|
updateFlea_bottomOfTile anop
|
||||||
lda fleaTileOffsets
|
|
||||||
sta fleaTileOffsets+4
|
|
||||||
lda fleaTileOffsets+2
|
|
||||||
sta fleaTileOffsets+6
|
|
||||||
|
|
||||||
lda fleaSpriteCounter
|
lda fleaSpriteCounter
|
||||||
eor #$1
|
eor #$1
|
||||||
sta fleaSpriteCounter
|
sta fleaSpriteCounter
|
||||||
@ -127,16 +148,18 @@ updateFlea_resetSprite anop
|
|||||||
bra updateFlea_nextAction
|
bra updateFlea_nextAction
|
||||||
|
|
||||||
updateFlea_nextTile anop
|
updateFlea_nextTile anop
|
||||||
lda #$3
|
lda fleaUpdatePerTile
|
||||||
sta fleaHeightInTile
|
sta fleaHeightInTile
|
||||||
|
|
||||||
ldx fleaTileOffsets
|
ldx fleaTileOffsets
|
||||||
|
stx fleaTileOffsets+4
|
||||||
lda tiles+8,x
|
lda tiles+8,x
|
||||||
cmp #$ffff
|
cmp #$ffff
|
||||||
beq updateFlea_bottom
|
beq updateFlea_bottom
|
||||||
sta fleaTileOffsets
|
sta fleaTileOffsets
|
||||||
|
|
||||||
ldx fleaTileOffsets+2
|
ldx fleaTileOffsets+2
|
||||||
|
stx fleaTileOffsets+6
|
||||||
lda tiles+8,x
|
lda tiles+8,x
|
||||||
sta fleaTileOffsets+2
|
sta fleaTileOffsets+2
|
||||||
|
|
||||||
@ -159,7 +182,7 @@ updateFlea_bottom anop
|
|||||||
updateFlea_nextAction anop
|
updateFlea_nextAction anop
|
||||||
lda fleaScreenOffset
|
lda fleaScreenOffset
|
||||||
clc
|
clc
|
||||||
adc #$140
|
adc fleaSpeed
|
||||||
sta fleaScreenOffset
|
sta fleaScreenOffset
|
||||||
|
|
||||||
updateFlea_done anop
|
updateFlea_done anop
|
||||||
@ -174,9 +197,14 @@ addFlea entry
|
|||||||
sta fleaState
|
sta fleaState
|
||||||
|
|
||||||
lda #$3
|
lda #$3
|
||||||
|
sta fleaUpdatePerTile
|
||||||
sta fleaHeightInTile
|
sta fleaHeightInTile
|
||||||
|
|
||||||
|
lda #$140
|
||||||
|
sta fleaSpeed
|
||||||
|
|
||||||
stz fleaSpriteCounter
|
stz fleaSpriteCounter
|
||||||
|
stz fleaSprite
|
||||||
|
|
||||||
jsl rand25
|
jsl rand25
|
||||||
asl a
|
asl a
|
||||||
@ -199,6 +227,41 @@ addFlea entry
|
|||||||
addFlea_done anop
|
addFlea_done anop
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
shootFlea entry
|
||||||
|
lda fleaState
|
||||||
|
cmp #$1
|
||||||
|
bne shootFlea_done
|
||||||
|
|
||||||
|
lda fleaSpeed
|
||||||
|
cmp #$140
|
||||||
|
beq shootFlea_faster
|
||||||
|
|
||||||
|
lda #$2
|
||||||
|
sta fleaState
|
||||||
|
|
||||||
|
stz fleaSprite
|
||||||
|
|
||||||
|
rtl
|
||||||
|
|
||||||
|
shootFlea_faster anop
|
||||||
|
asl a
|
||||||
|
sta fleaSpeed
|
||||||
|
|
||||||
|
lda #$1
|
||||||
|
sta fleaUpdatePerTile
|
||||||
|
|
||||||
|
lda fleaHeightInTile
|
||||||
|
lsr a
|
||||||
|
sta fleaHeightInTile
|
||||||
|
bcc shootFlea_done
|
||||||
|
|
||||||
|
lda fleaScreenOffset
|
||||||
|
sbc #$a0
|
||||||
|
sta fleaScreenOffset
|
||||||
|
|
||||||
|
shootFlea_done anop
|
||||||
|
rtl
|
||||||
|
|
||||||
|
|
||||||
fleaState dc i2'fleaState_none'
|
fleaState dc i2'fleaState_none'
|
||||||
fleaScreenOffset dc i2'0'
|
fleaScreenOffset dc i2'0'
|
||||||
@ -214,5 +277,15 @@ fleaJumpTable dc i4'flea1'
|
|||||||
dc i4'flea2'
|
dc i4'flea2'
|
||||||
dc i4'flea3'
|
dc i4'flea3'
|
||||||
dc i4'flea4'
|
dc i4'flea4'
|
||||||
|
|
||||||
|
fleaSpeed dc i2'0'
|
||||||
|
fleaUpdatePerTile dc i2'0'
|
||||||
|
|
||||||
|
explosionJumpTable dc i4'explosion1'
|
||||||
|
dc i4'explosion2'
|
||||||
|
dc i4'explosion3'
|
||||||
|
dc i4'explosion4'
|
||||||
|
dc i4'explosion5'
|
||||||
|
dc i4'explosion6'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user