Commit 149ce4fa authored by Matthew Odle's avatar Matthew Odle

rename laser to lasers

parent 74069a03
......@@ -22,9 +22,9 @@ var lasers = {
sounds.playAvailableLaserSound();
},
eligibleToSpawn : function(player) {
let eligible = this.lasers[player.name].length < knobsAndLevers.laser.quantity.value
let eligible = this.lasers[player.name].length < knobsAndLevers.lasers.quantity.value
&& supporting.everyinterval(
game.gameArea.frameNo, knobsAndLevers.laser.interval
game.gameArea.frameNo, knobsAndLevers.lasers.interval
)
&& controls.isFiring(player);
return eligible;
......@@ -33,8 +33,8 @@ var lasers = {
this.lasers[player.name].push(this.make(player));
},
make : function(player) {
let laserArgs = knobsAndLevers.laser.args;
laserArgs.extraArgs.speed.y = -1 * knobsAndLevers.laser.speed.value;
let laserArgs = knobsAndLevers.lasers.args;
laserArgs.extraArgs.speed.y = -1 * knobsAndLevers.lasers.speed.value;
laserArgs.x = player.x + player.width / 2;
laserArgs.y = player.y;
return new Component(laserArgs);
......
......@@ -5,7 +5,7 @@ var knobsAndLevers = {
this.centipede.init(this);
this.flies.init(this);
this.player.init(this);
this.laser.init(this);
this.lasers.init(this);
this.mushrooms.init(this);
this.spiders.init(this);
this.text.init(this);
......@@ -13,7 +13,7 @@ var knobsAndLevers = {
console.log('knobsAndLevers initialized');
},
resetCheats : function() {
this.laser.resetCheats();
this.lasers.resetCheats();
this.player.resetCheats();
this.game.activeCheats = {};
console.log('cheats reset');
......@@ -143,7 +143,7 @@ var knobsAndLevers = {
},
}
},
laser : {
lasers : {
speed : {
value : 10,
default : 5,
......
......@@ -50,22 +50,22 @@ var menusProps = {
// TODO demigod - a ton of lives
laserQTY : {
update : function() {
this.text = knobsAndLevers.laser.quantity.setting.render();
this.text = knobsAndLevers.lasers.quantity.setting.render();
},
action : function() {
knobsAndLevers.toggleParameter(knobsAndLevers.laser.quantity);
game.activeCheats['laserQty'] = knobsAndLevers.laser.quantity.setting.state == "ON";
knobsAndLevers.toggleParameter(knobsAndLevers.lasers.quantity);
game.activeCheats['laserQty'] = knobsAndLevers.lasers.quantity.setting.state == "ON";
this.update();
menus.display('cheats');
},
},
laserSpeed : {
update : function() {
this.text = knobsAndLevers.laser.speed.setting.render();
this.text = knobsAndLevers.lasers.speed.setting.render();
},
action : function() {
knobsAndLevers.toggleParameter(knobsAndLevers.laser.speed);
game.activeCheats['laserSpeed'] = knobsAndLevers.laser.speed.setting.state == "ON";
knobsAndLevers.toggleParameter(knobsAndLevers.lasers.speed);
game.activeCheats['laserSpeed'] = knobsAndLevers.lasers.speed.setting.state == "ON";
this.update();
menus.display('cheats');
},
......
......@@ -10,7 +10,7 @@ var sounds = {
playerDied : this.buildSound("player-died", 0.5),
tierChange : this.buildSound("tier-change", 0.3),
laserPool : this.buildManySounds("laser", 20),
impactPool : this.buildManySounds("laser-impact", knobsAndLevers.laser.quantity.value),
impactPool : this.buildManySounds("laser-impact", knobsAndLevers.lasers.quantity.value),
};
console.log("sounds initialized");
},
......
......@@ -11,7 +11,7 @@ describe('COLLISIONS SPEC: ', () => {
knobsAndLevers.init();
});
function createAnObjectFromLaserArgs() {
let laserArgs = knobsAndLevers.laser.args;
let laserArgs = knobsAndLevers.lasers.args;
laserArgs.x = 10;
laserArgs.y = 10;
laserArgs.width = 10;
......
......@@ -48,13 +48,13 @@ describe('LASERS SPEC: ', () => {
it('eligibleToSpawn returns false if lasers is at max', () => {
testObj.lasers = [];
while (testObj.lasers.length < knobsAndLevers.laser.quantity.value) {
while (testObj.lasers.length < knobsAndLevers.lasers.quantity.value) {
testObj.lasers.push({});
};
spyOn(supporting, 'everyinterval').and.returnValue(true);
spyOn(controls, 'isFiring').and.returnValue(true);
expect(testObj.lasers.length).toBe(knobsAndLevers.laser.quantity.value);
expect(testObj.lasers.length).toBe(knobsAndLevers.lasers.quantity.value);
let spawnEligibility = testObj.eligibleToSpawn();
......@@ -67,7 +67,7 @@ describe('LASERS SPEC: ', () => {
spyOn(supporting, 'everyinterval').and.returnValue(true);
spyOn(controls, 'isFiring').and.returnValue(true);
expect(testObj.lasers.length).toBeLessThan(knobsAndLevers.laser.quantity.value);
expect(testObj.lasers.length).toBeLessThan(knobsAndLevers.lasers.quantity.value);
let spawnEligibility = testObj.eligibleToSpawn();
......@@ -91,7 +91,7 @@ describe('LASERS SPEC: ', () => {
player.init();
let laser = testObj.make();
expect(laser.speedY).toBe(-knobsAndLevers.laser.speed.value);
expect(laser.speedY).toBe(-knobsAndLevers.lasers.speed.value);
expect(laser.x).toBe(player.gamePiece.x + player.gamePiece.width / 2);
expect(laser.y).toBe(player.gamePiece.y);
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment