Com importação do Git
//variables
let xBall = 300;
let yBall = 200;
let ballDiameter = 15;
//ball velocity variables
let xBallspeed = 6;
let yBallspeed = 6;
//rectangle variables
let xRect = 5;
let yRect = 150;
let wRect = 10;
let hRect = 90;
let hit = false
function setup() {
  createCanvas(600, 400);
}
function draw() {
  background(0);
  showBall();
  ballMovement();
  verifyingBordercollision();
  showRectangles();
  rectangleMovement();
  //verifyingRectangleCollision();
  rectangleCollision();
}
function showBall(){
  circle(xBall, yBall, ballDiameter);
}
function ballMovement(){
  xBall += xBallspeed;
  yBall += yBallspeed;
}
function verifyingBordercollision(){
  if (xBall + ballDiameter/2 > width  || xBall - ballDiameter/2 < 0) {xBallspeed *= -1;}
  if (yBall + ballDiameter/2 > height || yBall - ballDiameter/2 < 0) {yBallspeed *= -1;}
}
function showRectangles(){
  rect(xRect, yRect, wRect, hRect);
}
function rectangleMovement(){
  if(keyIsDown(UP_ARROW)){
    yRect -= 10
  }
  if(keyIsDown(DOWN_ARROW)){
    yRect += 10
  }
}
function verifyingRectangleCollision(){
  if (xBall - ballDiameter/2 < xRect + wRect && yBall - ballDiameter/2 < yRect + hRect && yBall + ballDiameter/2 > yRect){
  xBallspeed *= -1;
  }
}
function rectangleCollision(){
  hit = 
  collideRectCircle(xRect, yRect, wRect, hRect, xBall, yBall, ballDiameter/2);
  if (hit){
    xBallspeed *= -1;
  }
}