collision and screen wrapping logic