-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
executable file
·35 lines (29 loc) · 925 Bytes
/
main.js
File metadata and controls
executable file
·35 lines (29 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Duy Huynh
* TCSS 491, Winter '16
* Assignment 3- Network
* main.js
*
* Based on Craig Reynold's flocking algorithms. Based on three behaviors: Separation, Alignment, Cohesion.
*
*/
// Download Assets
ASSET_MANAGER.queueDownload("./img/fish.png");
ASSET_MANAGER.downloadAll(function () {
console.log("Starting asset downloads");
var canvas = document.getElementById('gameWorld');
var ctx = canvas.getContext('2d');
var gameEngine = new GameEngine();
// Create 100 boids to start off with
for (var i = 0; i < 100; i++) {
var boid = new Boid(gameEngine, Math.random() * 800, Math.random() * 600, 2);
gameEngine.addEntity(boid);
boids.push(boid); // Careful this 'boids' is not global
}
gameEngine.init(ctx);
gameEngine.start();
// socket.on("ping", function (ping) {
// console.log(ping);
// socket.emit("pong");
// });
});