Permalink
Browse files

Squashed annoying semicolon bug in guns

  • Loading branch information...
presstube committed Oct 29, 2011
1 parent 7dadf8c commit 3c91b2c75de06e483335ea8ee5b8a6e14739defb
Showing with 24 additions and 23 deletions.
  1. +3 −2 README.md
  2. +1 −1 src/hunted/HuntedApp.js
  3. +2 −2 src/hunted/LauncherHeatSeeker.js
  4. +9 −3 src/hunted/LauncherPeePants.js
  5. +9 −15 src/hunted/ShipSkinGeneric.js
View
@@ -9,10 +9,11 @@ Hunted
Why?
----
-- Because making a crappy game is as fun as playing a good one.
+- Because making a crappy game more fun than playing a good one.
+- I am a JS noob and want to get my code reviewed by others who know what they are doing.
Dependencies
------------
- Grant Skinner's Easel.js to ease me into JS with some handy AS-like objects and a much needed display list for canvas.
-- Underscore.js b/c it is handy, and Backbone.js for its Event system.
+- Underscore.js b/c it is mighty handy.
- jQuery hotkeys plugin (slightly modified to fit my purposes) for reliable keyboard input.
View
@@ -40,7 +40,7 @@
projectileThrust: 40,
shotsPerLaunch: 1,
projectileLife: 20,
- projectileLimit: 20,
+ projectileLimit: 200,
targetFunc: nav.getTarget,
trackingStage: trackingStage,
projectiles: projectiles
@@ -41,8 +41,8 @@
steeringLimit: 20,
shipSkin: ShipSkinGoon,
controlsClass: ShipControlsAIChaseDynamic,
- targetFunc: _p.targetFunc,
- target: _p.ship
+ targetFunc: _p.targetFunc
+ // target: _p.ship
});
ship.scaleX = ship.scaleY = 0.2;
return ship;
@@ -7,21 +7,26 @@
p.initialize = function(props) {
this.Container_initialize();
- console.log("props ", props);
var that = this,
_p = this.props = props || {},
skin = PTUtils.makeTriangle('#fff', 5, 5);
_p.projectileLimit = _p.projectileLimit || 10;
+
+ var spread = 5;
+ var ammoLifeSpan = 1000;
this.addChild(skin);
this.launch = function() {
_.times(5, fire);
+ // fire();
};
function fire() {
if (_p.projectiles.length < _p.projectileLimit) {
+ // that.rotation = 90;
+ that.rotation = Math.random()*spread - Math.random()*spread;
var projectile = that.makeProjectile();
var launchPos = that.localToLocal(0, 0, _p.ship.parent);
projectile.rotation = _p.ship.rotation + that.rotation;
@@ -30,10 +35,11 @@
_p.trackingStage.addChildAt(projectile, _p.trackingStage.getChildIndex(_p.ship));
projectile.addForce(_p.ship.getForce());
var adjProjThrust = _p.projectileThrust - (Math.random()*(_p.projectileThrust/4));
- projectile.addForce(PTUtils.polarDegrees(adjProjThrust, projectile.rotation));
+ projectile.addForce(PTUtils.polarDegrees(adjProjThrust, _p.ship.rotation + that.rotation));
skin.y = +5;
_p.projectiles.push(projectile);
- _.delay(killProjectile, 500, projectile);
+ _.delay(killProjectile, ammoLifeSpan, projectile);
+ // that.rotation = 0;
}
}
@@ -14,7 +14,7 @@
tail = new Container(),
exhaustPipe = new ExhaustPipe(props),
launcher = new Launcher(props),
- heatSeekerLauncher = new LauncherHeatSeeker(props);
+ heatSeekerLauncher = new LauncherHeatSeeker(props),
peePants = new LauncherPeePants(props);
// defaults
@@ -32,13 +32,14 @@
this.addChild(launcher);
launcher.y = -40;
+ this.addChild(heatSeekerLauncher);
+ heatSeekerLauncher.y = -40;
+
this.addChild(peePants);
peePants.y = -40;
- this.addChild(heatSeekerLauncher);
- heatSeekerLauncher.y = -40;
- this.props.ship.launcher = launcher;
+ // this.props.ship.launcher = launcher;
this.update = function() {
var controls = this.props.ship.controls;
@@ -59,20 +60,13 @@
exhaustPipe.engage();
}
-
-
if (controls.seeker) {
- for (var i = 0; i < _p.shotsPerLaunch; i++) {
- heatSeekerLauncher.launch();
- }
+ heatSeekerLauncher.launch();
}
- // if (controls.peePants) {
- // for (var i = 0; i < _p.shotsPerLaunch; i++) {
- // console.log("PPPEEE");
- // peePants.launch();
- // }
- // }
+ if (controls.peePants) {
+ peePants.launch();
+ }
if (controls.launch) {
for (var i = 0; i < _p.shotsPerLaunch; i++) {

0 comments on commit 3c91b2c

Please sign in to comment.