It is currently Sun Aug 18, 2019 9:00 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jul 11, 2019 5:12 am 
Offline

Joined: Thu Jul 11, 2019 5:06 am
Posts: 1
I have been trying to get a sprite position on the tile grid, but it isnt seeming to work. Can someone please help? I'll attach my code. So far I've only tried columns.


Attachments:
File comment: my code
code.asm [7.75 KiB]
Downloaded 25 times
Top
 Profile  
 
PostPosted: Thu Jul 11, 2019 9:15 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 4199
Simple formulas here...
(Sprite X - Camera X + 4) / 8
(Sprite Y - Camera Y + 4) / 8

Adding 4 is for rounding to nearest.
To divide by 8, shift right 3 times.
If you are talking about full 16x16 metatiles, use 16 instead of 8, and 8 instead of 4.

If you have no scrolling or no camera, your camera is zeroes.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group