diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-03-16 22:06:17 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-03-16 22:07:56 +0100 |
| commit | b701e5fc34351a727a217542c60f22beda7681e7 (patch) | |
| tree | 29fa9b28b99233c744da2520d2c6cf7db5a6ba39 | |
| parent | 3b238d047207441a9ed4c3ae503f323e04b62bef (diff) | |
| download | jetpac.nes-b701e5fc34351a727a217542c60f22beda7681e7.tar.gz jetpac.nes-b701e5fc34351a727a217542c60f22beda7681e7.zip | |
Improve the accuracy of the dropping zone
We were abusing on tile collision for this, and it wasn't
exact. Not only that, but if the player was fast enough, sometimes the
item wouldn't drop as the accelaration would pass through that
zone. Avoid that by simply using regular screen coordinates, which
aren't too hard to check in this case.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
| -rw-r--r-- | .nasm/segments.txt | 2 | ||||
| -rw-r--r-- | src/items.s | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/.nasm/segments.txt b/.nasm/segments.txt index 7d74792..7ba06cb 100644 --- a/.nasm/segments.txt +++ b/.nasm/segments.txt @@ -1,4 +1,4 @@ - HEADER: 16/16 (100%) -- ROM0: 8030/32762 (24.51%) +- ROM0: 8034/32762 (24.52%) - ROMV: 6/6 (100%) - ROM2: 8192/8192 (100%) diff --git a/src/items.s b/src/items.s index e1ebed6..7d22828 100644 --- a/src/items.s +++ b/src/items.s @@ -61,12 +61,8 @@ ;; Number of shuttle parts (or fuel tanks) that have been collected so far. zp_collected = $CB - ;; Coordinate where the dropping of items takes place. This comes in two - ;; versions, as the "collision" is done in the tile coordinates so to give - ;; some leeway to the player; but the dropping itself has to fall from the - ;; exact screen coordinates or otherwise the dropping would feel weird.z + ;; Coordinate where the dropping of items takes place. DROPPING_SCREEN_X = $A8 - DROPPING_TILE_X = $15 ;; Y screen coordinates in order for various parts to be considered as ;; "collected". @@ -390,10 +386,12 @@ sta Items::zp_pool_base + 2, x ;; Are we at the zone where we must drop items? - ldy Globals::zp_arg1 - dey - cpy #DROPPING_TILE_X - beq @drop + cmp #DROPPING_SCREEN_X - 8 + bcs @may_drop + jmp @next + @may_drop: + cmp #DROPPING_SCREEN_X + 8 + bcc @drop jmp @next @drop: |
