diff --git a/.DS_Store b/.DS_Store
index 91b905c..2229428 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/js/bullet.js b/js/bullet.js
index 2d85fd0..e3af1fc 100644
--- a/js/bullet.js
+++ b/js/bullet.js
@@ -1371,7 +1371,7 @@ const b = {
requestAnimationFrame(() => { who.isShielded = true });
}
if (tech.fragments) {
- b.targetedNail(this.vertices[2], tech.fragments * 4)
+ b.targetedNail(this.vertices[2], tech.fragments * 3)
if (!isReturn) this.endCycle = 0;
}
if (!who.isBadTarget) {
@@ -5650,7 +5650,7 @@ const b = {
Matter.Body.setVelocity(this, { x: -0.4 * this.velocity.x, y: -0.4 * this.velocity.y });
} else {
if (tech.fragments && this.speed > 10) {
- b.targetedNail(this.position, tech.fragments * 17)
+ b.targetedNail(this.position, tech.fragments * 13)
this.endCycle = 0 //triggers despawn
}
}
diff --git a/js/index.js b/js/index.js
index 89ed114..99eb0a9 100644
--- a/js/index.js
+++ b/js/index.js
@@ -154,6 +154,11 @@ window.addEventListener('load', () => {
}
if (property === "level") document.getElementById("starting-level").value = Math.max(Number(set[property]) - 1, 0)
if (property === "noPower") document.getElementById("no-power-ups").checked = Number(set[property])
+ // if (property === "seed") {
+ // document.getElementById("seed").placeholder = Math.initialSeed = String(set[property])
+ // Math.seed = Math.abs(Math.hash(Math.initialSeed))
+ // level.populateLevels()
+ // }
}
} else if (localSettings.isTrainingNotAttempted && localSettings.runCount < 30) { //make training button more obvious for new players
// document.getElementById("training-button").style.border = "0px #333 solid";
@@ -555,6 +560,7 @@ ${simulation.isCheating ? "
lore disabled": ""}
},
shareURL(isCustom = false) {
let url = "https://landgreen.github.io/sidescroller/index.html?"
+ url += `&seed=${Math.initialSeed}`
let count = 0;
for (let i = 0; i < b.inventory.length; i++) {
if (b.guns[b.inventory[i]].have) {
@@ -585,16 +591,12 @@ ${simulation.isCheating ? "
lore disabled": ""}
navigator.clipboard.writeText(url).then(function() {
/* clipboard successfully set */
if (isCustom) {
- setTimeout(function() {
- alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
- }, 300);
+ setTimeout(function() { alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.') }, 300);
}
}, function() {
/* clipboard write failed */
if (isCustom) {
- setTimeout(function() {
- alert('copy failed')
- }, 300);
+ setTimeout(function() { alert('copy failed') }, 300);
}
console.log('copy failed')
});
diff --git a/js/level.js b/js/level.js
index 238bb2d..3ee2458 100644
--- a/js/level.js
+++ b/js/level.js
@@ -14,22 +14,23 @@ const level = {
levels: [],
start() {
if (level.levelsCleared === 0) { //this code only runs on the first level
- // m.immuneCycle = Infinity //you can't take damage
- // localSettings.levelsClearedLastGame = 10
- // level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// simulation.isHorizontalFlipped = true
// m.setField("standing wave")
// b.giveGuns("harpoon")
// for (let i = 0; i < 100; i++) tech.giveTech("slow light")
- // tech.giveTech("recycling")
+ // tech.giveTech("tungsten carbide")
// for (let i = 0; i < 2; i++) powerUps.directSpawn(0, 0, "tech");
// tech.giveTech("tinsellated flagella")
// for (let i = 0; i < 3; i++) tech.giveTech("undefined")
- // tech.giveTech("nail-bot")
+ // tech.giveTech("decoherence")
+ // for (let i = 10; i < tech.tech.length; i++) { tech.tech[i].isBanished = true }
+ // powerUps.research.changeRerolls(100000)
// for (let i = 0; i < 1; i++) tech.giveTech("reticulum")
// for (let i = 0; i < 2; i++) tech.giveTech("laser-bot")
// tech.tech[297].frequency = 100
+ // m.immuneCycle = Infinity //you can't take damage
+ // level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// simulation.enableConstructMode() //used to build maps in testing mode
// level.reactor();
// level.testing(); //not in rotation, used for testing
@@ -220,7 +221,7 @@ const level = {
simulation.clearNow = true; //triggers in simulation.clearMap to remove all physics bodies and setup for new map
}
},
- populateLevels() {
+ populateLevels() { //run a second time if URL is loaded
if (document.getElementById("seed").value) {
Math.initialSeed = String(document.getElementById("seed").value)
Math.seed = Math.abs(Math.hash(Math.initialSeed)) //update randomizer seed in case the player changed it
@@ -250,7 +251,9 @@ const level = {
}
}
//set seeded random lists of mobs and bosses
+ spawn.mobTypeSpawnOrder = []
for (let i = 0; i < level.levels.length; i++) spawn.mobTypeSpawnOrder.push(spawn.fullPickList[Math.floor(Math.seededRandom(0, spawn.fullPickList.length))])
+ spawn.bossTypeSpawnOrder = []
for (let i = 0; i < level.levels.length * 2; i++) spawn.bossTypeSpawnOrder.push(spawn.randomBossList[Math.floor(Math.seededRandom(0, spawn.randomBossList.length))])
},
flipHorizontal() {
@@ -2609,25 +2612,33 @@ const level = {
document.body.style.backgroundColor = "#d0d5df" //"#d8dadf";
// powerUps.spawnStartingPowerUps(1475, -1175);
// spawn.debris(750, -2200, 3700, 16); //16 debris per level
- spawn.mapRect(-1525, -2825, 1250, 3925);
+ spawn.mapRect(-1525, -2825, 1250, 4925);
spawn.mapRect(-400, -2025, 625, 925);
spawn.mapRect(-400, -750, 625, 1200);
- spawn.mapRect(-425, 0, 4200, 1100);
+ // spawn.mapVertex(200, 0, "-200 0 -100 -100 100 -100 200 0");
+ spawn.bodyRect(225, -100, 100, 100, 0.5);
+ spawn.bodyRect(225, -200, 75, 100, 0.5);
+ spawn.bodyRect(325, -70, 150, 70, 1);
+ spawn.bodyRect(-275, -850, 75, 100, 0.4);
+ spawn.bodyRect(1525, -100, 100, 100, 0.3);
+ spawn.bodyRect(2325, -50, 125, 50, 0.3);
+ spawn.bodyRect(2375, -100, 50, 50, 0.3);
+ for (let i = 0; i < 3; ++i) powerUps.spawn(400 + 2000 * Math.random(), -25, "ammo");
+
+ spawn.mapRect(-425, 0, 4200, 2100);
spawn.mapRect(175, -1250, 50, 300);
spawn.mapRect(-475, -2825, 4250, 1025);
// spawn.mapRect(1200, -1300, 600, 800);
const a = 400 //side length
const c = 100 //corner offset
- spawn.mapVertex(1487, -900, `${-a} ${-a+c} ${-a+c} ${-a} ${a-c} ${-a} ${a} ${-a+c} ${a} ${a-c} ${a-c} ${a} ${-a+c} ${a} ${-a} ${a-c}`); //square with edges cut off
+ spawn.mapVertex(1487, -900, `${-a} ${-a+c} ${-a+c} ${-a} ${a-c} ${-a} ${a} ${-a+c} ${a} ${a-c} ${a-c} ${a} ${-a+c} ${a} ${-a} ${a-c}`); //square with edges cut off
//exit
- spawn.mapRect(3300, -2825, 1125, 3925);
+ spawn.mapRect(3300, -2825, 1125, 4925);
spawn.mapRect(2750, -2150, 1025, 1775);
spawn.mapRect(2750, -475, 50, 300);
-
-
// spawn.bodyRect(1540, -1110, 300, 25, 0.9);
// spawn.randomSmallMob(1300, -70);
// spawn.randomMob(2650, -975, 0.8);
@@ -2651,6 +2662,8 @@ const level = {
let isSpawnedBoss = false
level.custom = () => {
+ // player.force.y -= player.mass * simulation.g * 0.4; //float player
+
if (isDoorsLocked) {
if (!isFightOver && !(simulation.cycle % 120)) { //once a second
let isFoundBoss = false
@@ -2665,7 +2678,6 @@ const level = {
doorIn.isClosing = false
doorOut.isClosing = false
powerUps.spawnBossPowerUp(2900, -100)
- for (let i = 0; i < 3; ++i) powerUps.spawn(2900 + 30 * i, -300, "ammo");
}
}
@@ -2688,12 +2700,19 @@ const level = {
doorOut.isClosing = true
if (!isSpawnedBoss) {
isSpawnedBoss = true
- for (let i = 0, len = simulation.difficulty / 20; i < len; ++i) spawn.bounceBoss(1487 + 300 * i, -1525, 80, false);
+ if (Math.random() > 0.5) {
+ for (let i = 0, len = Math.min(simulation.difficulty / 20, 5); i < len; ++i) spawn.bounceBoss(1487 + 200 * i, -1525, 80, false);
+ } else {
+ for (let i = 0, len = Math.min(simulation.difficulty / 10, 10); i < len; ++i) spawn.sprayBoss(2400 - 150 * i, -225, 30, false)
+ }
+ // for (let i = 0, len = 3 + simulation.difficulty / 20; i < len; ++i) spawn.mantisBoss(1487 + 300 * i, -1525, 35, false)
}
}
doorIn.openClose();
doorOut.openClose();
+ ctx.fillStyle = "#d5ebef"
+ ctx.fillRect(2750, -375, 550, 375)
level.enter.draw();
level.exit.drawAndCheck();
};
@@ -2704,6 +2723,10 @@ const level = {
// }
doorIn.draw();
doorOut.draw();
+ ctx.fillStyle = "rgba(0,0,0,0.05)"
+ ctx.fillRect(-275, -1100, 500, 350);
+ // ctx.fillStyle = "rgba(0,255,255,0.1)"
+ // ctx.fillRect(2750, -375, 550, 375)
};
// if (simulation.difficulty > 1) spawn.randomLevelBoss(2200, -1300);
powerUps.addResearchToLevel() //needs to run after mobs are spawned
diff --git a/js/mob.js b/js/mob.js
index 035b3c0..9545ada 100644
--- a/js/mob.js
+++ b/js/mob.js
@@ -1180,7 +1180,7 @@ const mobs = {
powerUps.spawn(this.position.x, this.position.y, "tech", false)
// if (0.5 < Math.random()) powerUps.spawn(this.position.x, this.position.y, "tech", false)
} else {
- const amount = 0.005
+ const amount = 0.0045
if (tech.isEnergyHealth) {
if (m.maxEnergy > amount) {
tech.healMaxEnergyBonus -= amount
diff --git a/js/powerup.js b/js/powerup.js
index c131884..beb02df 100644
--- a/js/powerup.js
+++ b/js/powerup.js
@@ -304,7 +304,14 @@ const powerUps = {
const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
for (let i = 0; i < banishLength; i++) {
const index = powerUps.tech.choiceLog.length - i - 1
- if (powerUps.tech.choiceLog[index] !== undefined) tech.tech[powerUps.tech.choiceLog[index]].isBanished = true
+ if (powerUps.tech.choiceLog[index] && tech.tech[powerUps.tech.choiceLog[index]]) {
+ tech.tech[powerUps.tech.choiceLog[index]].isBanished = true
+ } else { //if no tech options available eject banish tech
+ for (let i = 0, len = tech.tech.length; i < len; i++) {
+ if (tech.tech[i].name === "decoherence") powerUps.ejectTech(i)
+ }
+ powerUps.endDraft("tech");
+ }
}
simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - banishLength)}`)
}
@@ -397,7 +404,18 @@ const powerUps = {
const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
for (let i = 0; i < banishLength; i++) {
const index = powerUps.tech.choiceLog.length - i - 1
- if (powerUps.tech.choiceLog[index] !== undefined || powerUps.tech.choiceLog[index] !== null) tech.tech[powerUps.tech.choiceLog[index]].isBanished = true
+ // console.log(index)
+ // console.log(powerUps.tech.choiceLog.length)
+ // console.log(powerUps.tech.choiceLog[index])
+ // console.log(tech.tech[powerUps.tech.choiceLog[index]])
+ if (powerUps.tech.choiceLog[index] && tech.tech[powerUps.tech.choiceLog[index]]) {
+ tech.tech[powerUps.tech.choiceLog[index]].isBanished = true
+ } else { //if no tech options available eject banish tech
+ for (let i = 0, len = tech.tech.length; i < len; i++) {
+ if (tech.tech[i].name === "decoherence") powerUps.ejectTech(i)
+ }
+ powerUps.endDraft("tech");
+ }
}
simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - banishLength)}`)
}
@@ -686,6 +704,7 @@ const powerUps = {
if (!tech.isSuperDeterminism) text += `