重新定位小地图位置
我有一个我绘制的小地图,图像大小为 300x300,我正在显示玩家和玩家范围(500)内的敌人。
他们的地图坐标可以是从 (-1000, -1000) 到 (1000, 1000) 的任何值,我想将玩家设置到中心 (150, 150),然后在我的列表中重新定位敌人(有一个点)小地图。 我在思考如何显示敌人时遇到了一些问题。 “系数”是 6,666 (1000/150),我可以用这个系数除敌人的位置吗?
应该和球员的位置有关吗?假设它的位置为 (-1500, 39),敌人位于 (-1000, 39),在他的左侧,我如何将其转换为 X 和 Y 范围为 0-300 的小地图?
Ive got a minimap that i draw on, the image is 300x300 in size and i'm displaying the player and enemies that are within range (500) of the player.
they have map coords that can be anything from (-1000, -1000) to (1000, 1000), i want to set the player to the center (150, 150) and then reposition enemies in my List (has a Point) within the minimap.
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?
Should it be relative to players position? Lets say its (-1500, 39) and a enemy is at (-1000, 39), on his left hand side, how do i transform this to minimap where range for X and Y is 0-300?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该点应相对于您的玩家定位,即位于小地图的中心。因此,在你的小地图上,每个敌人都会处于一个位置(系数为 6.6666)
请注意,如果你只显示范围 500 内的敌人,那么它们的位置(x 和 y)将在 75/225 之间,即不是整个可能的小地图。这是因为该因子基于整个位置范围(要达到 0,距离必须为 1000)
Guillaume
The point should be positionned relative to your player, that will be at the center of your minimap. thus, on your minimap, each ennemy will be at a position (with a factor of 6.6666)
Please note that if you only display ennemies that are within range 500, then they will have a position (x and y) between 75/225, ie not the whole possible minimap. This is because the factor is based on the whole position range (to be at 0, you have to be at a distance of 1000)
Guillaume