aboutsummaryrefslogtreecommitdiff
path: root/src/vectors.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-05-15 22:06:00 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-05-16 07:55:56 +0200
commit638dfdca6e773d4b1ec573606cac90bdb1778667 (patch)
tree73f60ee0aca0c0585f0fd8063ccc7bb31881e543 /src/vectors.s
parent72894d68c4fbd8c2b843afa70244dee3b6241414 (diff)
downloadjetpac.nes-638dfdca6e773d4b1ec573606cac90bdb1778667.tar.gz
jetpac.nes-638dfdca6e773d4b1ec573606cac90bdb1778667.zip
Initialize enemies at a random Y coordinate
The randomness comes from a pre-computed table of "random" numbers. This is of course the most simple technique you can come across a code base for the NES/Famicom, but for the purposes of this game is good enough and (most importantly) fast. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'src/vectors.s')
-rw-r--r--src/vectors.s6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vectors.s b/src/vectors.s
index 75de30a..77ce0bc 100644
--- a/src/vectors.s
+++ b/src/vectors.s
@@ -104,6 +104,12 @@
.endif
;; TODO: some actions here will depend on the status of the game...
+ lda Globals::zp_flags
+ and #%00000001
+ bne @ppu_registers
+
+ ;; Increase the random seed.
+ inc Prng::zp_rand
;; Decrease title timer.
lda Title::zp_title_timer