Add multiple enemy shots.
This commit is contained in:
parent
4bf0033962
commit
2bb1bc161d
@ -13,7 +13,7 @@
|
||||
; 0030-003F: (x, y) velocities of each of the 8 possible shot states.
|
||||
; 0040-009F: {sprite, x, y, x-velocity, y-velocity, unused} per player shot.
|
||||
; If sprite is 0, the shot is disabled.
|
||||
; 00A0-00FF: As above, for enemy shots.
|
||||
; 00A0-015F: As above, for enemy shots.
|
||||
; [gap]
|
||||
; Sprite table buffers -- copied each frame to OAM during VBlank, using DMA.
|
||||
; 1000-11FF: table 1 (4 bytes each: x/y coord, tile #, flip/priority/palette)
|
||||
@ -34,7 +34,7 @@
|
||||
.define playerShotArray $40
|
||||
.define playerShotArrayLength 16
|
||||
.define enemyShotArray $A0
|
||||
.define enemyShotArrayLength 16
|
||||
.define enemyShotArrayLength 32
|
||||
.define shotSize 6
|
||||
|
||||
.define numSprites 128
|
||||
|
27
pewpew.asm
27
pewpew.asm
@ -488,22 +488,35 @@ UpdateShotCooldown:
|
||||
|
||||
SpawnEnemyShots:
|
||||
lda vBlankCounter
|
||||
bit #%00111111
|
||||
bit #%00001111
|
||||
beq +
|
||||
rts
|
||||
+
|
||||
ldy #0
|
||||
-
|
||||
lda enemyShotArray, Y
|
||||
cmp #0
|
||||
beq +
|
||||
.rept 6
|
||||
iny
|
||||
.endr
|
||||
cpy #(enemyShotArrayLength * shotSize)
|
||||
bne -
|
||||
rts ; Too many shots; bail.
|
||||
|
||||
+
|
||||
lda #12 ; Sprite number.
|
||||
sta enemyShotArray
|
||||
sta enemyShotArray, Y
|
||||
|
||||
lda #254
|
||||
sta enemyShotArray + 1 ; x.
|
||||
sta enemyShotArray + 1, Y ; x.
|
||||
|
||||
lda #((224 - 32) / 2)
|
||||
and #%01111111
|
||||
sta enemyShotArray + 2 ; y.
|
||||
sta enemyShotArray + 2, Y ; y.
|
||||
|
||||
lda #-6
|
||||
sta enemyShotArray + 3 ; x-velocity.
|
||||
lda #-4
|
||||
sta enemyShotArray + 3, Y ; x-velocity.
|
||||
|
||||
GetRandomByte
|
||||
and #%00000111 ; [0, 7]
|
||||
@ -513,7 +526,7 @@ SpawnEnemyShots:
|
||||
bne +
|
||||
lda #0 ; [-3, 3] with 2x chance of zero.
|
||||
+
|
||||
sta enemyShotArray + 4 ; y-velocity.
|
||||
sta enemyShotArray + 4, Y ; y-velocity.
|
||||
rts
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user