xxxxxxxxxx
var oldx, oldy;
var x, y;
var vx;
var a;
var f;
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
x = width/2;
y = height / 2;
oldx = x;
oldy = y;
vx = -.85;
vy = 3.1;
a = 2.5
f = -.9
}
function draw() {
fill (30, 100, 20)
ellipse(x, y, 25, 25);
vy = vy + f;
vy = vy + a;
x = x + vx;
y = y + vy;
if (x < 0) {
vx = vx * -1;
vy = vy * -1;
}
if (x > width) {
vx = vx * -1;
}
if (y > height) {
vy = vy * -1;
}
if (y < 0) {
vy = vy * -1;
}
function (mousePressed() {
x = mouseX;
y = mouseY;
}
}