So I noticed a small bug with this and am hoping you guys can help me simplify. I've noticed that in a few cases, the tile to change isn't normalized to my collision grid, but after tinkering, I want it to be.
So my get-tile-collision routine looks generally like:
Code:
LDA tileY ;; a y value to check
AND #%11110000
STA temp
LDA tileX ;; an x value to check
LSR a
LSR a
LSR a
LSR a
ORA temp
;;; now we have the *collision tile* number in A
What I'd like to do is snag the tile address that corresponds to the top left of this metatile.
it's similar to what i was doing, but I think I'd rather extract it with the same constraints as collision data.
What would be the best, most direct way to get the 16 bit tile address for the top left corner of what corresponds with the chosen gridded collision tile?
Thanks!
**** EDIT**** Nevermind...I found my issue.
For anyone who is interested:
Code:
LDA tileX
LSR a
LSR a
LSR a
LSR a
LSR a ;; these two
ASL a ;; normalize
STA temp
LDA tileY
LSR a
LSR a
LSR a
LSR a
LSR a
LSR a
ORA #$20 ;; dividing y by 64 and or-ing $$20 gives us 20,21,22,or 23 for hi address
STA hiAdd
LDA tileY
ASL a
ASL a
AND #%11000000
ORA temp
STA loAdd
Seems to work fine