xxxxxxxxxx
52
// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
class Mover {
constructor() {
this.body = Bodies.rectangle(400, 200, 80, 80);
World.add(world, this.body);
//console.log(this.body);
// this.position = createVector(400, 50);
// this.velocity = createVector(1, 0);
// this.acceleration = createVector(0, 0);
// this.mass = 1;
}
display() {
stroke(0);
strokeWeight(2);
fill(255, 127);
ellipse(this.position.x, this.position.y, this.mass * 16, this.mass * 16);
}
// applyForce(force) {
// var f = p5.Vector.div(force, this.mass);
// this.acceleration.add(f);
// };
// update() {
// this.velocity.add(this.acceleration);
// this.position.add(this.velocity);
// this.acceleration.mult(0);
// }
// checkEdges() {
// if (this.position.x > width) {
// this.position.x = width;
// this.velocity.x *= -1;
// } else if (this.position.x < 0) {
// this.velocity.x *= -1;
// this.position.x = 0;
// }
// if (this.position.y > height) {
// this.velocity.y *= -1;
// this.position.y = height;
// }
// }
}