search

Home  >  Q&A  >  body text

c++ - 求个.游戏地图坐标转小地图坐标公式。

  1. 求个.游戏地图坐标转小地图坐标公式。

  2. 假设当前人物位地图 坐标 2900,1000 = 2900 / 10,1000/ 10 = 290,100

  3. 再假当前人物位地图 坐标 5,2 = 5 /10, 2/ 10 = 0.5,0.2

  4. 坐标不应该是浮点数 这显然 不合理。。。求大家 给个 可以用的公式 ...谢谢

PHPzPHPz2826 days ago769

reply all(1)I'll reply

  • 阿神

    阿神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?

    reply
    0
  • Cancelreply