Integers! Use them!

don’t use floats or doubles or actionscript’s Numbers for the positions of things. Use integers. Trust me. There’s basically no reason to use questionably accurate values when it takes the slightest touchiest bit more code to manage beautiful, discrete integer locations.

If you must, keep a decimal buffer value (like this: “I’m standing at x=10, y=15, but my subx offset is something like -0.1”) for use with decimal velocities, and clear it when you come to a halt.

If I’m going way over your head, that’s okay. Wait for my next blog post :x I’ll try to do another LMSD!


About Droqen

Droqen is a game designer/developer/creator/etc. from Toronto, Ontario. View all posts by Droqen

One response to “Integers! Use them!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: