Page 2 of 2

Re: Lets Talk 2D Platformers!

Posted: Sat Jan 04, 2014 6:21 pm
by micha
Ekamu wrote:Personally for anything tile-based I avoid using dt or I math.floor the final number to keep things tight. Pixels also behave very strangely in between floating point positions.
Using floating point numbers for coordinates is not problem, if you separate the game logic from the drawing. I highly recommend using dt.

In my project, I have logic coordinates, with a scale where one unit means "length of 1 tile". Internally all calculations are based on these coordinates. Then in the drawing function, the coordinates are multiplied by the tile size and rounded with math.floor to get the screen coordinates. If you restrict the coordinates to being integers, you lose precision (I have to admit, that it might not be noticeable).