animated level load
animated new level load graphics for reactor and final level autoZoom code rewritten to work with pause better using the ephemera system this might cause bugs, I already found a few intro level renamed initial extra ammo power ups on why difficulty for final and reactor levels removed falling off the map damage on levels that still had falling off damage mob: stinger - has speed that adjusts as it flaps it's wings and a short range laser tech: strange loop - +9% damage, removing it gives null hypothesis and strange attractor tech: martingale - +11% damage, removing this has a 50% chance to not remove and to double it's damage paradigm shift removes 6 health when it ejects a tech, but now has a 85->97% chance to work ammo, heal, research tech spawn extra power ups after each time you take them tungsten carbide skin has a hexagon look and +222->300 max health Bayesian statistics spawn 3->6 research ansatz spawns 2->3 research if you have no research Ψ(t) collapse 16->21 research futures exchange 4.3->4.7% duplication replication 9->10 duplication stimulated emission 17->19% duplication anthropic principle spawn 5->16 heals when you die supply chain: no long gives JUNK instead triples the frequency of finding applied science electronegativity 0.22->0.26% damage per energy non-renewables 88->97% damage anticorrelation 100->111% damage decorrelation 70->77% defense parasitism 83->93% damage torpor 66->74% defense bug fix: recycling works with mass-energy (although it doesn't do much) ternary wasn't working in many situations, but it should now fixed bubble fusion exploit that triggers on mobs in factory endlessly bot fabrication was making 1 extra bot and giving negative research sometimes
This commit is contained in:
121
js/simulation.js
121
js/simulation.js
@@ -24,7 +24,6 @@ const simulation = {
|
||||
mobs.healthBar();
|
||||
m.draw();
|
||||
m.hold();
|
||||
// v.draw(); //working on visibility work in progress
|
||||
level.customTopLayer();
|
||||
simulation.draw.drawMapPath();
|
||||
b.fire();
|
||||
@@ -33,10 +32,8 @@ const simulation = {
|
||||
if (!m.isBodiesAsleep) b.bulletDo();
|
||||
simulation.drawCircle();
|
||||
simulation.runEphemera();
|
||||
// simulation.clip();
|
||||
ctx.restore();
|
||||
simulation.drawCursor();
|
||||
// simulation.pixelGraphics();
|
||||
},
|
||||
testingLoop() {
|
||||
simulation.gravity();
|
||||
@@ -505,47 +502,52 @@ const simulation = {
|
||||
simulation.zoom = canvas.height / zoomScale; //sets starting zoom scale
|
||||
},
|
||||
zoomTransition(newZoomScale, step = 2) {
|
||||
//old version
|
||||
// if (simulation.isAutoZoom) {
|
||||
// const isBigger = (newZoomScale - simulation.zoomScale > 0) ? true : false;
|
||||
// requestAnimationFrame(zLoop);
|
||||
// const currentLevel = level.onLevel
|
||||
|
||||
// function zLoop() {
|
||||
// if (currentLevel !== level.onLevel || simulation.isAutoZoom === false) return //stop the zoom if player goes to a new level
|
||||
|
||||
// if (isBigger) {
|
||||
// simulation.zoomScale += step
|
||||
// if (simulation.zoomScale >= newZoomScale) {
|
||||
// simulation.setZoom(newZoomScale);
|
||||
// return
|
||||
// }
|
||||
// } else {
|
||||
// simulation.zoomScale -= step
|
||||
// if (simulation.zoomScale <= newZoomScale) {
|
||||
// simulation.setZoom(newZoomScale);
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
// simulation.setZoom();
|
||||
// requestAnimationFrame(zLoop);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//rewrite using the ephemera system
|
||||
if (simulation.isAutoZoom) {
|
||||
const isBigger = (newZoomScale - simulation.zoomScale > 0) ? true : false;
|
||||
requestAnimationFrame(zLoop);
|
||||
const currentLevel = level.onLevel
|
||||
|
||||
function zLoop() {
|
||||
if (currentLevel !== level.onLevel || simulation.isAutoZoom === false) return //stop the zoom if player goes to a new level
|
||||
|
||||
if (isBigger) {
|
||||
simulation.ephemera.push({
|
||||
name: "zoom",
|
||||
count: simulation.testing ? 0 : 120, //cycles before it self removes
|
||||
currentLevel: level.onLevel,
|
||||
do() {
|
||||
this.count--
|
||||
const step = (newZoomScale - simulation.zoomScale) / this.count
|
||||
simulation.zoomScale += step
|
||||
if (simulation.zoomScale >= newZoomScale) {
|
||||
simulation.setZoom(newZoomScale);
|
||||
return
|
||||
if (this.count < 1 && this.currentLevel === level.onLevel && simulation.isAutoZoom) {
|
||||
simulation.zoomScale = newZoomScale
|
||||
simulation.removeEphemera(this.name)
|
||||
}
|
||||
} else {
|
||||
simulation.zoomScale -= step
|
||||
if (simulation.zoomScale <= newZoomScale) {
|
||||
simulation.setZoom(newZoomScale);
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
simulation.setZoom();
|
||||
requestAnimationFrame(zLoop);
|
||||
}
|
||||
}
|
||||
},
|
||||
zoomInFactor: 0,
|
||||
startZoomIn(time = 180) {
|
||||
simulation.zoom = 0;
|
||||
let count = 0;
|
||||
requestAnimationFrame(zLoop);
|
||||
|
||||
function zLoop() {
|
||||
simulation.zoom += canvas.height / simulation.zoomScale / time;
|
||||
count++;
|
||||
if (count < time) {
|
||||
requestAnimationFrame(zLoop);
|
||||
} else {
|
||||
simulation.setZoom();
|
||||
}
|
||||
simulation.setZoom(simulation.zoomScale);
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
translatePlayerAndCamera(where) {
|
||||
@@ -974,8 +976,8 @@ const simulation = {
|
||||
} else {
|
||||
Matter.Body.setVelocity(player, { x: 0, y: 0 });
|
||||
Matter.Body.setPosition(player, { x: level.enter.x + 50, y: level.enter.y - 20 });
|
||||
m.damage(0.05 * simulation.difficultyMode);
|
||||
m.energy -= 0.05 * simulation.difficultyMode
|
||||
// m.damage(0.02 * simulation.difficultyMode);
|
||||
// m.energy -= 0.02 * simulation.difficultyMode
|
||||
// move bots
|
||||
for (let i = 0; i < bullet.length; i++) {
|
||||
if (bullet[i].botType) {
|
||||
@@ -1003,15 +1005,28 @@ const simulation = {
|
||||
});
|
||||
}
|
||||
if (tech.isHealthRecovery) {
|
||||
const heal = 0.005 * m.maxHealth
|
||||
m.addHealth(heal)
|
||||
simulation.drawList.push({ //add dmg to draw queue
|
||||
x: m.pos.x,
|
||||
y: m.pos.y,
|
||||
radius: Math.sqrt(heal) * 150,
|
||||
color: "rgba(0,255,200,0.5)",
|
||||
time: 4
|
||||
});
|
||||
if (tech.isEnergyHealth) {
|
||||
if (m.immuneCycle < m.cycle) {
|
||||
m.energy += m.maxEnergy * 0.005
|
||||
simulation.drawList.push({ //add dmg to draw queue
|
||||
x: m.pos.x,
|
||||
y: m.pos.y,
|
||||
radius: Math.sqrt(m.maxEnergy * 0.02) * 60,
|
||||
color: "rgba(0, 204, 255,0.4)", //#0cf
|
||||
time: 4
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const heal = 0.005 * m.maxHealth
|
||||
m.addHealth(heal)
|
||||
simulation.drawList.push({ //add dmg to draw queue
|
||||
x: m.pos.x,
|
||||
y: m.pos.y,
|
||||
radius: Math.sqrt(heal) * 150,
|
||||
color: "rgba(0,255,200,0.5)",
|
||||
time: 4
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1355,7 +1370,7 @@ const simulation = {
|
||||
ctx.textAlign = "center";
|
||||
ctx.fillText(`(${simulation.mouseInGame.x.toFixed(1)}, ${simulation.mouseInGame.y.toFixed(1)})`, simulation.mouse.x, simulation.mouse.y - 20);
|
||||
},
|
||||
sight: { //credit to Cornbread for adding this algorithm to n-gon
|
||||
sight: { //credit to Cornbread2100 for adding this algorithm to n-gon
|
||||
// square: 0,
|
||||
intersectMap: [], //this is precalculated in simulation.draw.lineOfSightPrecalculation()
|
||||
getIntersection(v1, v1End, domain) {
|
||||
|
||||
Reference in New Issue
Block a user