xxxxxxxxxx
110
let boxes = [];
let ITERATIONS = 8;
function setup() {
createCanvas(600, 400);
boxes.push(new Box(0 - 400 , 0, 399, height+400))
boxes.push(new Box(width+1, 0, 400, height+400))
boxes.push(new Box(0, 0-400, width+400, 399))
boxes.push(new Box(0, height+1, width+400, 400))
boxes.push(new Box(190, 220, 100, 100))
boxes.push(new Box(50, 100, 80, 150))
boxes.push(new Box(70, 100-20, 50, 20))
boxes.push(new Box(400-40, 400-40, 40, 40))
boxes.push(new Box(400-110, 400-80, 40, 40))
boxes.push(new Box(400-40, 400-120, 40, 40))
boxes.push(new Box(400-110, 400-160, 40, 40))
boxes.push(new Box(400-40, 400-200, 40, 40))
boxes.push(new Box(400-110, 400-240, 40, 40))
boxes.push(new Box(130, 180, 40, 40))
boxes.push(new Box(200, 140, 40, 40))
boxes.push(new Box(130, 100, 40, 40))
boxes.push(new Box(460, 200, 40, 40))
boxes.push(new Box(410, 160, 80, 20))
boxes.push(new Box(410, 120, 80, 20))
boxes.push(new Box(410, 80, 80, 20))
boxes.push(new Box(410, 40, 80, 20))
}
function adfasdfasdf() {
let r = new RopeManager()
for (let i = 0; i < 24; i++) {
let p = new RopePoint(mouseX, mouseY + i)
p.x_accel = -0.01
r.points.push(p)
if (i >= 1) {
r.sticks.push(new RopeStick(r.points[i-1], r.points[i]))
}
}
r.points[0].locked = true;
r.iterations = 2
testM.push(r);
}
let player = new Player(24, 400);
let testM = []
let timer = 0;
let lasttimer = 0;
let timerActive = false;
let lastSpace = false
let lastspacetimer = 0;
function draw() {
if (keyIsDown(32) && !lastSpace) {
timerActive = !timerActive
if (lastspacetimer < 14) {
timer = 0;
}
lastspacetimer = 0;
}
lastspacetimer ++
lastSpace = keyIsDown(32)
if (timerActive) {
timer += millis()/1000 - lasttimer
}
lasttimer = millis()/1000
background(240)
player.update()
stroke(20)
noFill()
for (let b of boxes) {
b.show()
}
player.show()
for (let r of testM) {
r.update()
r.show()
}
fill(0)
text(timer, 16, 16)
}