Permalink
Browse files

jet force change at end of wave

  • Loading branch information...
1 parent e238e3d commit 5624edf4eba3f1dcee2370ecc800af2f7f628bd8 @mzgoddard committed Apr 22, 2012
Showing with 24 additions and 5 deletions.
  1. +16 −1 src/game/mail.js
  2. +8 −4 src/game/main.js
View
@@ -398,7 +398,7 @@ glider.WaveManager = aqua.type(aqua.Component, {
init: function( options ) {
this.waveCount = 0;
this.wave = null;
- this.jets = [];
+ this.jets = options.jets || [];
this.player = options.player;
this.planet = options.planet;
@@ -425,6 +425,21 @@ glider.WaveManager = aqua.type(aqua.Component, {
this.waveOptions.count *= 1.1;
+ var numJets = this.jets.length;
+ this.jets.forEach( function( jet, i ) {
+ var angle =
+ Math.random() * Math.PI -
+ Math.PI * 2 / numJets / 2 +
+ Math.PI * 2 / 12 * ( 1 + i * 4 );
+
+ jet.force = [
+ Math.cos( angle ) * 6000,
+ Math.sin( angle ) * 6000,
+ 0
+ ];
+ console.log( arguments, i, angle, jet.force );
+ });
+
setTimeout( this.startWave.bind( this ), 5000 );
}
});
View
@@ -133,7 +133,8 @@ for ( var idx = 0; idx < 500; idx++ )
1));
// var jet = aqua.GameObject.create();
-aqua.game.world.add( glider.Jet.create(
+var jet, jets = [];
+aqua.game.world.add( jet = glider.Jet.create(
[
planet.position[0] + Math.cos(Math.PI/6) * planet.radius * 2,
planet.position[1] + Math.sin(Math.PI/6) * planet.radius * 2,
@@ -143,7 +144,8 @@ aqua.game.world.add( glider.Jet.create(
Math.sin(Math.PI/6) * 6000,
0
] ) );
-aqua.game.world.add( glider.Jet.create(
+jets.push( jet );
+aqua.game.world.add( jet = glider.Jet.create(
[
planet.position[0] + Math.cos(Math.PI/6*5) * planet.radius * 2,
planet.position[1] + Math.sin(Math.PI/6*5) * planet.radius * 2,
@@ -153,7 +155,8 @@ aqua.game.world.add( glider.Jet.create(
Math.sin(Math.PI/6*5) * 6000,
0
] ) );
-aqua.game.world.add( glider.Jet.create(
+jets.push( jet );
+aqua.game.world.add( jet = glider.Jet.create(
[
planet.position[0] + Math.cos(Math.PI/6*9) * planet.radius * 2,
planet.position[1] + Math.sin(Math.PI/6*9) * planet.radius * 2,
@@ -163,7 +166,7 @@ aqua.game.world.add( glider.Jet.create(
Math.sin(Math.PI/6*9) * 6000,
0
] ) );
-
+jets.push( jet );
// for ( var i = 0; i < 20; i++ ) {
// var mail = aqua.GameObject.create();
// mail.add( glider.Mail.create([Math.random()*1500, Math.random()*1500, 0],[0,10,0]));
@@ -175,6 +178,7 @@ var mail = aqua.GameObject.create();
mail.add( glider.WaveManager.create({
planet: planet,
player: aqua.game.player,
+ jets: jets,
waveOptions: {
count: 20
// render: {

0 comments on commit 5624edf

Please sign in to comment.