Commit 82aae62a authored by Matthew Odle's avatar Matthew Odle

scale image size if random value is met

parent b090ac5e
......@@ -350,6 +350,11 @@ var knobsAndLevers = {
},
},
constructorFunctions : {
setImageType : function(worm) {
worm.imageType = Math.round(supporting.roll(10)) == 10 ? 1 : 2;
worm.width = worm.imageType == 1 ? worm.width * 5 : worm.width;
worm.height = worm.imageType == 1 ? worm.height * 5 : worm.height;
},
setX : function(worm) {
worm.speedX = supporting.getRandom(-1, 1) < 0 ? -1 : 1;
if (worm.speedX < 0) {
......@@ -362,10 +367,6 @@ var knobsAndLevers = {
let randomYPos = supporting.getRandom(0, knobsAndLevers.player.topLimit - knobsAndLevers.player.areaHeight);
worm.y = supporting.getClosest(game.gameArea.yVertices, randomYPos);
},
setImageType : function(worm) {
worm.imageType = Math.round(supporting.getRandom(0.5, 1.5));
console.log(worm.imageType);
},
},
},
init : function(configs) {
......
......@@ -25,7 +25,7 @@ var sounds = {
return soundArray;
},
manageSounds : function() {
if (!knobsAndLevers.game.sounds.value) {
if (!knobsAndLevers.game.sounds.value || !game.running) {
return;
};
this.manageCentipedeSounds();
......
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