Change shot sprite to be up against left edge.
Also fix a bug where some entries of the sprite buffer weren't being cleared.
This commit is contained in:
parent
6eab6050e8
commit
eb7757a8b3
17
pewpew.asm
17
pewpew.asm
@ -464,13 +464,14 @@ MaybeShoot:
|
|||||||
beq MaybeShootDone
|
beq MaybeShootDone
|
||||||
jmp -
|
jmp -
|
||||||
+
|
+
|
||||||
; Enable shot; set its position to player position.
|
; Enable shot; set its position based on player position.
|
||||||
; TODO(mcmillen): it might be easier/faster to keep N arrays: one for each
|
; TODO(mcmillen): it might be easier/faster to keep N arrays: one for each
|
||||||
; field of shot (shotSpriteArray, shotXArray, shotYArray, ...)
|
; field of shot (shotSpriteArray, shotXArray, shotYArray, ...)
|
||||||
lda #8 ; Sprite number.
|
lda #8 ; Sprite number.
|
||||||
sta 0, X
|
sta 0, X
|
||||||
|
|
||||||
lda playerX
|
lda playerX
|
||||||
|
adc #20
|
||||||
sta 1, X
|
sta 1, X
|
||||||
|
|
||||||
lda playerY
|
lda playerY
|
||||||
@ -484,12 +485,12 @@ MaybeShoot:
|
|||||||
lda nextShotState
|
lda nextShotState
|
||||||
cmp #1
|
cmp #1
|
||||||
beq +
|
beq +
|
||||||
lda #3
|
lda #2
|
||||||
sta 4, X
|
sta 4, X
|
||||||
inc nextShotState
|
inc nextShotState
|
||||||
jmp ++
|
jmp ++
|
||||||
+
|
+
|
||||||
lda #-3
|
lda #-2
|
||||||
sta 4, X
|
sta 4, X
|
||||||
dec nextShotState
|
dec nextShotState
|
||||||
++
|
++
|
||||||
@ -660,6 +661,16 @@ UpdateSprites:
|
|||||||
cpy #(shotArrayLength * shotSize)
|
cpy #(shotArrayLength * shotSize)
|
||||||
bne -
|
bne -
|
||||||
|
|
||||||
|
; Now clear out the unused entries in the sprite table.
|
||||||
|
-
|
||||||
|
cpx #spriteTable1Size
|
||||||
|
beq +
|
||||||
|
lda #1
|
||||||
|
sta spriteTableStart, X
|
||||||
|
.rept 4
|
||||||
|
inx
|
||||||
|
.endr
|
||||||
|
+
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
BIN
sprites32.pcx
BIN
sprites32.pcx
Binary file not shown.
Loading…
Reference in New Issue
Block a user