//bounce.js

//add globals for motion
var deltaX = 5;
var deltaY = 3;
      
//overwrite init function
function init(){
  sprite = document.getElementById("sprite");
  setInterval("animate()", 50);
} // end init
      
//control moveSprite more directly
function animate(){
  moveSprite(deltaX, deltaY);
} // end animate
      
//overwrite checkBounds function
function checkBounds(){
  //bounce
  if (x > MAX_X){
    deltaX = -5;
  } // end if
  if (x < MIN_X){
    deltaX *= -1;
  } // end if
  if (y > MAX_Y){
    deltaY *= -1;
  } // end if
  if (y < MIN_Y){
    deltaY *= -1;
  } // end if
} // end function
