Remove lastCollidedShape tracking
This commit is contained in:
parent
0b547c8e52
commit
bea077d5a2
@ -282,9 +282,6 @@ class GeneratedShape {
|
|||||||
this.destX = random(windowWidth);
|
this.destX = random(windowWidth);
|
||||||
this.destY = random(windowHeight);
|
this.destY = random(windowHeight);
|
||||||
|
|
||||||
// the shape that was last collided with
|
|
||||||
this.lastCollidedShape;
|
|
||||||
|
|
||||||
this.initialise();
|
this.initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +321,7 @@ class GeneratedShape {
|
|||||||
for (let i = 0; i < shapes.length; i++) {
|
for (let i = 0; i < shapes.length; i++) {
|
||||||
let shape = shapes[i];
|
let shape = shapes[i];
|
||||||
|
|
||||||
if (this === shape || this.lastCollidedShape === shape) {
|
if (this === shape) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +335,6 @@ class GeneratedShape {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (collision === true) {
|
if (collision === true) {
|
||||||
this.lastCollidedShape = shape;
|
|
||||||
return [true, shape];
|
return [true, shape];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,9 +524,6 @@ function draw() {
|
|||||||
if (positionTick) {
|
if (positionTick) {
|
||||||
shape.destX = random(windowWidth);
|
shape.destX = random(windowWidth);
|
||||||
shape.destY = random(windowHeight);
|
shape.destY = random(windowHeight);
|
||||||
|
|
||||||
// also reset last collided shape
|
|
||||||
shape.lastCollidedShape = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shape.draw();
|
shape.draw();
|
||||||
|
Loading…
Reference in New Issue
Block a user