Posted: Sun Oct 04, 2020 6:03 am Post subject: Game coordinate as a Byte convert it to Float?
Im working on Age of Empires 2.
The game has a grid coordinate system.
The coordinates are represented as bytes. So for example, your unit is located at X 10, and Y 10, it means its positioned in the center of the square X 10, and square Y 10.
But sometimes the units are not exactly in the middle of that square, but a bit in between, or in the line side of a square.
So it is also represented as a Float. Meaning it is 10.5, 10.5 . As you can see it is .5 , so it means its not in the center its the center + .5
What im trying to do, is to make the units go to the 0.5 place, and not the 10. But im failing to change the Byte to a Float.
So for example, the float value that corresponds to 1 hexadecimal coordinate, is 1.401298464E-45.
Therefore, im trying to divide this float number in 2. So i can get he value of what would be half a square in the coordinates?
But im failing. Can you help me or suggest me something to overcome this challenge?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum