From a4908f150053316383fbfaee0477e7b4123ce3ca Mon Sep 17 00:00:00 2001 From: Fbenas Date: Tue, 13 Oct 2020 19:46:05 +0100 Subject: Refactor --- resources/js/scene.js | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'resources/js/scene.js') 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 )); } -- cgit v1.2.3