How to make an object move in p5 - I want to create the object when the mouse is clicked then it should bounce off the walls. I am a beginner to p5 and am completing this as a homework assignment please help

let XCoord;
let YCoord;
let molecules = ;
let i;

function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
// XCoord = frameCount % width

}

function mousePressed() {
XCoord = mouseX;
YCoord = mouseY;
hydrochloric_acid()

}

function update_position(m) {
velocity = p5.Vector.random2D().mult(random(2, 5));
XCoord = XCoord + i;
YCoord = YCoord + i;
i++;
if(i>600) {
i=0;
}
}

function hydrochloric_acid(x, y, diameter, rgb) {
fill(255, 140, 255)
ellipse(XCoord, YCoord, 50)
fill(160, 28, 252)
ellipse(XCoord + 26.5, YCoord + 26.5, 25)
update_position()

}

var cl = {

r: 0,
g: 0,
b: 0

}