diff --git a/game.js b/game.js index a51cda3..71f3d79 100644 --- a/game.js +++ b/game.js @@ -14,6 +14,29 @@ var victims = "Overpass": 0 } +function getOnePrey(area) +{ + var potential = ["Person", "Car", "Bus", "House", "Train", "Parking Garage"]; + + var potAreas = [] + + potential.forEach(function (x) { + potAreas.push([x,areas[x]]); + }); + + potAreas = potAreas.sort(function (x,y) { + return x[1] < y[1]; + }); + + for (var i=0; i 4) - prey = new Car(1); + var prey = getOnePrey(scale*scale*2) updateVictims(prey); line.innerHTML = prey.anal_vore(); log.appendChild(line); - var preyMass = prey.sum_property("mass") * 5; + var preyMass = prey.sum_property("mass"); scale = scaleAddMass(scale, baseMass, preyMass); update(); - - setTimeout(anal_vore, 4500); } function update() @@ -126,10 +141,24 @@ function update() } } +function pick_move() +{ + var choice = Math.random(); + + if (choice < 0.2) { + anal_vore(); + setTimeout(pick_move, 4000); + } else if (choice < 0.6) { + stomp(); + setTimeout(pick_move, 1500); + } else { + feed(); + setTimeout(pick_move, 2000); + } +} + window.addEventListener('load', function(event) { - setTimeout(feed, 2000); - setTimeout(stomp, 1250); - setTimeout(anal_vore, 4500); + setTimeout(pick_move, 2000); update(); });