xxxxxxxxxx
35
let rSize = 20;
let x = 200;
let y = 200;
let xJump = 4;
let yJump = -3;
function setup() {
createCanvas(400, 400);
rectMode(CENTER);
}
function draw() {
background(220);
noFill();
stroke(1);
quad(80, 120, 320, 120, 265, 400, 130, 400);
ellipse(x,y,rSize,rSize);
x = x + xJump;
y = y + yJump;
if(x >= width-rSize/2 || x <= rSize/2) {
xJump = xJump * -1;
fill(0,0,0);
}
if(y >= height-rSize/2 || y <= rSize/2) {
yJump = yJump * -1;
fill(0,0,0);
}
}