It might make sense to convert the player position to fixed point to make the wraparound happen automatically.