Added basic collision detection with the walls of the display.