求个.游戏地图坐标转小地图坐标公式。
假设当前人物位地图 坐标 2900,1000 = 2900 / 10,1000/ 10 = 290,100
再假当前人物位地图 坐标 5,2 = 5 /10, 2/ 10 = 0.5,0.2
坐标不应该是浮点数 这显然 不合理。。。求大家 给个 可以用的公式 ...谢谢
阿神2017-04-17 14:32:37
Can't we just round it up...int(5/10)==0,int(2/10)==0
, so (5,2) on the big map corresponds to (0,0) on the small map, like this...?
Uh-huh, okay, because I am used to C++ array subscripts starting from 0, so the default coordinate values are all non-negative. If the coordinates of the subject are positive numbers, then use the ceil
function to round them up.
Why does it feel weird? Is it because I didn’t understand the purpose of the question?