Applied collision detection to sprite movement to prevent sprite moving off canvas