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
    You might want to ask questions of this sort on http://gamedev.stackexchange.com/2015-06-24

1 Answers 1

1

I suggest following approach: take your X coordinate, multiply it by $3$ and then perform a Euclidean division by $10$. (Since $\frac{3}{10}=\frac{150}{500}$ and since you only want enemies within range $500$.) Apply the same procedure to the Y coordinate.

The result will be the transformed coordinates for the minimap.