Fix typo, remove old implementations

This commit is contained in:
Luke Murphy 2020-01-31 18:42:15 +01:00
parent 511ff89477
commit 415eab0b7b
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -154,35 +154,22 @@ class GeneratedShape {
this.colour = this.chooseColour();
this.curveTightness = -5;
this.xDelta = 0.0;
this.yDelta = 0.0;
this.xSpeed = 0.0;
this.ySpeed = 0.0;
this.springing = 0.0009;
this.damping = 0.98;
}
collide(shapes) {
/**
* Detect if the shape collides with another shape.
**/
if (shapes.length === 1) {
return false;
}
for (var shape of shapes) {
if (this === shape) {
continue;
}
var collision = collideCircleCircle(
this.x,
this.y,
this.w,
shape.x,
shape.y,
shape.w
);
if (collision === true) {
return true;
}
}
// TODO: implement once again
return false;
}
@ -190,12 +177,8 @@ class GeneratedShape {
/**
* Play a sound after a collision is detected.
**/
var notes = ["G2", "C3", "G3"];
var duration = 0.8;
var time = 0;
var velocity = 0.5;
var index = floor(random(0, notes.length));
this.synth.play(notes[index], velocity, time, duration);
// TODO: implement once again
return;
}
move() {
@ -249,7 +232,9 @@ class GeneratedShape {
}
calculatePoints() {
/* Calculate the points of the shape */
/**
* Calculate the vectors of the shape.
**/
for (var i = 0; i < numberOfEdges; i++) {
var pointX = cos(angle * i) * radius + random(-77, 77);
var pointY = sin(angle * i) * radius + random(-77, 77);
@ -258,8 +243,10 @@ class GeneratedShape {
}
}
/*function for drawing the shape on the screen*/
createShape() {
/**
* Draw curved vectors of the shape.
**/
curveTightness(this.curveTightness);
beginShape();
@ -300,7 +287,7 @@ function draw() {
* The p5.js draw loop.
**/
background("#69D2E7");
translate(centerX, centerX);
translate(centerX, centerY);
blendMode(BLEND);
smooth();
noStroke();