Introduce intermediate variables for tile-local coordinates, leaving original x and y alone to correct collision calculation.
Remove only-used-once intermediate variables and const some stuff.