Made sprite.lua's tileCheck function a lot cleaner.

Also made more things local.