Beware!
This code works, but what I guessis, that he wants is just the
entities be displayed as aligned on a grid.
You basically force the whole entity to the grid,
erasing inbetweensteps wich might be needed still for
"internal" calculations.

the actual position should be saved to a "hidden" position value,
and just be snapped to the grid for displaying it.