xxxxxxxxxx
39
let locationX, locationY;
let velocityX, velocityY;
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB, 360, 100, 100, 100);
locationX = width / 2;
locationY = height / 2;
velocityX = random(-5, 5);
velocityY = random(-5, 5);
}
function draw() {
background(0);
noStroke();
fill(0, 100, 100, 100);
circle(locationX, locationY, 50);
locationX = locationX + velocityX;
locationY = locationY + velocityY;
if (locationX < 0) {
print('hit le
}
if (locationX > width) {
print('higt right!');
}
if (locationY < 0) {
print('hit up');
}
if (locationY > height) {
print('hit down');
}
}