aboutsummaryrefslogtreecommitdiff
path: root/src/items.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-16 22:06:17 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-16 22:07:56 +0100
commitb701e5fc34351a727a217542c60f22beda7681e7 (patch)
tree29fa9b28b99233c744da2520d2c6cf7db5a6ba39 /src/items.s
parent3b238d047207441a9ed4c3ae503f323e04b62bef (diff)
downloadjetpac.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>
Diffstat (limited to 'src/items.s')
-rw-r--r--src/items.s16
1 files changed, 7 insertions, 9 deletions
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: