0
$\begingroup$

I'm doing some game development and have the following problem:

I've got a mini map that I draw on, the image is $300\times 300$ in size and I'm displaying the player and enemies that are within a range of ($500$) of the player.

They have map coordinates that can be anything from $(-1000, -1000)$ to $(1000, 1000)$, I've set the player to the center $(150, 150)$ and then I want reposition enemies in my list of enemies (has a position) within the mini map.

What I'm having some problems wrapping my head around how to do display enemies. The "factor" is $6,666$ $(1000/150)$, can I just divide enemy position by this factor? $X$ and $Y$?

  • 0
    Yeah, that should work, but since you'll obtain floating point numbers that way, you might want to use a better technique. For instance euclidean division if you want to avoid using floating point numbers altogether, or at the very least use a floor/ceiling function to obtain integers.2011-04-28
  • 0
    You might want to ask questions of this sort on http://gamedev.stackexchange.com/2015-06-24

1 Answers 1