Commit 2b42ce94 authored by Matthew Odle's avatar Matthew Odle

Merge branch 'develop' into 'master'

Develop

See merge request !21
parents c54ae757 afbd61b1
......@@ -40,7 +40,7 @@ var collisions = {
this.removeDestroyedTargets(targets);
},
checkPlayerVsEnemies : function(player, targets) {
if (!knobsAndLevers.game.playerCollisionsEnabled) {
if (!dials.game.playerCollisionsEnabled) {
return;
};
targets.forEach(target => {
......
......@@ -29,8 +29,8 @@ var centipedes = {
this.add(centipede);
},
make : function() {
let centipede = Object.assign(new Component(knobsAndLevers.centipede.args), knobsAndLevers.centipede.defaults);
let pointValue = knobsAndLevers.centipede.pointValue;
let centipede = Object.assign(new Component(dials.centipede.args), dials.centipede.defaults);
let pointValue = dials.centipede.pointValue;
centipede.pointValue = supporting.getRandom(pointValue, pointValue + 20);
centipede.sound = sounds.getSound('centipede');
return centipede;
......@@ -61,8 +61,8 @@ var centipedes = {
this.buildCentipedeStructure();
},
buildCentipedeStructure : function() {
let tier = knobsAndLevers.game.tier;
this.segments = tier.current * 2 + knobsAndLevers.centipede.maxNumber;
let tier = dials.game.tier;
this.segments = tier.current * 2 + dials.centipede.maxNumber;
this.positions = [];
let upperLimit = tier.isMaxed ? tier.max : tier.current;
while (this.positions.length < supporting.getRandom(1, upperLimit)) {
......@@ -77,7 +77,7 @@ var centipedes = {
return this.numberSpawned < this.segments;
},
setXPosition : function() {
knobsAndLevers.centipede.args.x = this.positions[this.centipedes.length % this.positions.length];
dials.centipede.args.x = this.positions[this.centipedes.length % this.positions.length];
},
cannotAdd : function(centipede) {
return this.centipedes.find(checkCentipede => checkCentipede.crashWith(centipede));
......@@ -103,7 +103,7 @@ var centipedes = {
if (centipede.getBottom() > game.gameArea.canvas.height) {
centipede.reverseDirectionY = true;
centipede.poisoned = false;
} else if (centipede.getTop() < knobsAndLevers.player.topLimit && centipede.distanceMovedFromBottom > 0) {
} else if (centipede.getTop() < dials.player.topLimit && centipede.distanceMovedFromBottom > 0) {
centipede.reverseDirectionY = true;
centipede.distanceMovedFromBottom = 0;
};
......
......@@ -7,9 +7,9 @@ var gameObjects = {
Object.assign(this, gameObjectsBase);
supporting.applyOverrides(this);
this.intervals = {
fleas : knobsAndLevers.fleas.initialInterval,
worms : knobsAndLevers.worms.initialInterval,
spiders : knobsAndLevers.spiders.initialInterval,
fleas : dials.fleas.initialInterval,
worms : dials.worms.initialInterval,
spiders : dials.spiders.initialInterval,
};
console.log('gameObjects initialized');
},
......@@ -26,14 +26,14 @@ var gameObjects = {
},
spawn : function(type) {
this.setMax(type);
if (this[type].length >= knobsAndLevers[type].maxNumber) {
if (this[type].length >= dials[type].maxNumber) {
return;
};
this.make(type);
},
make : function(type) {
let spawnedCreature = new Component(knobsAndLevers[type].args);
let pointValue = knobsAndLevers[type].pointValue;
let spawnedCreature = new Component(dials[type].args);
let pointValue = dials[type].pointValue;
spawnedCreature.pointValue = supporting.getRandom(pointValue, pointValue + 400);
spawnedCreature.sound = sounds.getSound(type);
this[type].push(spawnedCreature);
......@@ -71,26 +71,26 @@ var gameObjects = {
},
spawnCreatureAtIntervals(type) {
if (supporting.everyinterval(game.gameArea.frameNo, this.intervals[type])) {
this.intervals[type] = supporting.getRandom(knobsAndLevers[type].interval.min, knobsAndLevers[type].interval.max);
this.intervals[type] = supporting.getRandom(dials[type].interval.min, dials[type].interval.max);
this.spawn(type);
if (type == 'fleas') {
knobsAndLevers.fleas.mushroomCreateInterval = supporting.getRandom(75, 150);
dials.fleas.mushroomCreateInterval = supporting.getRandom(75, 150);
};
};
},
setMax : function(type) {
let tier = knobsAndLevers.game.tier;
knobsAndLevers[type].maxNumber = tier.isMaxed ? tier.max : tier.current;
let tier = dials.game.tier;
dials[type].maxNumber = tier.isMaxed ? tier.max : tier.current;
},
setSpeed : function(creature, type) {
let speedLimits = knobsAndLevers[type].speedLimits;
let speedLimits = dials[type].speedLimits;
creature.speedX = Math.sign(creature.speedX) * (supporting.roll(10).crit ? speedLimits.max : speedLimits.min);
creature.speedY = creature.directionY * (supporting.roll(10).crit ? speedLimits.max : speedLimits.min);
},
setDirection : function(creature) {
if (creature.getBottom() > game.gameArea.canvas.height) {
creature.directionY = -1;
} else if (creature.getTop() < game.gameArea.canvas.height - (knobsAndLevers.player.areaHeight * 2)) {
} else if (creature.getTop() < game.gameArea.canvas.height - (dials.player.areaHeight * 2)) {
creature.directionY = 1;
};
},
......@@ -102,7 +102,7 @@ var gameObjects = {
eligibleToDrop : function() {
return supporting.everyinterval(
game.gameArea.frameNo,
knobsAndLevers.fleas.mushroomCreateInterval
dials.fleas.mushroomCreateInterval
);
},
removeMushrooms : function(creature) {
......
......@@ -29,8 +29,8 @@ var lasers = {
this.lasers[player.name].push(this.make(player));
},
make : function(player) {
let laserArgs = knobsAndLevers.lasers.args;
laserArgs.extraArgs.speed.y = -1 * knobsAndLevers.lasers.speed.value;
let laserArgs = dials.lasers.args;
laserArgs.extraArgs.speed.y = -1 * dials.lasers.speed.value;
laserArgs.x = player.x + player.width / 2;
laserArgs.y = player.y;
return new Component(laserArgs);
......@@ -49,9 +49,9 @@ var lasers = {
},
},
eligibleToSpawn : function(player) {
let eligible = this.lasers[player.name].length < knobsAndLevers.lasers.quantity.value
let eligible = this.lasers[player.name].length < dials.lasers.quantity.value
&& supporting.everyinterval(
game.gameArea.frameNo, knobsAndLevers.lasers.interval
game.gameArea.frameNo, dials.lasers.interval
)
&& controls.isFiring(player);
return eligible;
......
......@@ -9,7 +9,7 @@ var mushrooms = {
functionOverrides : {
manage : function() {
if (game.gameArea.frameNo == 1) {
this.spawn(knobsAndLevers.mushrooms.initialAmount);
this.spawn(dials.mushrooms.initialAmount);
};
this.update();
},
......@@ -19,17 +19,17 @@ var mushrooms = {
coordinates = this.getCoordinates();
// while it is possible this will be an infinite loop
// it is unlikely so long as maxMushrooms is reasonable
if (coordinates.y > knobsAndLevers.player.topLimit) {
if (coordinates.y > dials.player.topLimit) {
continue;
};
this.make(coordinates, knobsAndLevers.mushrooms.color);
this.make(coordinates, dials.mushrooms.color);
};
},
make : function(coordinates, color) {
if (coordinates.x == undefined || coordinates.y == undefined) {
throw new Error('coordinate error: x: ' + coordinates.x + ', y: ' + coordinates.y);
};
color = color ? color : knobsAndLevers.mushrooms.color;
color = color ? color : dials.mushrooms.color;
coordinates.x = supporting.getClosest(game.gameArea.xVertices, coordinates.x);
coordinates.y = supporting.getClosest(game.gameArea.yVertices, coordinates.y);
let mushroom = this.generate(coordinates, color);
......@@ -39,9 +39,9 @@ var mushrooms = {
this.mushrooms.push(mushroom);
},
generate : function(coordinates, color) {
let mushroom = new Component(knobsAndLevers.mushrooms.args);
mushroom.x = coordinates.x + knobsAndLevers.mushrooms.scaleFactor,
mushroom.y = coordinates.y + knobsAndLevers.mushrooms.scaleFactor,
let mushroom = new Component(dials.mushrooms.args);
mushroom.x = coordinates.x + dials.mushrooms.scaleFactor,
mushroom.y = coordinates.y + dials.mushrooms.scaleFactor,
mushroom.pointValue = metrics.currentLevel;
return mushroom;
},
......
......@@ -2,13 +2,13 @@ players = {
currentSelection : undefined,
init : function() {
Object.assign(this, playersBase);
this.buildPlayers(game.numberOfPlayers, knobsAndLevers.player.args);
this.buildPlayers(game.numberOfPlayers, dials.player.args);
supporting.applyOverrides(this);
console.log('players initialized');
},
functionOverrides : {
setBoundaries : function(player) {
this.boundaries.belowTop = player.getTop() > knobsAndLevers.player.topLimit;
this.boundaries.belowTop = player.getTop() > dials.player.topLimit;
this.boundaries.insideRight = player.getRight() < game.gameArea.canvas.width;
this.boundaries.aboveBottom = player.getBottom() < game.gameArea.canvas.height;
this.boundaries.insideLeft = player.getLeft() > 0;
......
// abstract common knobsAndLevers and move them to canvas-libs
var knobsAndLevers = {
// abstract common dials and move them to canvas-libs
var dials = {
init : function() {
this.general.init(this);
this.centipede.init(this);
......@@ -10,7 +10,7 @@ var knobsAndLevers = {
this.spiders.init(this);
this.text.init(this);
this.worms.init(this);
console.log('knobsAndLevers initialized');
console.log('dials initialized');
},
resetCheats : function() {
this.lasers.resetCheats();
......@@ -88,12 +88,17 @@ var knobsAndLevers = {
components : {
imageTypes : ['centipede', 'flea', 'worm', 'mushroom', 'spider', 'player'],
},
dom : {
blogUrl : 'http://blog.matthewodle.com/category/centipede/',
sourceUrl : 'https://gitlab.com/taciturn-pachyderm/centipede',
gifLocation : 'app/static/media/images/background.gif',
},
fleas : {
maxNumber : 0,
pointValue : 200,
interval : {
min: 100,
max: 1000,
min: 1500,
max: 2500,
},
mushroomCreateInterval : 100,
args : {
......@@ -110,7 +115,7 @@ var knobsAndLevers = {
return 'one';
},
constructorFunctions : {
setX : function(flea) { flea.x = supporting.getRandom(0, knobsAndLevers.canvas.width) },
setX : function(flea) { flea.x = supporting.getRandom(0, dials.canvas.width) },
}
},
init : function(configs) {
......@@ -125,8 +130,8 @@ var knobsAndLevers = {
game : {
playerCollisionsEnabled : true,
interval : {
min : 0,
max : 0,
min : 1000,
max : 2500,
},
sounds : {
value : true,
......@@ -144,7 +149,7 @@ var knobsAndLevers = {
startLevel : 0,
maxMushrooms : 50,
tier : {
incrementScore : 2000,
incrementScore : 10000,
current: 1,
max : 5,
isMaxed : false,
......@@ -156,7 +161,7 @@ var knobsAndLevers = {
},
lasers : {
speed : {
value : 10,
value : 5,
default : 5,
setting : {
value : 15,
......@@ -168,7 +173,7 @@ var knobsAndLevers = {
},
},
quantity : {
value : 10,
value : 1,
default : 1,
setting : {
value : 5,
......@@ -190,8 +195,8 @@ var knobsAndLevers = {
console.log('laser defaults initialized');
},
resetCheats : function() {
knobsAndLevers.resetParameter(this.speed);
knobsAndLevers.resetParameter(this.quantity);
dials.resetParameter(this.speed);
dials.resetParameter(this.quantity);
},
},
mushrooms : {
......@@ -225,7 +230,7 @@ var knobsAndLevers = {
},
},
player : {
defaultLives : 1,
defaultLives : 3,
dimensions : {width : 30, height : 30},
args : {
width : 20,
......@@ -243,7 +248,7 @@ var knobsAndLevers = {
},
constructorFunctions : {
setX : function(player) {
player.x = knobsAndLevers.player.startX[Object.keys(players.players).length];
player.x = dials.player.startX[Object.keys(players.players).length];
},
},
},
......@@ -270,15 +275,15 @@ var knobsAndLevers = {
this.args.y = this.startY;
},
resetCheats : function() {
knobsAndLevers.resetParameter(this.speed);
dials.resetParameter(this.speed);
},
},
spiders : {
maxNumber : 0,
pointValue : 400,
interval : {
min : 10,
max : 20,
min : 500,
max : 1000,
},
args : {
directionY : 1,
......@@ -296,7 +301,7 @@ var knobsAndLevers = {
},
constructorFunctions : {
setY : function(spider) {
spider.y = supporting.getRandom(knobsAndLevers.player.topLimit - knobsAndLevers.player.areaHeight, game.gameArea.canvas.height);
spider.y = supporting.getRandom(dials.player.topLimit - dials.player.areaHeight, game.gameArea.canvas.height);
},
setX : function(spider) {
let theRoll = supporting.roll(sides = 2);
......@@ -348,8 +353,8 @@ var knobsAndLevers = {
maxNumber : 1,
pointValue : 200,
interval : {
min: 0,
max: 0,
min: 1500,
max: 2500,
},
args : {
extraArgs : {
......@@ -390,7 +395,7 @@ var knobsAndLevers = {
};
},
setY : function(worm) {
let randomYPos = supporting.getRandom(0, knobsAndLevers.player.topLimit - knobsAndLevers.player.areaHeight * 2);
let randomYPos = supporting.getRandom(0, dials.player.topLimit - dials.player.areaHeight * 2);
worm.y = supporting.getClosest(game.gameArea.yVertices, randomYPos);
},
},
......
var game = {
init : function() {
Object.assign(this, gameBase);
this.gameArea.init(knobsAndLevers);
this.gameArea.init(dials);
supporting.applyOverrides(this);
console.log('game initialized');
},
......@@ -20,7 +20,11 @@ var game = {
},
functionOverrides : {
gameLevelCheck : function() {
return centipedes.numberSpawned == centipedes.numberKilled && this.gameArea.frameNo;
let levelEnded =
(centipedes.numberSpawned > 0 || metrics.currentLevel == 0) &&
centipedes.numberSpawned == centipedes.numberKilled &&
this.gameArea.frameNo > 0;
return levelEnded;
},
},
};
......@@ -2,7 +2,7 @@ var init = {
run : function() {
console.log('start centipede init');
knobsAndLevers.init();
dials.init();
dom.init();
game.init();
......@@ -26,7 +26,7 @@ var init = {
},
afterGameOver : function() {
console.log('reset everything');
knobsAndLevers.init();
dials.init();
menus.init();
metrics.init();
texts.init();
......
......@@ -7,9 +7,7 @@
* init/runner.js accomplishes this.
*/
var libsPath = '../canvas-libs/app/scripts/';
// var libsPath = 'https://glcdn.githack.com/taciturn-pachyderm/canvas-libs/raw/v2.2.0/app/scripts/';
var scriptsPath = 'app/scripts/';
var libs = [
......@@ -48,7 +46,7 @@ var scripts = [
'components/players.js',
'game.js',
'init/init.js',
'knobs-and-levers.js',
'dials.js',
'main.js',
'properties/menus-props.js',
'sounds.js',
......@@ -63,7 +61,7 @@ function loadScript (path, file) {
var script = document.createElement("script");
script.src = path + file;
document[targetDomObject].appendChild(script);
console.log(script.src, 'added to', targetDomObject);
// console.log(script.src, 'added to', targetDomObject);
};
libs.forEach(file => loadScript(libsPath, file));
......
libsInit.run();
init.run();
try {
libsInit.run();
init.run();
} catch(err) {
window.location.href = window.location.href
};
......@@ -50,33 +50,33 @@ var menusProps = {
// TODO demigod - a ton of lives
laserQTY : {
update : function() {
this.text = knobsAndLevers.lasers.quantity.setting.render();
this.text = dials.lasers.quantity.setting.render();
},
action : function() {
knobsAndLevers.toggleParameter(knobsAndLevers.lasers.quantity);
game.activeCheats['laserQty'] = knobsAndLevers.lasers.quantity.setting.state == "ON";
dials.toggleParameter(dials.lasers.quantity);
game.activeCheats['laserQty'] = dials.lasers.quantity.setting.state == "ON";
this.update();
menus.display('cheats');
},
},
laserSpeed : {
update : function() {
this.text = knobsAndLevers.lasers.speed.setting.render();
this.text = dials.lasers.speed.setting.render();
},
action : function() {
knobsAndLevers.toggleParameter(knobsAndLevers.lasers.speed);
game.activeCheats['laserSpeed'] = knobsAndLevers.lasers.speed.setting.state == "ON";
dials.toggleParameter(dials.lasers.speed);
game.activeCheats['laserSpeed'] = dials.lasers.speed.setting.state == "ON";
this.update();
menus.display('cheats');
},
},
shipSpeed : {
update : function() {
this.text = knobsAndLevers.player.speed.setting.render();
this.text = dials.player.speed.setting.render();
},
action : function() {
knobsAndLevers.toggleParameter(knobsAndLevers.player.speed);
game.activeCheats['shipSpeed'] = knobsAndLevers.player.speed.setting.state == "ON";
dials.toggleParameter(dials.player.speed);
game.activeCheats['shipSpeed'] = dials.player.speed.setting.state == "ON";
this.update();
menus.display('cheats');
},
......@@ -84,7 +84,7 @@ var menusProps = {
reset : {
text : 'RESET',
action : function() {
knobsAndLevers.resetCheats();
dials.resetCheats();
menus.screens.cheats.update();
menus.display('cheats');
},
......@@ -151,8 +151,7 @@ var menusProps = {
if (game.activePlayers != game.numberOfPlayers) {
menus.display('playerActivate');
} else {
game.running = true;
game.paused = false;
game.run();
};
},
},
......@@ -199,8 +198,7 @@ var menusProps = {
text : '1 PLAYER',
action : function() {
menus.disableMenus();
game.running = true;
game.paused = false;
game.run();
game.numberOfPlayers = 1;
game.activePlayers = 1;
},
......@@ -248,12 +246,12 @@ var menusProps = {
// can't really do anything with centipede speed until the vertical movement logic gets
sound : {
update : function() {
this.text = knobsAndLevers.game.sounds.setting.render();
this.text = dials.game.sounds.setting.render();
},
action : function() {
knobsAndLevers.toggleParameter(knobsAndLevers.game.sounds);
dials.toggleParameter(dials.game.sounds);
this.update();
if (knobsAndLevers.game.sounds.value) {
if (dials.game.sounds.value) {
sounds.playAvailableLaserSound();
};
menus.display('settings');
......
......@@ -8,7 +8,7 @@ var sounds = {
died : {filename : 'player-died.mp3', volume : 0.3, qty : 1, pool : [], index : 0},
tierChange : {filename : 'tier-change.mp3', volume : 0.3, qty : 1, pool : [], index : 0},
laser : {filename : 'laser.mp3', volume : 0.3, qty : 20, pool : [], index : 0},
impact : {filename : 'laser-impact.mp3', volume : 0.3, qty : knobsAndLevers.lasers.quantity.value, pool : [], index : 0},
impact : {filename : 'laser-impact.mp3', volume : 0.3, qty : dials.lasers.quantity.value, pool : [], index : 0},
},
init : function() {
Object.assign(this, soundsBase);
......
......@@ -8,10 +8,10 @@ describe('COLLISIONS SPEC: ', () => {
});
beforeEach(function () {
testObj = Object.assign({}, collisions);
knobsAndLevers.init();
dials.init();
});
function createAnObjectFromLaserArgs() {
let laserArgs = knobsAndLevers.lasers.args;
let laserArgs = dials.lasers.args;
laserArgs.x = 10;
laserArgs.y = 10;
laserArgs.width = 10;
......@@ -137,7 +137,7 @@ describe('COLLISIONS SPEC: ', () => {
it('updateTargetAppearance adjusts height of target when target type is mushroom', () => {
let baseHeight = knobsAndLevers.mushroomSide;
let baseHeight = dials.mushroomSide;
let target1 = {type : 'mushroom', height : baseHeight};
let target2 = {type : 'somethingElse', height : baseHeight};
......@@ -191,7 +191,7 @@ describe('COLLISIONS SPEC: ', () => {
});
it('checkPlayerVsEnemies does not process if playerCollisions are disabled', () => {
knobsAndLevers.game.playerCollisionsEnabled = false;
dials.game.playerCollisionsEnabled = false;
game.gameOver = false;
player.init();
spyOn(player.gamePiece, 'crashWith').and.returnValue(true);
......@@ -205,7 +205,7 @@ describe('COLLISIONS SPEC: ', () => {
expect(game.gameOver).toBeFalsy();
});
it('checkPlayerVsEnemies calls killsPlayer if crashWith', () => {
knobsAndLevers.game.playerCollisionsEnabled = true;
dials.game.playerCollisionsEnabled = true;
game.gameOver = false;
player.init();
spyOn(player.gamePiece, 'crashWith').and.returnValue(true);
......@@ -220,7 +220,7 @@ describe('COLLISIONS SPEC: ', () => {
expect(game.gameOver).toBeFalsy();
});
it('checkGamePieceVsEnemy handles 0 length target list', () => {
knobsAndLevers.game.playerCollisionsEnabled = true;
dials.game.playerCollisionsEnabled = true;
game.gameOver = false;
player.init();
spyOn(player.gamePiece, 'crashWith').and.callThrough();
......
......@@ -8,7 +8,7 @@ describe('COMPONENT SPEC: ', () => {
});
beforeEach(function () {
component = constructComponent({});
knobsAndLevers.init();
dials.init();
game.init();
});
function constructComponent(args) {
......
......@@ -119,7 +119,7 @@ describe('CENTIPEDES SPEC: ', () => {
);
});
it('moveDownwardInitially sets moveVertically and updated to true if above first mushroom layer', () => {
knobsAndLevers.init();
dials.init();
game.init();
testObj.centipedes = [
{moveVertically : false, updated : false, y : game.gameArea.gridStart - 2},
......@@ -159,10 +159,10 @@ describe('CENTIPEDES SPEC: ', () => {
expect(testObj.centipedes[0].reverseDirectionY).toBe(true);
});
it('checkYDirectionInPlayerArea sets reverseDirectionY when hitting playerTopLimit while moving up', () => {
knobsAndLevers.init();
dials.init();
game.init();
player.init();
let top = knobsAndLevers.player.topLimit - 10;
let top = dials.player.topLimit - 10;
let bottom = top + 20;
testObj.centipedes = [
{
......@@ -181,7 +181,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(testObj.centipedes[0].reverseDirectionY).toBe(true);
});
it('checkHorizontalCollisions does not set moveVertically to true if no collisions', () => {
knobsAndLevers.init();
dials.init();
game.init();
spyOn(testObj, 'hasCollidedWithWall').and.returnValue(false);
spyOn(testObj, 'hasCollidedWithMushroom').and.returnValue(false);
......@@ -198,7 +198,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(centipede.updated).toBe(true);
});
it('checkHorizontalCollisions sets moveVertically to true if wall collisions', () => {
knobsAndLevers.init();
dials.init();
game.init();
spyOn(testObj, 'hasCollidedWithWall').and.returnValue(true);
spyOn(testObj, 'hasCollidedWithMushroom').and.returnValue(false);
......@@ -218,7 +218,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(centipede.moveVertically).toBe(true);
});
it('checkHorizontalCollisions sets moveVertically to true if mushroom collisions but not wall collisions', () => {
knobsAndLevers.init();
dials.init();
game.init();
spyOn(testObj, 'hasCollidedWithWall').and.returnValue(false);
spyOn(testObj, 'hasCollidedWithMushroom').and.returnValue(true);
......@@ -238,7 +238,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(centipede.moveVertically).toBe(true);
});
it('checkHorizontalCollisions does not update if distanceMovedY is not 0', () => {
knobsAndLevers.init();
dials.init();
game.init();
spyOn(testObj, 'hasCollidedWithWall').and.returnValue(false);
spyOn(testObj, 'hasCollidedWithMushroom').and.returnValue(false);
......@@ -255,7 +255,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(centipede.updated).toBe(false);
});
it('hasCollidedWithWall should return false if inside canvas sides and has moved horizontally', () => {
knobsAndLevers.init();
dials.init();
game.init();
let centipede = {
getLeft : function(){return 10;},
......@@ -269,7 +269,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(actual).toBe(expected);
});
it('hasCollidedWithWall should return true if outside canvas sides and has moved horizontally', () => {
knobsAndLevers.init();
dials.init();
game.init();
let centipede = {
getLeft : function(){return 10;},
......@@ -283,7 +283,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(actual).toBe(expected);
});
it('hasCollidedWithMushrooms does a whole bunch of crap I do not want to test', () => {
knobsAndLevers.init();
dials.init();
game.init();
mushrooms.mushrooms = [{y : 1}];
let crashWith = function(){return true;};
......@@ -321,7 +321,7 @@ describe('CENTIPEDES SPEC: ', () => {
});
it('reverseHorizontalAtNextLayer does stuff', () => {
knobsAndLevers.init();
dials.init();
game.init();
centipede = {
updated : false,
......@@ -338,7 +338,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(centipede.reverseDirectionX).toBe(true);
});
it('updateDirections does stuff', () => {
knobsAndLevers.init();
dials.init();
game.init();
testObj.centipedes = [
{
......@@ -371,7 +371,7 @@ describe('CENTIPEDES SPEC: ', () => {
expect(testObj.centipedes[1].reverseDirectionX).toBe(false);
});
it('updateCoordinates does stuff', () => {
knobsAndLevers.init();
dials.init();
game.init();