Tweaks to increase difficulty.

This commit is contained in:
Colin McMillen 2015-06-07 14:47:11 -04:00
parent 12a51ea9ec
commit d12dcd32fb
2 changed files with 31 additions and 6 deletions

View File

@ -45,7 +45,7 @@
.define enemyShotArrayLength 32 .define enemyShotArrayLength 32
.define shotSize 6 .define shotSize 6
.define enemyShipArray $160 .define enemyShipArray $160
.define enemyShipArrayLength 4 .define enemyShipArrayLength 8
.define enemyShipSize 6 .define enemyShipSize 6

View File

@ -244,7 +244,7 @@ InitWorld:
sta playerX sta playerX
lda #((224 - 32) / 2) lda #((224 - 32) / 2)
sta playerY sta playerY
lda #16 lda #10
sta playerHealth sta playerHealth
; (x-velocity, y-velocity) of 4 different player shot patterns. ; (x-velocity, y-velocity) of 4 different player shot patterns.
@ -529,9 +529,9 @@ SpawnEnemyShips:
rts rts
+ +
GetRandomByte GetRandomByte
and #%00111111 and #%00011111
clc clc
adc #32 adc #16
sta enemyShipSpawnCooldown sta enemyShipSpawnCooldown
; Find an empty spot in the array. ; Find an empty spot in the array.
@ -562,6 +562,12 @@ SpawnEnemyShips:
lda #0 lda #0
sta enemyShipArray + 3, Y ; move AI type. sta enemyShipArray + 3, Y ; move AI type.
GetRandomByte
and #%00000011
cmp #1
beq +
lda #0
+
sta enemyShipArray + 4, Y ; shoot AI type. sta enemyShipArray + 4, Y ; shoot AI type.
lda #12 lda #12
@ -584,7 +590,7 @@ UpdateEnemyShips:
; TODO: implement different movement based on AI-type. ; TODO: implement different movement based on AI-type.
lda enemyShipArray + 1, Y ; x lda enemyShipArray + 1, Y ; x
clc clc
adc #-2 ; x-velocity. adc #-3 ; x-velocity.
bcs + bcs +
lda #0 lda #0
sta enemyShipArray, Y ; reap it. sta enemyShipArray, Y ; reap it.
@ -608,7 +614,8 @@ UpdateEnemyShips:
sta $02 ; Enemy ship x. sta $02 ; Enemy ship x.
lda enemyShipArray + 2, Y lda enemyShipArray + 2, Y
sta $03 ; Enemy ship y. sta $03 ; Enemy ship y.
lda enemyShipArray + 4, Y
sta $04 ; Enemy ship shoot-AI type.
phy phy
ldy $00 ldy $00
jsr SpawnEnemyShot jsr SpawnEnemyShot
@ -630,6 +637,7 @@ UpdateEnemyShips:
; Y: index into enemyShotArray (bytes). ; Y: index into enemyShotArray (bytes).
; $02: enemy ship x-position. ; $02: enemy ship x-position.
; $03: enemy ship y-position. ; $03: enemy ship y-position.
; $04: enemy ship shoot-AI type.
; ;
; Modifies: ; Modifies:
; A. ; A.
@ -667,9 +675,26 @@ SpawnEnemyShot:
lda #-6 lda #-6
sta enemyShotArray + 3, Y ; x-velocity. sta enemyShotArray + 3, Y ; x-velocity.
; Choose velocities based on shoot AI type.
lda $04
cmp #1
beq +
; Normal shot.
lda #0 lda #0
sta enemyShotArray + 4, Y ; y-velocity. sta enemyShotArray + 4, Y ; y-velocity.
rts
; Shot aimed toward player.
+
lda playerY
cmp $03
bcs +
lda #-2
sta enemyShotArray + 4, Y ; y-velocity.
rts
+
lda #2
sta enemyShotArray + 4, Y ; y-velocity.
rts rts