Fixed Boundary Bug

changed logic in gameLoop so that the rectangle is kept within the
canvas boundaries