blog.raydenuni.com

Philosophical Ranting of an Engineer

Programming Tip of the Day

April 5th, 2007

And now for the Programming Tip of the Day. The first piece of code is not equal to the second piece of code. Can you spot the difference? It took me about a half hour to realize that this was the reason my units were jumping around and not moving smoothly.

Good

(int)((myUnit.PosX - myCamera.TileX) * Map.TileWidth)

Bad

((int)(myUnit.PosX - myCamera.TileX) * Map.TileWidth)


1 Response to “Programming Tip of the Day”

  1. Lem Says:
    I found it in ten seconds! I'm a natural born coder... :) And I'm awesome.

Sorry, comments are closed for this article.