Browse files

Pimping boost.

  • Loading branch information...
1 parent ecf5061 commit 7bdcd505fc259a7c41871f6093c6345f4434a576 @presstube committed Oct 31, 2011
Showing with 23 additions and 4 deletions.
  1. +16 −2 src/hunted/Boost.js
  2. +7 −2 src/hunted/HuntedApp.js
View
18 src/hunted/Boost.js
@@ -13,7 +13,8 @@
_p.boostRegenerateFrequency = _p.boostRegenerateFrequency || 5;
var boostFuel = _p.boostFuelLimit,
- skin = PTUtils.makeTriangle("777", 20, 20),
+ width = 20,
+ skin = PTUtils.makeTriangle("fff", width, width),
ship = _p.ship,
controls = ship.controls,
tickCount = 0,
@@ -25,9 +26,22 @@
this.tick = function() {
if(controls.boost && boostFuel > 0) {
- force = PTUtils.polarDegrees(_p.boostThrust, ship.rotation);
+ var mult = boostFuel / _p.boostFuelLimit;
+ force = PTUtils.polarDegrees(_p.boostThrust*mult, ship.rotation);
ship.addForce(force);
boostFuel--;
+ var shudder = 20;
+ app.stage.x += Math.random()*shudder*mult - Math.random()*shudder*mult;
+ app.stage.y += Math.random()*shudder*mult - Math.random()*shudder*mult;
+ console.log("widd: " + skin.width);
+ var boostChunk = PTUtils.makeTriangle('#fff', width*mult, width*mult);
+ boostChunk.x = ship.x;
+ boostChunk.y = ship.y;
+ boostChunk.rotation = ship.rotation;
+ app.trackingStage.addChildAt(boostChunk, ship.parent.getChildIndex(ship));
+ _.delay(function(){
+ app.trackingStage.removeChild(boostChunk);
+ }, 300);
} else {
if (boostFuel < _p.boostFuelLimit && tickCount % _p.boostRegenerateFrequency === 0) {
boostFuel++;
View
9 src/hunted/HuntedApp.js
@@ -32,9 +32,9 @@
skinClass: ShipSkinGeneric,
drag: 0.95,
thrustLimit: 2,
- boostThrust: 4,
+ boostThrust: 10,
boostFuelLimit: fuelLimit,
- boostRegenerateFrequency: 10,
+ boostRegenerateFrequency: 4,
steeringResponse: 2,
steeringLimit: 10,
launcherSpread: 5,
@@ -92,6 +92,8 @@
this.ship = ship;
this.chasers = chasers;
this.projectiles = projectiles;
+ this.trackingStage = trackingStage;
+ this.stage = stage;
nav.setReference(ship);
@@ -121,6 +123,9 @@
} else {
scaleStage.setScaleMultiplier(0.5);
}
+
+ stage.x += (0 - stage.x) / 1.5;
+ stage.y += (0 - stage.y) / 1.5;
};
}

0 comments on commit 7bdcd50

Please sign in to comment.