Consegui realizar todos os passos. Segue abaixo os códigos que utilizei:
let xBall = 300;
let yBall = 200;
let diameter = 15;
let xBallspeed = 6;
let yBallspeed = 6;
let radius = diameter / 2;
function setup() {
createCanvas(600, 400);
}
function draw() {
background(0);
ball();
ballspeed();
balledge();
}
function ball(){
circle (xBall,yBall,diameter)
}
function ballspeed(){
xBall += xBallspeed;
yBall += yBallspeed;
}
function balledge(){
if (xBall + radius > width ||
xBall - radius < 0){
xBallspeed *= -1
}
if (yBall + radius > height ||
yBall - radius < 0){
yBallspeed *=-1
}
}