From 638dfdca6e773d4b1ec573606cac90bdb1778667 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 15 May 2025 22:06:00 +0200 Subject: Initialize enemies at a random Y coordinate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- src/enemies.s | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/enemies.s') diff --git a/src/enemies.s b/src/enemies.s index ab67ccd..377a9a5 100644 --- a/src/enemies.s +++ b/src/enemies.s @@ -25,7 +25,9 @@ sta zp_enemies_pool_base, x inx - lda #$80 ; TODO: random + stx Globals::zp_tmp0 + jsr Prng::random_valid_y_coordinate + ldx Globals::zp_tmp0 sta zp_enemies_pool_base, x inx -- cgit v1.2.3