-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw.js
More file actions
27 lines (23 loc) · 819 Bytes
/
draw.js
File metadata and controls
27 lines (23 loc) · 819 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
"use strict";
function draw() {
// Object matrix needs to be updated continually
tieBomber.model.updateMatrix();
asteroid.model.updateMatrix();
laser.model.updateMatrix();
temp.updateMatrix();
var numRocks = 20;
if (numPlayers == 2 && arwing != undefined) {
arwing.model.updateMatrix();
laser2.model.updateMatrix();
numRocks = 20;
}
// clone the asteroids once the parent has loaded and give them a random rotation angl
if(asteroid != undefined && needToClone == true) {
for(var i = 0; i < numRocks; i++) {
asteroids[i] = new asteroidClone(asteroid.clone());
asteroids[i].model.rotation.set(Math.random() * 360, Math.random() * 360, Math.random() * 360);
scene.add(asteroids[i].model);
}
needToClone = false;
}
}