more work on immortaility
This commit is contained in:
42
js/player.js
42
js/player.js
@@ -364,7 +364,21 @@ const mech = {
|
|||||||
b.setModDefaults();
|
b.setModDefaults();
|
||||||
b.modText();
|
b.modText();
|
||||||
|
|
||||||
|
|
||||||
|
function randomizeField() {
|
||||||
|
if (game.levelsCleared > 5) {
|
||||||
|
mech.fieldUpgrades[Math.floor(Math.random() * (mech.fieldUpgrades.length))].effect();
|
||||||
|
} else {
|
||||||
|
mech.fieldUpgrades[0].effect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mech.addHealth(1);
|
||||||
|
spawn.setSpawnList(); //new mob types
|
||||||
|
game.clearNow = true; //triggers a map reset
|
||||||
|
|
||||||
//randomize guns
|
//randomize guns
|
||||||
|
function randomizeGuns() {
|
||||||
b.activeGun = null;
|
b.activeGun = null;
|
||||||
b.inventory = []; //removes guns and ammo
|
b.inventory = []; //removes guns and ammo
|
||||||
for (let i = 0, len = b.guns.length; i < len; ++i) {
|
for (let i = 0, len = b.guns.length; i < len; ++i) {
|
||||||
@@ -376,29 +390,21 @@ const mech = {
|
|||||||
if (game.levelsCleared > 3) powerUps.gun.effect();
|
if (game.levelsCleared > 3) powerUps.gun.effect();
|
||||||
if (game.levelsCleared > 6) powerUps.gun.effect();
|
if (game.levelsCleared > 6) powerUps.gun.effect();
|
||||||
game.makeGunHUD();
|
game.makeGunHUD();
|
||||||
|
|
||||||
//randomize field
|
|
||||||
|
|
||||||
if (game.levelsCleared > 5) {
|
|
||||||
mech.fieldUpgrades[Math.floor(Math.random() * (mech.fieldUpgrades.length))].effect();
|
|
||||||
} else {
|
|
||||||
mech.fieldUpgrades[0].effect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mech.addHealth(1);
|
|
||||||
spawn.setSpawnList();
|
|
||||||
game.clearNow = true;
|
|
||||||
|
|
||||||
game.wipe = function () { //set wipe to have trails
|
game.wipe = function () { //set wipe to have trails
|
||||||
ctx.fillStyle = "rgba(255,255,255,0.01)";
|
ctx.fillStyle = "rgba(255,255,255,0.005)";
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
randomizeGuns()
|
||||||
for (let i = 0; i < 7; i++) {
|
for (let i = 0; i < 7; i++) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
game.makeTextLog(`<div style='opacity:0.3;'> probability amplitude will synchronize in ${7-i} seconds</div>`, 1000);
|
randomizeGuns()
|
||||||
|
randomizeField()
|
||||||
|
game.makeTextLog(`probability amplitude will synchronize in ${7-i} seconds`, 1000);
|
||||||
game.wipe = function () { //set wipe to have trails
|
game.wipe = function () { //set wipe to have trails
|
||||||
ctx.fillStyle = `rgba(255,255,255,${(i+1)*0.04})`;
|
ctx.fillStyle = `rgba(255,255,255,${(i+1)*(i+1)*0.003})`;
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
}, (i + 1) * 1000);
|
}, (i + 1) * 1000);
|
||||||
@@ -408,8 +414,8 @@ const mech = {
|
|||||||
game.wipe = function () { //set wipe to normal
|
game.wipe = function () { //set wipe to normal
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
game.makeTextLog("<div style='opacity:0.5;'><strong>Quantum Immortality</strong> has stabilized your probability amplitude<br>welcome to your new reality</div>", 1000);
|
game.makeTextLog("your quantum probability has stabilized", 1000);
|
||||||
document.title = "n-gon: L" + (game.levelsCleared) + " " + level.levels[level.onLevel] + " version 2";
|
document.title = "n-gon: L" + (game.levelsCleared) + " " + level.levels[level.onLevel];
|
||||||
}, 8000);
|
}, 8000);
|
||||||
|
|
||||||
} else if (this.alive) { //normal death code here
|
} else if (this.alive) { //normal death code here
|
||||||
@@ -1391,9 +1397,7 @@ const mech = {
|
|||||||
this.hip.x = 12 + offset;
|
this.hip.x = 12 + offset;
|
||||||
this.hip.y = 24 + offset;
|
this.hip.y = 24 + offset;
|
||||||
//stepSize goes to zero if Vx is zero or not on ground (make this transition cleaner)
|
//stepSize goes to zero if Vx is zero or not on ground (make this transition cleaner)
|
||||||
this.stepSize =
|
this.stepSize = 0.8 * this.stepSize + 0.2 * (7 * Math.sqrt(Math.min(9, Math.abs(this.Vx))) * this.onGround);
|
||||||
0.8 * this.stepSize +
|
|
||||||
0.2 * (7 * Math.sqrt(Math.abs(this.Vx)) * this.onGround);
|
|
||||||
//changes to stepsize are smoothed by adding only a percent of the new value each cycle
|
//changes to stepsize are smoothed by adding only a percent of the new value each cycle
|
||||||
const stepAngle = 0.034 * this.walk_cycle + cycle_offset;
|
const stepAngle = 0.034 * this.walk_cycle + cycle_offset;
|
||||||
this.foot.x = 2.2 * this.stepSize * Math.cos(stepAngle) + offset;
|
this.foot.x = 2.2 * this.stepSize * Math.cos(stepAngle) + offset;
|
||||||
|
|||||||
Reference in New Issue
Block a user