Changeset 96 for pycodeshooter/trunk
- Timestamp:
- 01/22/11 20:15:17 (14 years ago)
- Location:
- pycodeshooter/trunk/shooter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/shooter/barrage.js
r94 r96 36 36 return false; 37 37 }; 38 this.posX = function() { 39 return 0; 40 }; 41 this.posY = function() { 42 return 0; 43 }; 38 44 }; 39 45 … … 49 55 50 56 trooper.addBullet(this.bullet, this.size, this.color, 51 0, 0, dir * Math.PI, this.speed); 52 53 for (i = 2; i < this.way + 1; i++) { 57 this.posX(), this.posY(), 58 dir * Math.PI, this.speed); 59 60 for (var i = 2; i < this.way + 1; i++) { 54 61 var d = 0.5 / i; 55 62 56 63 trooper.addBullet(this.bullet, this.size, this.color, 57 0, 0, (dir - d) * Math.PI, this.speed); 64 this.posX(), this.posY(), 65 (dir - d) * Math.PI, this.speed); 58 66 trooper.addBullet(this.bullet, this.size, this.color, 59 0, 0, (dir + d) * Math.PI, this.speed); 67 this.posX(), this.posY(), 68 (dir + d) * Math.PI, this.speed); 60 69 } 61 70 … … 87 96 var angle = this.angle(trooper, enemy) - (this.delta * this.way / 2); 88 97 89 for ( i = 0; i < this.way; i++) {98 for (var i = 0; i < this.way; i++) { 90 99 trooper.addBullet(this.bullet, this.size, this.color, 91 0, 0, angle * Math.PI, this.speed); 100 this.posX(), this.posY(), 101 angle * Math.PI, this.speed); 92 102 angle += this.delta; 93 103 } … … 136 146 137 147 trooper.addBullet(this.bullet, this.size, this.color, 138 0, 0, this.curAngle * Math.PI, this.speed); 148 this.posX(), this.posY(), 149 this.curAngle * Math.PI, this.speed); 139 150 140 151 this.curAngle += this.delta; … … 216 227 return true; 217 228 }; 229 return that; 230 }; 231 232 var MultiRounderBarrage = function(bullet, size, color, 233 interval, speed, way, dir, 234 klass, radius, num) { 235 if (radius == null) { 236 radius = size * way; 237 if (radius > 50) 238 radius = 50; 239 } 240 241 if (num == null) 242 num = Math.ceil((1 / way) * 50); 243 244 var start = 0.25; 245 246 this.initBarrage = function() { 247 this.brrg = new Array(); 248 this.flag = new Array(); 249 250 var w = Math.ceil(way / num); 251 252 for (var i = 0; i < num; i++) { 253 var b = new klass(bullet, size, color, 254 interval, speed, w, dir); 255 256 b.r = radius; 257 b.posX = function() { 258 start += 1 / (num * 2); 259 this.a = i * (1 / num) + start; 260 return this.r * Math.cos(2 * Math.PI * this.a); 261 }; 262 263 b.posY = function() { 264 return this.r * Math.sin(2 * Math.PI * this.a); 265 }; 266 267 this.brrg.push(b); 268 this.flag.push(false); 269 } 270 }; 271 272 this.update = function(trooper, enemy) { 273 for (var i = 0; i < this.brrg.length; i++) { 274 if (!this.flag[i]) 275 this.flag[i] = this.brrg[i].update(trooper, enemy); 276 } 277 for (var i = 0; i < this.flag.length; i++) { 278 if (!this.flag[i]) 279 return false; 280 } 281 this.initBarrage(); 282 return true; 283 }; 284 285 this.initBarrage(); 286 }; 287 288 var MultiRounderArchBarrage = function(bullet, size, color, 289 interval, speed, way, dir) { 290 var that = new MultiRounderBarrage(bullet, size, color, interval, speed, 291 way, dir, ArchBarrage); 292 return that; 293 }; 294 295 var MultiRounderCircularBarrage = function(bullet, size, color, 296 interval, speed, way, dir) { 297 var that = new MultiRounderBarrage(bullet, size, color, interval, speed, 298 way, dir, CircularBarrage); 299 return that; 300 }; 301 302 var MultiRounderDelayedArchBarrage = function(bullet, size, color, 303 interval, speed, way, dir) { 304 var that = new MultiRounderBarrage(bullet, size, color, interval, speed, 305 way, dir, DelayedArchBarrage); 306 return that; 307 }; 308 309 var MultiRounderDelayedCircularBarrage = function(bullet, size, color, 310 interval, speed, way, dir) { 311 var that = new MultiRounderBarrage(bullet, size, color, interval, speed, 312 way, dir, DelayedCircularBarrage); 313 return that; 314 }; 315 316 var MultiRounderDelayedRecursiveArchBarrage = function(bullet, size, color, 317 interval, speed, way, dir) { 318 var that = new MultiRounderBarrage(bullet, size, color, interval, speed, 319 way, dir, DelayedRecursiveArchBarrage); 320 return that; 321 }; 322 323 var MultiRounderDelayedRecursiveCircularBarrage = function(bullet, size, color, 324 interval, speed, way, dir) { 325 var that = new MultiRounderBarrage(bullet, size, color, interval, speed, 326 way, dir, DelayedRecursiveCircularBarrage); 218 327 return that; 219 328 }; … … 226 335 DelayedCircularBarrage, 227 336 DelayedRecursiveArchBarrage, 228 DelayedRecursiveCircularBarrage]; 337 DelayedRecursiveCircularBarrage, 338 MultiRounderArchBarrage, 339 MultiRounderCircularBarrage, 340 MultiRounderDelayedArchBarrage, 341 MultiRounderDelayedCircularBarrage, 342 MultiRounderDelayedRecursiveArchBarrage, 343 MultiRounderDelayedRecursiveCircularBarrage]; -
pycodeshooter/trunk/shooter/system.js
r95 r96 68 68 69 69 var newObjs = new Array(); 70 for ( i = 0; i < System.backgroundObject.length; i++) {70 for (var i = 0; i < System.backgroundObject.length; i++) { 71 71 System.backgroundObject[i].next(); 72 72 System.backgroundObject[i].draw(ctx); … … 93 93 94 94 var newObjs = new Array(); 95 for ( i = 0; i < System.deathPieces.length; i++) {95 for (var i = 0; i < System.deathPieces.length; i++) { 96 96 System.deathPieces[i].next(); 97 97 System.deathPieces[i].draw(ctx); … … 328 328 setMessage(System.message, "ActionsIdx:"); 329 329 330 for ( i = 0; i < numAct; i++) {330 for (var i = 0; i < numAct; i++) { 331 331 var idx = (bossData.agility + i) % EnemyActions.length; 332 332 acts.push(new EnemyActions[idx](new shot())); 333 333 334 addMessage(System.message, String(idx) + ","); 334 addMessage(System.message, String(idx) + "(" + 335 String(bossData.hitpoint % EnemyShots.length) + "),"); 335 336 } 336 337 337 338 addMessage(System.message, "<br>"); 338 339 339 for ( i = 0; i < numBrrg; i++) {340 var idx = (bossData.skill s.length+ i) % EnemyBarrages.length;340 for (var i = 0; i < numBrrg; i++) { 341 var idx = (bossData.skillpoint + i) % EnemyBarrages.length; 341 342 var brrgCls = EnemyBarrages[idx]; 342 343 … … 344 345 "BarragesIdx:" + String(idx) + " / BulletsIdx:"); 345 346 346 for ( k = 0; k < numBlt; k++) {347 for (var k = 0; k < numBlt; k++) { 347 348 var iidx = (bossData.skills.length + i + k) % EnemyBullets.length; 348 var ss = Math.ceil(bossData.luck / 3);349 var ss = Math.ceil(bossData.luck / 5); 349 350 brrgs.push( 350 351 new brrgCls( -
pycodeshooter/trunk/shooter/trooper.js
r95 r96 37 37 // judge bullet 38 38 var delIdx = new Array(); 39 for ( i = 0; i < enemy.bullets.length; i++) {39 for (var i = 0; i < enemy.bullets.length; i++) { 40 40 if (touch(this.x, this.y, this.size, 41 41 enemy.bullets[i].x, enemy.bullets[i].y, enemy.bullets[i].size)) … … 130 130 // update/delete my bullets 131 131 delIdx = new Array(); 132 for ( i = 0; i < this.bullets.length; i++) {132 for (var i = 0; i < this.bullets.length; i++) { 133 133 this.bullets[i].next(); 134 134 … … 140 140 // judge/delete hit bullets 141 141 delIdx = new Array(); 142 for ( i = 0; i < enemy.bullets.length; i++) {142 for (var i = 0; i < enemy.bullets.length; i++) { 143 143 if (touch(this.x, this.y, this.size, 144 144 enemy.bullets[i].x, enemy.bullets[i].y, enemy.bullets[i].size)) … … 165 165 166 166 // draw bullets 167 for ( i = 0; i < this.bullets.length; i++)167 for (var i = 0; i < this.bullets.length; i++) 168 168 this.bullets[i].draw(ctx); 169 169 }; … … 180 180 var newBullets = new Array(); 181 181 182 for ( i = 0; i < idx.length; i++)182 for (var i = 0; i < idx.length; i++) 183 183 this.bullets[idx[i]] = null; 184 184 185 for ( i = 0; i < this.bullets.length; i++)185 for (var i = 0; i < this.bullets.length; i++) 186 186 if (this.bullets[i]) 187 187 newBullets.push(this.bullets[i]);
Note: See TracChangeset
for help on using the changeset viewer.