xxxxxxxxxx
41
let t = null;
function setup() {
createCanvas(400, 400);
t = new Thing();
}
function draw() {
background(220);
t.move();
}
// movement
class Thing {
constructor() {
this.x = 0;
this.y = 0;
}
move() {
if (this.x >= width / 2) {
this.y = this.y + 1;
}
if (this.y >= height / 2) {
this.x = this.x - 1;
}
circle(this.x, this.y, 10)
}
}