Advertisement

Need help with tranlating world cords to player cords

Started by April 07, 2017 11:57 PM
12 comments, last by Alberth 7 years, 8 months ago
Since your code has blocks as 32x32 objects, yes, they probably do go by 32.

This sort of conversion is usually done with a combination of multiplication, division, and modulo division, based on the conversion factors you use in your game. x/xsize and y/ysize will go one way, x*xsize and y*ysize will go the other.



So 0,0 is = 0,0 in block corrds and 0,1 is = 0,32 and it goes from there by 32 so?

Yes 0,0 means 0,32 and goe s up 32 from there, in the block map. So I'm thinking if I have a 2d array representing the world map in main. I can update the player with the 2d array,so 0,0 would move the player to block 0,32, and so on from there
Advertisement

Since your code has blocks as 32x32 objects, yes, they probably do go by 32.
This sort of conversion is usually done with a combination of multiplication, division, and modulo division, based on the conversion factors you use in your game. x/xsize and y/ysize will go one way, x*xsize and y*ysize will go the other.

Ok thanks, but I'm trying to build the game from the ground up. I at lease want ro get a programming job. So I'm thinking that as my first poke at a real project, the exprience will show my drive to get things done.
So 0,0 is = 0,0 in block corrds and 0,1 is = 0,32 and it goes from there by 32 so?

Seems like a pattern to me. Next step where is integer coordinate (a,b) in world coordinates?

If that works, try doing it the other way around. Find a pattern with some examples, then generalize to the general case.

This topic is closed to new replies.

Advertisement