From eb7757a8b3687395189692cdd509dd8d71ff444f Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Sun, 31 May 2015 15:05:37 -0400 Subject: [PATCH] Change shot sprite to be up against left edge. Also fix a bug where some entries of the sprite buffer weren't being cleared. --- pewpew.asm | 17 ++++++++++++++--- sprites32.pcx | Bin 2205 -> 2205 bytes 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pewpew.asm b/pewpew.asm index 9f9b8f4..c32e98b 100644 --- a/pewpew.asm +++ b/pewpew.asm @@ -464,13 +464,14 @@ MaybeShoot: beq MaybeShootDone 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 ; field of shot (shotSpriteArray, shotXArray, shotYArray, ...) lda #8 ; Sprite number. sta 0, X lda playerX + adc #20 sta 1, X lda playerY @@ -484,12 +485,12 @@ MaybeShoot: lda nextShotState cmp #1 beq + - lda #3 + lda #2 sta 4, X inc nextShotState jmp ++ + - lda #-3 + lda #-2 sta 4, X dec nextShotState ++ @@ -660,6 +661,16 @@ UpdateSprites: cpy #(shotArrayLength * shotSize) bne - + ; Now clear out the unused entries in the sprite table. +- + cpx #spriteTable1Size + beq + + lda #1 + sta spriteTableStart, X + .rept 4 + inx + .endr ++ rts diff --git a/sprites32.pcx b/sprites32.pcx index 31e3af64569e10141e186f430325b315bd40ee76..9eea6970bb72d90ae178da43270f9cdc501f8a39 100644 GIT binary patch delta 100 zcmbO$I9G7O3)b@thuH2;W@J@lKh3~)h>PvcPvy