Changeset 108 for pycodeshooter/trunk/shooter/barrage.js
- Timestamp:
- 01/17/12 01:34:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/shooter/barrage.js
r106 r108 25 25 26 26 this.aim = function(trooper, enemy) { 27 if (!trooper || !enemy) 28 return 0.5 * Math.PI; 27 29 var dx = enemy.x - trooper.x; 28 30 var dy = enemy.y - trooper.y; … … 34 36 return this.aim(trooper, enemy) / Math.PI; 35 37 }; 36 this.update = function(trooper, enem y) {38 this.update = function(trooper, enemies) { 37 39 return false; 38 40 }; … … 49 51 50 52 that.state = 0; 51 that.update = function(trooper, enem y) {53 that.update = function(trooper, enemies) { 52 54 if (++this.state < this.interval) 53 55 return false; 54 56 55 var dir = this.angle(trooper, enem y);57 var dir = this.angle(trooper, enemies[0]); 56 58 57 59 trooper.addBullet(this.bullet, this.size, this.color, … … 91 93 92 94 that.state = 0; 93 that.update = function(trooper, enem y) {95 that.update = function(trooper, enemies) { 94 96 if (++this.state < this.interval) 95 97 return false; 96 98 97 var angle = this.angle(trooper, enem y) - (this.delta * (this.way - 1) / 2);99 var angle = this.angle(trooper, enemies[0]) - (this.delta * (this.way - 1) / 2); 98 100 99 101 for (var i = 0; i < this.way; i++) { … … 135 137 that.curAngle = null; 136 138 137 that.update = function(trooper, enem y) {139 that.update = function(trooper, enemies) { 138 140 if (++this.state < this.interval) 139 141 return false; 140 142 141 143 if (this.curAngle == null) 142 this.curAngle = this.angle(trooper, enem y) -144 this.curAngle = this.angle(trooper, enemies[0]) - 143 145 this.delta * (this.way - 1) / 2; 144 146 … … 268 270 }; 269 271 270 this.update = function(trooper, enem y) {272 this.update = function(trooper, enemies) { 271 273 for (var i = 0; i < this.brrg.length; i++) { 272 274 if (!this.flag[i]) 273 this.flag[i] = this.brrg[i].update(trooper, enem y);275 this.flag[i] = this.brrg[i].update(trooper, enemies); 274 276 } 275 277 for (var i = 0; i < this.flag.length; i++) {
Note: See TracChangeset
for help on using the changeset viewer.