summaryrefslogtreecommitdiff
path: root/resources/js/scene.js
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2020-10-13 19:46:05 +0100
committerFbenas <philbeansburton@gmail.com>2020-10-13 19:46:05 +0100
commita4908f150053316383fbfaee0477e7b4123ce3ca (patch)
treecb9eb8c8f9a9b142b5a4c19213d6e0ca376d17d4 /resources/js/scene.js
parent0b89973e8e1b2251545def7796c246d68ad8e061 (diff)
Refactor
Diffstat (limited to 'resources/js/scene.js')
-rw-r--r--resources/js/scene.js33
1 files changed, 19 insertions, 14 deletions
diff --git a/resources/js/scene.js b/resources/js/scene.js
index 7e7e895..d035827 100644
--- a/resources/js/scene.js
+++ b/resources/js/scene.js
@@ -1,5 +1,9 @@
class Scene {
+ // boid radius
+ // no of boids
+ // scene width
+ // scene height
constructor(component_size, no_of_components) {
this.component_size = component_size;
this.no_of_components = no_of_components;
@@ -13,25 +17,26 @@ class Scene {
initComponents() {
let components = [];
for (let i = 0; i < this.no_of_components; i++) {
- let x, y, z;
- if (i == 0) {
- x = 100;
- y = 100;
- z = 0;
- } else {
- x = 105;
- y = 100;
- z = 180;
- }
+ // let x, y, z;
+ // if (i == 0) {
+ // x = 100;
+ // y = 100;
+ // z = 0;
+ // } else {
+ // x = 105;
+ // y = 100;
+ // z = 180;
+ // }
- components.push(new Component(
+ components.push(new Boid(
this.gameArea.context,
this.component_size,
"black",
+ 300, 300, Math.random() * 360,
// x, y, z,
- Math.random() * (this.gameArea.canvas.width - 100) + 50,
- Math.random() * (this.gameArea.canvas.height - 100) + 50,
- Math.random() * 360,
+ // Math.random() * (this.gameArea.canvas.width - 100) + 50,
+ // Math.random() * (this.gameArea.canvas.height - 100) + 50,
+ // Math.random() * 360,
i
));
}