xxxxxxxxxx
40
// Jan Suphitcha
// assignment2
let jits = [];
let j;
// let pointer ;
function setup() {
createCanvas(400, 400);
for (let i = 0; i < 30; i++) {
jits[i] = new Jit(width / 2, height / 2);
}
}
function draw() {
background(0);
// let w = map(this.d,5,15,0.001,0.01);
// let wind = createVector(0,w);
let gravity = createVector(0, 0.1);
let wind = createVector(0.5, 0); //how to apply new force?
for (let i = 0; i < jits.length; i++) {
jits[i].move();
jits[i].display();
if (mouseIsPressed) {
jits[i].applyForce(wind);
}
jits[i].applyForce(gravity);
jits[i].checkedge();
}
function mousePressed() {
// let newG = createVector(0,-0.01);
// jits[i].applyForce(newG);
// jits[i].jump(newG);
}
}