more training levels

more training levels: "trainingWalk", "trainingCrouch", "trainingJump", "trainingHold", "trainingThrow", "trainingHit", "trainingHeal", "trainingFire", "trainingDeflect"

tech: Bose Einstein condensate is removed until I can balance it

bug fixes
This commit is contained in:
landgreen
2021-12-22 08:59:10 -08:00
parent 9dc5c8d456
commit bf7a22f243
9 changed files with 620 additions and 243 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -376,7 +376,7 @@ const b = {
if (m.immuneCycle < m.cycle) m.energy -= DRAIN if (m.immuneCycle < m.cycle) m.energy -= DRAIN
if (m.energy < 0) { if (m.energy < 0) {
m.energy = 0 m.energy = 0
m.damage(0.03 * (tech.isRadioactiveResistance ? 0.25 : 1)); if (simulation.dmgScale) m.damage(0.03 * (tech.isRadioactiveResistance ? 0.25 : 1));
} }
} }
@@ -423,9 +423,9 @@ const b = {
const harm = radius * (tech.isExplosionHarm ? 0.00055 : 0.00018) const harm = radius * (tech.isExplosionHarm ? 0.00055 : 0.00018)
if (tech.isImmuneExplosion) { if (tech.isImmuneExplosion) {
const mitigate = Math.min(1, Math.max(1 - m.energy * 0.5, 0)) const mitigate = Math.min(1, Math.max(1 - m.energy * 0.5, 0))
m.damage(mitigate * harm); if (simulation.dmgScale) m.damage(mitigate * harm);
} else { } else {
m.damage(harm); if (simulation.dmgScale) m.damage(harm);
} }
knock = Vector.mult(Vector.normalise(sub), -Math.sqrt(dmg) * player.mass * 0.013); knock = Vector.mult(Vector.normalise(sub), -Math.sqrt(dmg) * player.mass * 0.013);
player.force.x += knock.x; player.force.x += knock.x;
@@ -1084,7 +1084,7 @@ const b = {
if (m.immuneCycle < m.cycle) m.energy -= DRAIN if (m.immuneCycle < m.cycle) m.energy -= DRAIN
} else { } else {
m.energy = 0; m.energy = 0;
m.damage(tech.isRadioactiveResistance ? 0.00016 * 0.25 : 0.00016) //0.00015 if (simulation.dmgScale) m.damage(tech.isRadioactiveResistance ? 0.00016 * 0.25 : 0.00016) //0.00015
} }
} }
//aoe damage to mobs //aoe damage to mobs
@@ -1929,7 +1929,6 @@ const b = {
y: best.who.velocity.y * 0.7 y: best.who.velocity.y * 0.7
}); });
//draw mob damage circle //draw mob damage circle
console.log(dmg)
simulation.drawList.push({ simulation.drawList.push({
x: path[1].x, x: path[1].x,
y: path[1].y, y: path[1].y,
@@ -2928,7 +2927,7 @@ const b = {
if (m.immuneCycle < m.cycle) m.energy -= DRAIN if (m.immuneCycle < m.cycle) m.energy -= DRAIN
} else { } else {
m.energy = 0; m.energy = 0;
m.damage(tech.isRadioactiveResistance ? 0.00015 * 0.25 : 0.00015) //0.00015 if (simulation.dmgScale) m.damage(tech.isRadioactiveResistance ? 0.00015 * 0.25 : 0.00015) //0.00015
} }
} }
//aoe damage to mobs //aoe damage to mobs

View File

@@ -8,7 +8,7 @@ const level = {
onLevel: -1, onLevel: -1,
levelsCleared: 0, levelsCleared: 0,
playableLevels: ["labs", "rooftops", "skyscrapers", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"], playableLevels: ["labs", "rooftops", "skyscrapers", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"],
trainingLevels: ["trainingHold", "trainingThrow", "trainingCrouch", "trainingJump"], trainingLevels: ["trainingWalk", "trainingCrouch", "trainingJump", "trainingHold", "trainingThrow", "trainingHit", "trainingHeal", "trainingFire", "trainingDeflect"],
levels: [], levels: [],
start() { start() {
if (level.levelsCleared === 0) { //this code only runs on the first level if (level.levelsCleared === 0) { //this code only runs on the first level
@@ -17,11 +17,9 @@ const level = {
// localSettings.levelsClearedLastGame = 10 // localSettings.levelsClearedLastGame = 10
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why // level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// simulation.isHorizontalFlipped = true // simulation.isHorizontalFlipped = true
// m.setField("plasma torch") // m.setField("pilot wave")
// b.giveGuns("spores")
// b.giveGuns("nail gun")
// b.giveGuns("harpoon") // b.giveGuns("harpoon")
// tech.giveTech("nematodes") // tech.giveTech("Bose Einstein condensate")
// for (let i = 0; i < 9; i++) tech.giveTech("annelids") // for (let i = 0; i < 9; i++) tech.giveTech("annelids")
// tech.giveTech("tinsellated flagella") // tech.giveTech("tinsellated flagella")
// for (let i = 0; i < 2; i++) tech.giveTech("refractory metal") // for (let i = 0; i < 2; i++) tech.giveTech("refractory metal")
@@ -29,9 +27,9 @@ const level = {
// for (let i = 0; i < 1; i++) tech.giveTech("reticulum") // for (let i = 0; i < 1; i++) tech.giveTech("reticulum")
// for (let i = 0; i < 2; i++) tech.giveTech("laser-bot") // for (let i = 0; i < 2; i++) tech.giveTech("laser-bot")
// tech.tech[297].frequency = 100 // tech.tech[297].frequency = 100
// level.trainingThrow(); // level.trainingDeflect();
if (simulation.isTraining) { if (simulation.isTraining) {
level.trainingHold(); level.trainingWalk();
} else { } else {
level.intro(); //starting level level.intro(); //starting level
} }
@@ -136,7 +134,13 @@ const level = {
// for (let i = 0; i < 2; i++) powerUps.spawn(player.position.x + 90 * (Math.random() - 0.5), player.position.y + 90 * (Math.random() - 0.5), "tech", false); //start // for (let i = 0; i < 2; i++) powerUps.spawn(player.position.x + 90 * (Math.random() - 0.5), player.position.y + 90 * (Math.random() - 0.5), "tech", false); //start
} }
}, },
trainingJump() { //learn to crouch trainingText(say) {
simulation.lastLogTime = 0; //clear previous messages
simulation.makeTextLog(`<span style="font-size: 110%;line-height: 110%;"><span style="color:#51f;">supervised.learning</span>(<span style="color:#777; font-size: 80%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span><br>${say}</span>`, Infinity)
// lore.trainer.text("Wow. Just a platform.")
},
trainingBackgroundColor: "#e1e1e1",
trainingWalk() { //learn to walk
m.addHealth(Infinity) m.addHealth(Infinity)
document.getElementById("health").style.display = "none" //hide your health bar document.getElementById("health").style.display = "none" //hide your health bar
document.getElementById("health-bg").style.display = "none" document.getElementById("health-bg").style.display = "none"
@@ -149,20 +153,18 @@ const level = {
simulation.zoomScale = 1400 //1400 is normal simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400 level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1) simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = "#e1e1e1"; document.body.style.backgroundColor = level.trainingBackgroundColor
simulation.lastLogTime = 0; //clear previous messages simulation.lastLogTime = 0; //clear previous messages
let instruction = 0 let instruction = 0
simulation.makeTextLog(`hold down <strong>${input.key.up}</strong> longer to jump higher`, Infinity) level.trainingText(`move <strong>↔</strong> with <strong>${input.key.left.replace('Key', '').replace('Digit', '')}</strong> and <strong>${input.key.right.replace('Key', '').replace('Digit', '')}</strong>`)
level.custom = () => { level.custom = () => {
if (instruction === 0 && m.pos.x > 300) { if (instruction === 0 && input.right) {
instruction++ instruction++
simulation.lastLogTime = 0; //clear previous messages level.trainingText(`<s>move <strong>↔</strong> with <strong>${input.key.left.replace('Key', '').replace('Digit', '')}</strong> and <strong>${input.key.right.replace('Key', '').replace('Digit', '')}</strong></s>
simulation.makeTextLog(`<s>hold down <strong>${input.key.up}</strong> longer to jump higher</s>`, Infinity) <br>exit through the blue door`)
} }
m.health = 1 //can't die
//exit room //exit room
ctx.fillStyle = "#f2f2f2" ctx.fillStyle = "#f2f2f2"
ctx.fillRect(1600, -400, 400, 400) ctx.fillRect(1600, -400, 400, 400)
@@ -171,21 +173,20 @@ const level = {
level.playerExitCheck(); level.playerExitCheck();
}; };
level.customTopLayer = () => { level.customTopLayer = () => {
//dark
ctx.fillStyle = "rgba(0,0,0,0.2)"
ctx.fillRect(1000, 0, 450, 1800)
//exit room glow //exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)" ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -400, 400, 400) ctx.fillRect(1600, -400, 400, 400)
}; };
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall spawn.mapRect(-2750, -2800, 2600, 4600); //left wall
spawn.mapRect(2000, -2800, 2600, 4600); //right wall spawn.mapRect(2000, -2800, 2600, 4600); //right wall
spawn.mapRect(275, -350, 200, 375); spawn.mapRect(-250, 0, 3500, 1800); //floor
spawn.mapRect(-250, 0, 1250, 1800); spawn.mapRect(1575, 0, 500, 100);
spawn.mapRect(1450, 0, 1075, 1800);
spawn.mapRect(-250, -2800, 3500, 2200); //roof spawn.mapRect(-250, -2800, 3500, 2200); //roof
spawn.mapRect(700, -8, 50, 25);
spawn.mapRect(725, -16, 75, 25);
spawn.mapRect(1375, -16, 50, 50);
spawn.mapRect(1400, -8, 50, 25);
spawn.mapRect(750, -24, 650, 100);
spawn.mapRect(1600, -1200, 500, 850); //exit roof spawn.mapRect(1600, -1200, 500, 850); //exit roof
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
}, },
@@ -203,17 +204,14 @@ const level = {
simulation.zoomScale = 1400 //1400 is normal simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400 level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1) simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = "#e1e1e1"; document.body.style.backgroundColor = level.trainingBackgroundColor
simulation.lastLogTime = 0; //clear previous messages
let instruction = 0 let instruction = 0
simulation.makeTextLog(`press <strong>${input.key.down}</strong> to crouch`, Infinity) level.trainingText(`press <strong>${input.key.down.replace('Key', '').replace('Digit', '')}</strong> to crouch`)
level.custom = () => { level.custom = () => {
if (instruction === 0 && input.down) { if (instruction === 0 && input.down) {
instruction++ instruction++
simulation.lastLogTime = 0; //clear previous messages level.trainingText(`<s>press <strong>${input.key.down.replace('Key', '').replace('Digit', '')}</strong> to crouch</s>`)
simulation.makeTextLog(`<s>press <strong>${input.key.down}</strong> to crouch</s>`, Infinity)
} }
//exit room //exit room
ctx.fillStyle = "#f2f2f2" ctx.fillStyle = "#f2f2f2"
@@ -251,6 +249,131 @@ const level = {
spawn.mapRect(1600, -1200, 500, 850); //exit roof spawn.mapRect(1600, -1200, 500, 850); //exit roof
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
}, },
trainingJump() { //learn to jump
m.addHealth(Infinity)
document.getElementById("health").style.display = "none" //hide your health bar
document.getElementById("health-bg").style.display = "none"
level.setPosToSpawn(60, -50); //normal spawn
spawn.mapRect(10, -10, 100, 20); //small platform for player
level.exit.x = 1775;
level.exit.y = -35;
spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump
simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = level.trainingBackgroundColor
let instruction = 0
level.trainingText(`hold down <strong>${input.key.up.replace('Key', '').replace('Digit', '')}</strong> longer to jump higher`)
level.custom = () => {
if (instruction === 0 && m.pos.x > 300) {
instruction++
level.trainingText(`<s>hold down <strong>${input.key.up.replace('Key', '').replace('Digit', '')}</strong> longer to jump higher</s>`)
}
m.health = 1 //can't die
//exit room
ctx.fillStyle = "#f2f2f2"
ctx.fillRect(1600, -400, 400, 400)
level.exit.draw();
level.enter.draw();
level.playerExitCheck();
};
level.customTopLayer = () => {
//dark
ctx.fillStyle = "rgba(0,0,0,0.05)"
ctx.fillRect(1000, 0, 450, 1800)
ctx.fillRect(1000, -2800, 450, 2200)
//exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -400, 400, 400)
};
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall
spawn.mapRect(2000, -2800, 2600, 4600); //right wall
spawn.mapRect(275, -350, 200, 375);
spawn.mapRect(-250, 0, 1250, 1800); //floor
spawn.mapRect(1450, 0, 1075, 1800); //floor
spawn.mapRect(-250, -2800, 1250, 2200); //roof
spawn.mapRect(1450, -2800, 1075, 2200); //roof
spawn.mapVertex(375, 0, "150 0 -150 0 -100 -50 100 -50"); //base
spawn.mapRect(1600, -1200, 500, 850); //exit roof
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
},
trainingHold() { //put block on button to open door
m.addHealth(Infinity)
//hide your health bar
document.getElementById("health").style.display = "none"
document.getElementById("health-bg").style.display = "none"
level.setPosToSpawn(60, -50); //normal spawn
spawn.mapRect(10, -10, 100, 20); //small platform for player
level.exit.x = 1775;
level.exit.y = -35;
spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump
simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = level.trainingBackgroundColor
spawn.bodyRect(1025, -75, 50, 50); //block to go on button
const buttonDoor = level.button(500, 0)
const door = level.door(1612.5, -175, 25, 190, 185, 3)
let instruction = 0
level.trainingText(`activate your <strong class='color-f'>field</strong> with <strong>${input.key.field.replace('Key', '').replace('Digit', '')}</strong> or <strong>right mouse</strong>`)
level.custom = () => {
if (instruction === 0 && input.field) {
instruction++
level.trainingText(`<s>activate your <strong class='color-f'>field</strong> with <strong>${input.key.field.replace('Key', '').replace('Digit', '')}</strong> or <strong>right mouse</strong></s><br>release your <strong class='color-f'>field</strong> on a <strong class='color-block'>block</strong> to pick it up`)
} else if (instruction === 1 && m.isHolding) {
instruction++
level.trainingText(`<s>activate your <strong class='color-f'>field</strong> with <strong>${input.key.field.replace('Key', '').replace('Digit', '')}</strong> or <strong>right mouse</strong><br>release your <strong class='color-f'>field</strong> on a <strong class='color-block'>block</strong> to pick it up</s><br>drop the <strong class='color-block'>block</strong> on the red button to open the door`)
} else if (instruction === 2 && !buttonDoor.isUp && Vector.magnitudeSquared(Vector.sub(body[0].position, buttonDoor.min)) < 10000) {
instruction++
level.trainingText(`<s>activate your <strong class='color-f'>field</strong> with <strong>${input.key.field.replace('Key', '').replace('Digit', '')}</strong> or <strong>right mouse</strong><br>release your <strong class='color-f'>field</strong> on a <strong class='color-block'>block</strong> to pick it up<br>drop the <strong class='color-block'>block</strong> on the red button to open the door</s>`)
}
//exit room
ctx.fillStyle = "#f2f2f2"
ctx.fillRect(1600, -400, 400, 400)
level.exit.draw();
level.enter.draw();
level.playerExitCheck();
};
level.customTopLayer = () => {
buttonDoor.query();
buttonDoor.draw();
if (buttonDoor.isUp) {
door.isClosing = true
} else {
door.isClosing = false
}
door.openClose();
door.draw();
//exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -400, 400, 400)
};
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall
spawn.mapRect(2000, -2800, 2600, 4600); //right wall
spawn.mapRect(-250, 50, 3500, 1750); //floor
spawn.mapRect(-200, 0, 950, 100);
spawn.mapRect(1575, 0, 500, 100);
spawn.mapRect(-250, -2800, 3500, 2200); //roof
spawn.mapRect(725, 12, 50, 25);
spawn.mapRect(725, 25, 75, 25);
spawn.mapRect(750, 38, 75, 25);
spawn.mapRect(1525, 25, 75, 50);
spawn.mapRect(1500, 38, 50, 25);
spawn.mapRect(1550, 12, 50, 25);
spawn.mapRect(1600, -1200, 500, 850); //exit roof
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
},
trainingThrow() { //throw a block on button to open door trainingThrow() { //throw a block on button to open door
m.addHealth(Infinity) m.addHealth(Infinity)
//hide your health bar //hide your health bar
@@ -265,37 +388,32 @@ const level = {
simulation.zoomScale = 1400 //1400 is normal simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400 level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1) simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = "#e1e1e1"; document.body.style.backgroundColor = level.trainingBackgroundColor
spawn.bodyRect(1025, -75, 50, 50); //block to go on button spawn.bodyRect(1025, -75, 50, 50); //block to go on button
const buttonDoor = level.button(1635, -400) const buttonDoor = level.button(1635, -400)
const door = level.door(1612.5, -175, 25, 190, 185, 3) const door = level.door(1612.5, -175, 25, 190, 185, 3)
simulation.lastLogTime = 0; //clear previous messages
let instruction = 0 let instruction = 0
simulation.makeTextLog(`activate your <strong class='color-f'>field</strong> with <strong>space</strong> or <strong>right mouse</strong> level.trainingText(`activate your <strong class='color-f'>field</strong> with <strong>${input.key.field.replace('Key', '').replace('Digit', '')}</strong> or <strong>right mouse</strong>
<br>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong>`, Infinity) <br>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong>`)
level.custom = () => { level.custom = () => {
console.log(m.throwCharge)
if (instruction === 0 && m.isHolding) { if (instruction === 0 && m.isHolding) {
instruction++ instruction++
simulation.lastLogTime = 0; //clear previous messages level.trainingText(`<s>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong></s>
simulation.makeTextLog(`<s>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong></s> <br>hold your <strong class='color-f'>field</strong> down to charge up then release to throw a <strong class='color-block'>block</strong>`)
<br>hold your <strong class='color-f'>field</strong> down to charge up then release to throw a <strong class='color-block'>block</strong>`, Infinity)
} else if (instruction === 1 && m.throwCharge > 2) { } else if (instruction === 1 && m.throwCharge > 2) {
instruction++ instruction++
simulation.lastLogTime = 0; //clear previous messages level.trainingText(`<s>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong>
simulation.makeTextLog(`<s>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong>
<br>hold your <strong class='color-f'>field</strong> down to charge up then release to throw a <strong class='color-block'>block</strong></s> <br>hold your <strong class='color-f'>field</strong> down to charge up then release to throw a <strong class='color-block'>block</strong></s>
<br>throw the <strong class='color-block'>block</strong> onto the button`, Infinity) <br>throw the <strong class='color-block'>block</strong> onto the button`)
// the <strong class='color-block'>block</strong> at the button // the <strong class='color-block'>block</strong> at the button
} else if (instruction === 2 && !buttonDoor.isUp && Vector.magnitudeSquared(Vector.sub(body[0].position, buttonDoor.min)) < 10000) { } else if (instruction === 2 && !buttonDoor.isUp && Vector.magnitudeSquared(Vector.sub(body[0].position, buttonDoor.min)) < 10000) {
instruction++ instruction++
simulation.lastLogTime = 0; //clear previous messages level.trainingText(`<s>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong>
simulation.makeTextLog(`<s>pick up the <strong class='color-block'>block</strong> with your <strong class='color-f'>field</strong>
<br>hold your <strong class='color-f'>field</strong> down to charge up then release to throw a <strong class='color-block'>block</strong> <br>hold your <strong class='color-f'>field</strong> down to charge up then release to throw a <strong class='color-block'>block</strong>
<br>throw the <strong class='color-block'>block</strong> onto the button</s>`, Infinity) <br>throw the <strong class='color-block'>block</strong> onto the button</s>`)
} }
//exit room //exit room
ctx.fillStyle = "#f2f2f2" ctx.fillStyle = "#f2f2f2"
@@ -308,9 +426,9 @@ const level = {
buttonDoor.query(); buttonDoor.query();
buttonDoor.draw(); buttonDoor.draw();
if (buttonDoor.isUp) { if (buttonDoor.isUp) {
door.isOpen = true door.isClosing = true
} else { } else {
door.isOpen = false door.isClosing = false
} }
door.openClose(); door.openClose();
door.draw(); door.draw();
@@ -337,7 +455,7 @@ const level = {
spawn.mapRect(1625, -400, 400, 50); spawn.mapRect(1625, -400, 400, 50);
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
}, },
trainingHold() { //put block on button to open door trainingHit() { //throw a block at mob to open door
m.addHealth(Infinity) m.addHealth(Infinity)
//hide your health bar //hide your health bar
document.getElementById("health").style.display = "none" document.getElementById("health").style.display = "none"
@@ -351,29 +469,17 @@ const level = {
simulation.zoomScale = 1400 //1400 is normal simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400 level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1) simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = "#e1e1e1"; document.body.style.backgroundColor = level.trainingBackgroundColor
spawn.bodyRect(1025, -75, 50, 50); //block to go on button
const buttonDoor = level.button(500, 0)
const door = level.door(1612.5, -175, 25, 190, 185, 3) const door = level.door(1612.5, -175, 25, 190, 185, 3)
simulation.lastLogTime = 0; //clear previous messages
let instruction = 0 let instruction = 0
simulation.makeTextLog(`activate your <strong class='color-f'>field</strong> with <strong>space</strong> or <strong>right mouse</strong>`, Infinity) level.trainingText(`throw the <strong class='color-block'>block</strong> at the <strong>mobs</strong> to open the door`)
level.custom = () => { level.custom = () => {
if (instruction === 0 && input.field) { if (instruction === 0 && !mob.length) {
instruction++ instruction++
simulation.lastLogTime = 0; //clear previous messages level.trainingText(`<s>throw the <strong class='color-block'>block</strong> at the <strong>mobs</strong> to open the door</s>`)
simulation.makeTextLog(`<s>activate your <strong class='color-f'>field</strong> with <strong>space</strong> or <strong>right mouse</strong></s><br>release your <strong class='color-f'>field</strong> on a <strong class='color-block'>block</strong> to pick it up`, Infinity)
} else if (instruction === 1 && m.isHolding) {
instruction++
simulation.lastLogTime = 0; //clear previous messages
simulation.makeTextLog(`<s>activate your <strong class='color-f'>field</strong> with <strong>space</strong> or <strong>right mouse</strong><br>release your <strong class='color-f'>field</strong> on a <strong class='color-block'>block</strong> to pick it up</s><br>drop the <strong class='color-block'>block</strong> on the red button to open the door`, Infinity)
} else if (instruction === 2 && !buttonDoor.isUp && Vector.magnitudeSquared(Vector.sub(body[0].position, buttonDoor.min)) < 10000) {
instruction++
simulation.lastLogTime = 0; //clear previous messages
simulation.makeTextLog(`<s>activate your <strong class='color-f'>field</strong> with <strong>space</strong> or <strong>right mouse</strong><br>release your <strong class='color-f'>field</strong> on a <strong class='color-block'>block</strong> to pick it up<br>drop the <strong class='color-block'>block</strong> on the red button to open the door</s>`, Infinity)
} }
//exit room //exit room
ctx.fillStyle = "#f2f2f2" ctx.fillStyle = "#f2f2f2"
@@ -383,12 +489,10 @@ const level = {
level.playerExitCheck(); level.playerExitCheck();
}; };
level.customTopLayer = () => { level.customTopLayer = () => {
buttonDoor.query(); if (mob.length > 0) {
buttonDoor.draw(); door.isClosing = true
if (buttonDoor.isUp) {
door.isOpen = true
} else { } else {
door.isOpen = false door.isClosing = false
} }
door.openClose(); door.openClose();
door.draw(); door.draw();
@@ -410,9 +514,251 @@ const level = {
spawn.mapRect(1525, 25, 75, 50); spawn.mapRect(1525, 25, 75, 50);
spawn.mapRect(1500, 38, 50, 25); spawn.mapRect(1500, 38, 50, 25);
spawn.mapRect(1550, 12, 50, 25); spawn.mapRect(1550, 12, 50, 25);
// spawn.mapRect(1600, -1200, 500, 850); //exit roof
// spawn.mapRect(1790, -600, 250, 225); //button left wall
// spawn.mapRect(1625, -400, 400, 50);
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
spawn.mapRect(1600, -600, 425, 250);
spawn.bodyRect(1025, -75, 50, 50); //block to go on button
spawn.starter(425, -350, 35)
spawn.starter(800, -350, 44)
},
trainingHeal() { //learn to heal
m.addHealth(Infinity)
m.health = 0;
m.addHealth(0.25)
document.getElementById("health").style.display = "inline" //show your health bar
document.getElementById("health-bg").style.display = "inline"
level.setPosToSpawn(60, -50); //normal spawn
spawn.mapRect(10, -10, 100, 20); //small platform for player
level.exit.x = 1775;
level.exit.y = -35;
spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump
simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = level.trainingBackgroundColor
let instruction = 0
level.trainingText(`your <strong>health</strong> is displayed in the top left corner
<br>use your <strong class='color-f'>field</strong> to pick up ${powerUps.orb.heal(3)} until your <strong>health</strong> is full`)
level.custom = () => {
if (instruction === 0 && m.health === 1) {
instruction++
level.trainingText(`<s>use your <strong class='color-f'>field</strong> to pick up ${powerUps.orb.heal(3)} until your <strong>health</strong> is full</s>`)
}
//exit room
ctx.fillStyle = "#f2f2f2"
ctx.fillRect(1600, -400, 400, 400)
level.exit.draw();
level.enter.draw();
level.playerExitCheck();
};
level.customTopLayer = () => {
if (m.health !== 1) {
door.isClosing = true
} else {
door.isClosing = false
}
door.openClose();
door.draw();
//exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -400, 400, 400)
};
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall
spawn.mapRect(2000, -2800, 2600, 4600); //right wall
spawn.mapRect(-250, 0, 3500, 1800); //floor
spawn.mapRect(1575, 0, 500, 100);
spawn.mapRect(-250, -2800, 3500, 2200); //roof
spawn.mapRect(700, -8, 50, 25);
spawn.mapRect(725, -16, 75, 25);
spawn.mapRect(1375, -16, 50, 50);
spawn.mapRect(1400, -8, 50, 25);
spawn.mapRect(750, -24, 650, 100);
powerUps.directSpawn(875, -500, "heal", false, null, 15);
powerUps.directSpawn(1075, -500, "heal", false, null, 25);
powerUps.directSpawn(1275, -500, "heal", false, null, 35);
const door = level.door(1612.5, -175, 25, 190, 185, 3)
spawn.mapRect(1600, -1200, 500, 850); //exit roof spawn.mapRect(1600, -1200, 500, 850); //exit roof
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
}, },
trainingFire() { //throw a block at mob to open door
level.setPosToSpawn(60, -50); //normal spawn
spawn.mapRect(10, -10, 100, 20); //small platform for player
level.exit.x = 1775;
level.exit.y = 15;
spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump
simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = level.trainingBackgroundColor
const door = level.door(1612.5, -125, 25, 190, 185, 3)
const buttonDoor = level.button(400, 0)
let instruction = 0
level.trainingText(`use your <strong class='color-f'>field</strong> to pick up the gun power up`)
level.custom = () => {
if (instruction === 0 && simulation.isChoosing) {
instruction++
level.trainingText(`<s>use your <strong class='color-f'>field</strong> to pick up the gun power up</s>
<br>choose a <strong class='color-g'>gun</strong>`)
} else if (instruction === 1 && !simulation.isChoosing) {
instruction++
level.trainingText(`<s>use your <strong class='color-f'>field</strong> to pick up the gun power up
<br>choose a <strong class='color-g'>gun</strong></s>
<br>use the <strong>left mouse</strong> button to shoot the <strong>mobs</strong>`)
} else if (instruction === 2 && mob.length === 0) {
instruction++
level.trainingText(`<s>use your <strong class='color-f'>field</strong> to pick up the gun power up
<br>choose a <strong class='color-g'>gun</strong>
<br>use the <strong>left mouse</strong> button to shoot the <strong>mobs</strong></s>
<br>drop a <strong class='color-block'>block</strong> on the red button to open the door`)
} else if (instruction === 3 && !door.isClosing) {
instruction++
level.trainingText(`<s>use your <strong class='color-f'>field</strong> to pick up the gun power up
<br>choose a <strong class='color-g'>gun</strong>
<br>use the <strong>left mouse</strong> button to shoot the <strong>mobs</strong>
<br>put a <strong class='color-block'>block</strong> on the red button to open the door</s>`)
}
//spawn ammo if you run out
if (!powerUp.length && b.activeGun && b.guns[b.activeGun].ammo === 0 && door.isClosing) {
powerUps.directSpawn(1275, -500, "ammo");
}
//exit room
ctx.fillStyle = "#f2f2f2"
ctx.fillRect(1600, -350, 400, 400)
level.exit.draw();
level.enter.draw();
level.playerExitCheck();
};
level.customTopLayer = () => {
buttonDoor.query();
buttonDoor.draw();
if (buttonDoor.isUp) {
door.isClosing = true
} else {
door.isClosing = false
}
door.openClose();
door.draw();
//exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -350, 400, 400)
};
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall
spawn.mapRect(2000, -2800, 2600, 4600); //right wall
spawn.mapRect(-250, 50, 3500, 1750); //floor
spawn.mapRect(-200, 0, 950, 100);
spawn.mapRect(-250, -2800, 3500, 2200); //roof
//ceiling steps
spawn.mapRect(725, -588, 50, 25);
spawn.mapRect(725, -600, 75, 25);
spawn.mapRect(750, -612, 75, 25);
spawn.mapRect(-275, -650, 1025, 87);
spawn.mapRect(725, 12, 50, 25);
spawn.mapRect(725, 25, 75, 25);
spawn.mapRect(750, 38, 75, 25);
spawn.mapRect(1600, -600, 425, 300);
spawn.mapRect(1600, -400, 50, 275);
powerUps.directSpawn(1275, -500, "gun", false);
spawn.starter(900, -300, 35)
spawn.starter(1400, -400, 44)
},
trainingDeflect() { //learn to jump
m.addHealth(Infinity)
m.health = 1;
document.getElementById("health").style.display = "inline" //show your health bar
document.getElementById("health-bg").style.display = "inline"
level.setPosToSpawn(60, -50); //normal spawn
spawn.mapRect(10, -10, 100, 20); //small platform for player
level.exit.x = 1775;
level.exit.y = -35;
spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump
simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = level.trainingBackgroundColor
let instruction = 0
// activate your <strong class='color-f'>field</strong> with <strong>${input.key.field.replace('Key', '').replace('Digit', '')}</strong> or <strong>right mouse</strong>
level.trainingText(`use your <strong class='color-f'>field</strong> to <strong>deflect</strong> the <strong style="color:rgb(215,0,145);">mobs</strong>`)
level.custom = () => {
if (instruction === 0 && m.pos.x > 1350) {
instruction++
level.trainingText(`<s>use your <strong class='color-f'>field</strong> to <strong>deflect</strong> the <strong style="color:rgb(215,0,145);">mobs</strong></s>`)
}
//teleport to start if hit
if (m.immuneCycle > m.cycle) {
m.energy = m.maxEnergy
Matter.Body.setPosition(player, { x: 60, y: -50 })
}
//spawn bullets
if (!(simulation.cycle % 5)) {
spawn.sniperBullet(660 + 580 * Math.random(), -2000, 10, 4);
const who = mob[mob.length - 1]
Matter.Body.setVelocity(who, { x: 0, y: 8 });
who.timeLeft = 300
}
//exit room
ctx.fillStyle = "#f2f2f2"
ctx.fillRect(1600, -400, 400, 400)
level.exit.draw();
level.enter.draw();
level.playerExitCheck();
};
level.customTopLayer = () => {
//dark
ctx.fillStyle = "rgba(0,0,0,0.05)"
// ctx.fillRect(450, -2800, 1025, 2200)
//exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -400, 400, 400)
};
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall
spawn.mapRect(2000, -2800, 2600, 4600); //right wall
spawn.mapRect(-250, 0, 3000, 1800); //floor
spawn.mapRect(-250, -2800, 900, 2200); //roof
spawn.mapRect(1250, -2800, 1275, 2200); //roof
spawn.mapVertex(950, 0, "400 0 -400 0 -300 -50 300 -50"); //base
spawn.mapRect(1600, -1200, 500, 850); //exit roof
spawn.mapRect(1600, -400, 50, 225); //exit room left upper wall
//spawn bullets on load to avoid sprint
//spawn bullets
for (let i = 0; i < 32; i++) {
spawn.sniperBullet(660 + 580 * Math.random(), -2000 + 40 * i, 10, 4);
const who = mob[mob.length - 1]
Matter.Body.setVelocity(who, { x: 0, y: 8 });
who.timeLeft = 300
}
},
trainingTemplate() { //learn to crouch trainingTemplate() { //learn to crouch
m.addHealth(Infinity) m.addHealth(Infinity)
document.getElementById("health").style.display = "none" //hide your health bar document.getElementById("health").style.display = "none" //hide your health bar
@@ -426,17 +772,17 @@ const level = {
simulation.zoomScale = 1400 //1400 is normal simulation.zoomScale = 1400 //1400 is normal
level.defaultZoom = 1400 level.defaultZoom = 1400
simulation.zoomTransition(level.defaultZoom, 1) simulation.zoomTransition(level.defaultZoom, 1)
document.body.style.backgroundColor = "#e1e1e1"; document.body.style.backgroundColor = level.trainingBackgroundColor
simulation.lastLogTime = 0; //clear previous messages
let instruction = 0 let instruction = 0
simulation.makeTextLog(`press <strong>${input.key.down}</strong> to crouch`, Infinity) level.trainingText(`press <strong>${input.key.down.replace('Key', '').replace('Digit', '')}</strong> to crouch`)
level.custom = () => { level.custom = () => {
if (instruction === 0 && input.down) { if (instruction === 0 && input.down) {
instruction++ instruction++
simulation.lastLogTime = 0; //clear previous messages
simulation.makeTextLog(`<s>press <strong>${input.key.down}</strong> to crouch</s>`, Infinity) level.trainingText(`<s>press <strong>${input.key.down.replace('Key', '').replace('Digit', '')}</strong> to crouch</s>`)
} }
//exit room //exit room
ctx.fillStyle = "#f2f2f2" ctx.fillStyle = "#f2f2f2"
@@ -530,17 +876,34 @@ const level = {
// <br><span class='color-var'>m</span>.field.description = "<span class='color-text'>${m.fieldUpgrades[m.fieldMode].description}</span>" // <br><span class='color-var'>m</span>.field.description = "<span class='color-text'>${m.fieldUpgrades[m.fieldMode].description}</span>"
// `, 1200); // `, 1200);
}, },
disableExit: false,
nextLevel() { nextLevel() {
if (!level.disableExit) {
level.levelsCleared++; level.levelsCleared++;
// level.difficultyIncrease(simulation.difficultyMode) //increase difficulty based on modes
//difficulty is increased 5 times when finalBoss dies
// const len = level.levelsCleared / level.levels.length //add 1 extra difficulty step for each time you have cleared all the levels
// for (let i = 0; i < len; i++)
level.difficultyIncrease(simulation.difficultyMode)
level.onLevel++; //cycles map to next level level.onLevel++; //cycles map to next level
if (simulation.isTraining) {
if (level.onLevel > level.levels.length - 1) {
level.disableExit = true
document.getElementById("health").style.display = "none"
document.getElementById("health-bg").style.display = "none"
document.getElementById("text-log").style.opacity = 0; //fade out any active text logs
document.getElementById("fade-out").style.opacity = 1; //slowly fades out
setTimeout(function() {
simulation.paused = true;
level.disableExit = false;
engine.world.bodies.forEach((body) => { Matter.Composite.remove(engine.world, body) })
Engine.clear(engine);
simulation.splashReturn();
}, 6000);
return
} else {
level.setDifficulty()
}
} else {
if (level.onLevel > level.levels.length - 1) level.onLevel = 0; if (level.onLevel > level.levels.length - 1) level.onLevel = 0;
level.difficultyIncrease(simulation.difficultyMode)
}
//reset lost tech display //reset lost tech display
for (let i = 0; i < tech.tech.length; i++) { for (let i = 0; i < tech.tech.length; i++) {
if (tech.tech[i].isLost) tech.tech[i].isLost = false; if (tech.tech[i].isLost) tech.tech[i].isLost = false;
@@ -548,6 +911,7 @@ const level = {
tech.isDeathAvoidedThisLevel = false; tech.isDeathAvoidedThisLevel = false;
simulation.updateTechHUD(); simulation.updateTechHUD();
simulation.clearNow = true; //triggers in simulation.clearMap to remove all physics bodies and setup for new map simulation.clearNow = true; //triggers in simulation.clearMap to remove all physics bodies and setup for new map
}
}, },
populateLevels() { populateLevels() {
if (simulation.isTraining) { if (simulation.isTraining) {
@@ -1076,18 +1440,10 @@ const level = {
friction: 1, friction: 1,
frictionStatic: 1, frictionStatic: 1,
restitution: 0, restitution: 0,
isOpen: false, isClosing: false,
openClose() { openClose() {
if (!m.isBodiesAsleep) { if (!m.isBodiesAsleep) {
if (!this.isOpen) { if (this.isClosing) {
if (this.position.y > y - distance) { //try to open
const position = {
x: this.position.x,
y: this.position.y - speed
}
Matter.Body.setPosition(this, position)
}
} else {
if (this.position.y < y) { //try to close if (this.position.y < y) { //try to close
if ( if (
Matter.Query.collides(this, [player]).length === 0 && Matter.Query.collides(this, [player]).length === 0 &&
@@ -1101,6 +1457,14 @@ const level = {
Matter.Body.setPosition(this, position) Matter.Body.setPosition(this, position)
} }
} }
} else {
if (this.position.y > y - distance) { //try to open
const position = {
x: this.position.x,
y: this.position.y - speed
}
Matter.Body.setPosition(this, position)
}
} }
} }
}, },
@@ -3178,9 +3542,9 @@ const level = {
buttonDoor.query(); buttonDoor.query();
buttonDoor.draw(); buttonDoor.draw();
if (buttonDoor.isUp) { if (buttonDoor.isUp) {
door.isOpen = true door.isClosing = true
} else { } else {
door.isOpen = false door.isClosing = false
} }
door.openClose(); door.openClose();
@@ -4927,9 +5291,9 @@ const level = {
button.query(); button.query();
button.draw(); button.draw();
if (button.isUp) { if (button.isUp) {
door.isOpen = true door.isClosing = true
} else { } else {
door.isOpen = false door.isClosing = false
} }
door.openClose(); door.openClose();
ctx.fillStyle = "#ccc" ctx.fillStyle = "#ccc"
@@ -5064,9 +5428,9 @@ const level = {
button.query(); button.query();
button.draw(); button.draw();
if (button.isUp) { if (button.isUp) {
door.isOpen = true door.isClosing = true
} else { } else {
door.isOpen = false door.isClosing = false
} }
door.openClose(); door.openClose();
ctx.fillStyle = "#ccc" ctx.fillStyle = "#ccc"
@@ -5320,15 +5684,15 @@ const level = {
buttonPlateformEnd.query(); buttonPlateformEnd.query();
// hazard.query(); //bug reported from discord? // hazard.query(); //bug reported from discord?
if (buttonDoor.isUp) { if (buttonDoor.isUp) {
door.isOpen = false door.isClosing = false
} else { } else {
door.isOpen = true door.isClosing = true
} }
door.openClose(); door.openClose();
if (buttonPlateformEnd.isUp) { if (buttonPlateformEnd.isUp) {
doorPlateform.isOpen = true; doorPlateform.isClosing = true;
} else { } else {
doorPlateform.isOpen = false; doorPlateform.isClosing = false;
} }
door.openClose(); door.openClose();
doorPlateform.openClose(); doorPlateform.openClose();
@@ -5616,7 +5980,7 @@ const level = {
let buttonSortieSalle let buttonSortieSalle
let portalEnBas let portalEnBas
let portalEnHaut let portalEnHaut
let door3isOpen = false; let door3isClosing = false;
function drawOnTheMapMapRect(x, y, dx, dy) { function drawOnTheMapMapRect(x, y, dx, dy) {
spawn.mapRect(x, y, dx, dy); spawn.mapRect(x, y, dx, dy);
@@ -5839,7 +6203,7 @@ const level = {
// me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs // me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs
// this.removeCons(); //remove constraint // this.removeCons(); //remove constraint
// spawnCouloirEnHaut() // spawnCouloirEnHaut()
// doorSortieSalle.isOpen = false; // doorSortieSalle.isClosing = false;
// }; // };
// if (simulation.difficulty > 4) spawn.nodeGroup(8000, 630, "spawns", 8, 20, 105); // if (simulation.difficulty > 4) spawn.nodeGroup(8000, 630, "spawns", 8, 20, 105);
// } else { // } else {
@@ -5853,11 +6217,11 @@ const level = {
if (me) { if (me) {
me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs
spawnCouloirEnHaut() spawnCouloirEnHaut()
doorSortieSalle.isOpen = false; doorSortieSalle.isClosing = false;
}; };
} else { } else {
spawnCouloirEnHaut() spawnCouloirEnHaut()
doorSortieSalle.isOpen = false; doorSortieSalle.isClosing = false;
} }
// } // }
} else { } else {
@@ -5869,11 +6233,11 @@ const level = {
if (me) { if (me) {
me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs me.onDeath = function() { //please don't edit the onDeath function this causes serious bugs
spawnCouloirEnHaut() spawnCouloirEnHaut()
doorSortieSalle.isOpen = false; doorSortieSalle.isClosing = false;
}; };
} else { } else {
spawnCouloirEnHaut() spawnCouloirEnHaut()
doorSortieSalle.isOpen = false; doorSortieSalle.isClosing = false;
} }
} }
}, },
@@ -5982,24 +6346,24 @@ const level = {
buttonBedroom.draw(); buttonBedroom.draw();
if (buttonBedroom.isUp) { if (buttonBedroom.isUp) {
if (hasAlreadyBeenActivated == false) { if (hasAlreadyBeenActivated == false) {
doorBedroom.isOpen = true; doorBedroom.isClosing = true;
doorGrenier.isOpen = true; doorGrenier.isClosing = true;
voletLucarne1.isOpen = true; voletLucarne1.isClosing = true;
voletLucarne2.isOpen = true; voletLucarne2.isClosing = true;
voletLucarne3.isOpen = true; voletLucarne3.isClosing = true;
voletLucarne4.isOpen = true; voletLucarne4.isClosing = true;
voletLucarne5.isOpen = true; voletLucarne5.isClosing = true;
voletLucarne6.isOpen = true; voletLucarne6.isClosing = true;
} }
} else { } else {
doorBedroom.isOpen = false; doorBedroom.isClosing = false;
doorGrenier.isOpen = false; doorGrenier.isClosing = false;
voletLucarne1.isOpen = false; voletLucarne1.isClosing = false;
voletLucarne2.isOpen = false; voletLucarne2.isClosing = false;
voletLucarne3.isOpen = false; voletLucarne3.isClosing = false;
voletLucarne4.isOpen = false; voletLucarne4.isClosing = false;
voletLucarne5.isOpen = false; voletLucarne5.isClosing = false;
voletLucarne6.isOpen = false; voletLucarne6.isClosing = false;
if (hasAlreadyBeenActivated == false) { if (hasAlreadyBeenActivated == false) {
hasAlreadyBeenActivated = true; hasAlreadyBeenActivated = true;
} }
@@ -6891,8 +7255,8 @@ const level = {
const drip1 = level.drip(1875, -660, -400, 70) const drip1 = level.drip(1875, -660, -400, 70)
const drip2 = level.drip(3525, -940, -400, 150) const drip2 = level.drip(3525, -940, -400, 150)
const drip3 = level.drip(1975, 100, 1200, 100) const drip3 = level.drip(1975, 100, 1200, 100)
door.isOpen = true; door.isClosing = true;
exitDoor.isOpen = true; exitDoor.isClosing = true;
// UPPER AREA // // UPPER AREA //
spawn.mapRect(4500, -2400, 1700, 2050) spawn.mapRect(4500, -2400, 1700, 2050)
@@ -7031,7 +7395,7 @@ const level = {
if (simulation.difficulty > 3) { if (simulation.difficulty > 3) {
spawn.randomLevelBoss(1900, 400, ["shieldingBoss", "shooterBoss", "launcherBoss", "streamBoss"]) spawn.randomLevelBoss(1900, 400, ["shieldingBoss", "shooterBoss", "launcherBoss", "streamBoss"])
} else { } else {
exitDoor.isOpen = false; exitDoor.isClosing = false;
} }
spawn.secondaryBossChance(800, -800) spawn.secondaryBossChance(800, -800)
@@ -7103,9 +7467,9 @@ const level = {
} }
if (g && y && r) { if (g && y && r) {
door.isOpen = false; door.isClosing = false;
} else { } else {
door.isOpen = true; door.isClosing = true;
} }
door.openClose() door.openClose()
@@ -7146,11 +7510,11 @@ const level = {
nextBlockSpawn = simulation.cycle + Math.floor(Math.random() * 60 + 30) nextBlockSpawn = simulation.cycle + Math.floor(Math.random() * 60 + 30)
} }
if (exitDoor.isOpen) { if (exitDoor.isClosing) {
exitDoor.isOpen = false; exitDoor.isClosing = false;
for (i = 0; i < mob.length; i++) { for (i = 0; i < mob.length; i++) {
if (mob[i].isBoss && 525 < mob[i].position.x < 3200 && -2500 < mob[i].position.y < 100) { if (mob[i].isBoss && 525 < mob[i].position.x < 3200 && -2500 < mob[i].position.y < 100) {
exitDoor.isOpen = true; exitDoor.isClosing = true;
} }
} }
} }
@@ -7858,7 +8222,7 @@ const level = {
return a || ((Math.sqrt((i.position.x - 3600) * (i.position.x - 3600) + (i.position.y + 3600) * (i.position.y + 3600)) < 20000) && i.isDropPowerUp); return a || ((Math.sqrt((i.position.x - 3600) * (i.position.x - 3600) + (i.position.y + 3600) * (i.position.y + 3600)) < 20000) && i.isDropPowerUp);
}, false) && !emergencyActivated; }, false) && !emergencyActivated;
door.isOpen = hasMob; door.isClosing = hasMob;
door.openClose(); door.openClose();
ctx.fillStyle = "#444444" + secretRoomTrans.toString(16); ctx.fillStyle = "#444444" + secretRoomTrans.toString(16);

View File

@@ -52,6 +52,18 @@ const lore = {
sound.portamento(83.333) sound.portamento(83.333)
sound.portamento(166.666) sound.portamento(166.666)
}, },
trainer: {
color: "#f20",
voice: undefined,
text: function(say) {
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
lore.talkingColor = this.color
const utterance = new SpeechSynthesisUtterance(say);
utterance.lang = "en-AU" //"en-IN"; //de-DE en-GB fr-FR en-US en-AU
utterance.volume = 0.2; // 0 to 1
speechSynthesis.speak(utterance);
},
},
anand: { anand: {
color: "#e0c", color: "#e0c",
voice: undefined, voice: undefined,

View File

@@ -1446,14 +1446,17 @@ const m = {
} }
} }
} }
if (tech.isFreezeMobs) { // if (tech.isFreezeMobs) {
for (let i = 0, len = mob.length; i < len; ++i) { // for (let i = 0, len = mob.length; i < len; ++i) {
Matter.Sleeping.set(mob[i], false) // const ICE_DRAIN = 0.0005
mobs.statusSlow(mob[i], 60) // if (m.energy > ICE_DRAIN) m.energy -= ICE_DRAIN;
} // Matter.Sleeping.set(mob[i], false)
} else { // mobs.statusSlow(mob[i], 60)
// }
// } else {
// wake(mob);
// }
wake(mob); wake(mob);
}
wake(body); wake(body);
wake(bullet); wake(bullet);
for (let i = 0, len = cons.length; i < len; i++) { for (let i = 0, len = cons.length; i < len; i++) {
@@ -1909,20 +1912,20 @@ const m = {
y: player.velocity.y * 0.98 y: player.velocity.y * 0.98
}); });
} }
if (tech.isFreezeMobs) { // if (tech.isFreezeMobs) {
const ICE_DRAIN = 0.0002 // const ICE_DRAIN = 0.0005
for (let i = 0, len = mob.length; i < len; i++) { // for (let i = 0, len = mob.length; i < len; i++) {
if (((mob[i].distanceToPlayer() + mob[i].radius) < this.fieldDrawRadius) && !mob[i].shield && !mob[i].isShielded) { // if (!mob[i].isMobBullet && !mob[i].shield && !mob[i].isShielded && ((mob[i].distanceToPlayer() + mob[i].radius) < this.fieldDrawRadius)) {
if (m.energy > ICE_DRAIN * 2) { // if (m.energy > ICE_DRAIN * 2) {
m.energy -= ICE_DRAIN; // m.energy -= ICE_DRAIN;
this.fieldDrawRadius -= 2; // this.fieldDrawRadius -= 2;
mobs.statusSlow(mob[i], 60) // mobs.statusSlow(mob[i], 60)
} else { // } else {
break; // break;
} // }
} // }
} // }
} // }
//draw zero-G range //draw zero-G range
ctx.beginPath(); ctx.beginPath();
@@ -2809,13 +2812,15 @@ const m = {
if (tech.isFreezeMobs) { // if (tech.isFreezeMobs) {
for (let i = 0, len = mob.length; i < len; ++i) { // for (let i = 0, len = mob.length; i < len; ++i) {
if (Vector.magnitude(Vector.sub(mob[i].position, m.fieldPosition)) < m.fieldRadius) { // if (!mob[i].isMobBullet && !mob[i].shield && !mob[i].isShielded && Vector.magnitude(Vector.sub(mob[i].position, m.fieldPosition)) < m.fieldRadius + mob[i].radius) {
mobs.statusSlow(mob[i], 180) // const ICE_DRAIN = 0.0005
} // if (m.energy > ICE_DRAIN) m.energy -= ICE_DRAIN;
} // mobs.statusSlow(mob[i], 180)
} // }
// }
// }
ctx.beginPath(); ctx.beginPath();
const rotate = m.cycle * 0.008; const rotate = m.cycle * 0.008;

View File

@@ -598,6 +598,13 @@ const simulation = {
document.body.style.cursor = "none"; document.body.style.cursor = "none";
document.body.style.overflow = "hidden" document.body.style.overflow = "hidden"
} }
if (isTrainingRun) {
simulation.isTraining = true
simulation.isNoPowerUps = true
} else {
simulation.isTraining = false
simulation.isNoPowerUps = false;
}
simulation.onTitlePage = false; simulation.onTitlePage = false;
// document.getElementById("choose-grid").style.display = "none" // document.getElementById("choose-grid").style.display = "none"
document.getElementById("choose-grid").style.visibility = "hidden" document.getElementById("choose-grid").style.visibility = "hidden"
@@ -621,12 +628,11 @@ const simulation = {
} else { } else {
Composite.add(engine.world, [player]) Composite.add(engine.world, [player])
} }
if (isTrainingRun) simulation.isTraining = true
level.populateLevels() level.populateLevels()
input.endKeySensing(); input.endKeySensing();
b.removeAllGuns(); b.removeAllGuns();
simulation.isNoPowerUps = false;
tech.setupAllTech(); //sets tech to default values tech.setupAllTech(); //sets tech to default values
tech.cancelCount = 0; tech.cancelCount = 0;
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun for (i = 0, len = b.guns.length; i < len; i++) { //find which gun

View File

@@ -3374,7 +3374,7 @@ const tech = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
frequency: 1, frequency: 1,
frequencyDefault: 100, frequencyDefault: 1,
isNonRefundable: true, isNonRefundable: true,
isBadRandomOption: true, isBadRandomOption: true,
allowed() { allowed() {
@@ -4972,7 +4972,7 @@ const tech = {
}, },
{ {
name: "mutualism", name: "mutualism",
description: "increase <strong class='color-p' style='letter-spacing: 2px;'>spore</strong> <strong class='color-d'>damage</strong> by <strong>150%</strong><br><strong class='color-p' style='letter-spacing: 2px;'>spores</strong> borrow <strong>0.5</strong> <strong class='color-h'>health</strong> until they <strong>die</strong>", description: "increase <strong class='color-p' style='letter-spacing: 2px;'>spore</strong> <strong class='color-d'>damage</strong> by <strong>150%</strong><br><strong class='color-p' style='letter-spacing: 2px;'>spores</strong> borrow <strong>0.5</strong> <strong>health</strong> until they <strong>die</strong>",
isGunTech: true, isGunTech: true,
maxCount: 1, maxCount: 1,
count: 0, count: 0,
@@ -6114,25 +6114,25 @@ const tech = {
tech.isFlyFaster = false; tech.isFlyFaster = false;
} }
}, },
{ // {
name: "Bose Einstein condensate", // name: "Bose Einstein condensate",
description: "<strong>mobs</strong> inside your <strong class='color-f'>field</strong> are <strong class='color-s'>frozen</strong><br><em style = 'font-size: 100%'>pilot wave, negative mass, time dilation</em>", // description: "use <strong class='color-f'>energy</strong> to <strong class='color-s'>freeze</strong> <strong>mobs</strong> in your <strong class='color-f'>field</strong><br><em style = 'font-size: 100%'>pilot wave, negative mass, time dilation</em>",
isFieldTech: true, // isFieldTech: true,
maxCount: 1, // maxCount: 1,
count: 0, // count: 0,
frequency: 2, // frequency: 2,
frequencyDefault: 2, // frequencyDefault: 2,
allowed() { // allowed() {
return m.fieldUpgrades[m.fieldMode].name === "pilot wave" || m.fieldUpgrades[m.fieldMode].name === "negative mass" || (m.fieldUpgrades[m.fieldMode].name === "time dilation" && !tech.isRewindField) // return m.fieldUpgrades[m.fieldMode].name === "pilot wave" || m.fieldUpgrades[m.fieldMode].name === "negative mass" || (m.fieldUpgrades[m.fieldMode].name === "time dilation" && !tech.isRewindField)
}, // },
requires: "pilot wave, negative mass, time dilation, not retrocausality", // requires: "pilot wave, negative mass, time dilation, not retrocausality",
effect() { // effect() {
tech.isFreezeMobs = true // tech.isFreezeMobs = true
}, // },
remove() { // remove() {
tech.isFreezeMobs = false // tech.isFreezeMobs = false
} // }
}, // },
{ {
name: "pair production", name: "pair production",
description: "picking up a <strong>power up</strong> gives you <strong>200</strong> <strong class='color-f'>energy</strong>", description: "picking up a <strong>power up</strong> gives you <strong>200</strong> <strong class='color-f'>energy</strong>",
@@ -7272,7 +7272,7 @@ const tech = {
}, },
{ {
name: "density", name: "density",
description: `<strong class='color-block'>block</strong> are <strong>100</strong> times less <strong>dense</strong>`, description: `<strong class='color-block'>block</strong> are <strong>10</strong> times less <strong>dense</strong>`,
maxCount: 1, maxCount: 1,
count: 0, count: 0,
frequency: 0, frequency: 0,
@@ -7282,14 +7282,15 @@ const tech = {
allowed() { return true }, allowed() { return true },
requires: "", requires: "",
effect() { effect() {
for (let i = 0; i < body.length; i++) Matter.Body.setDensity(body[i], 0.00001) //set current blocks to low density for (let i = 0; i < body.length; i++) Matter.Body.setDensity(body[i], 0.0001) //set current blocks to low density
level.addToWorld = () => { level.addToWorld = () => {
for (let i = 0; i < body.length; i++) { for (let i = 0; i < body.length; i++) {
if (body[i] !== m.holdingTarget && !body[i].isNoSetCollision) { if (body[i] !== m.holdingTarget && !body[i].isNoSetCollision) {
body[i].collisionFilter.category = cat.body; body[i].collisionFilter.category = cat.body;
body[i].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet body[i].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
} }
Matter.Body.setDensity(body[i], 0.00001) //THIS IS THE ONLY ADDED LINE OF CODE Matter.Body.setDensity(body[i], 0.0001) //THIS IS THE ONLY ADDED LINE OF CODE
body[i].classType = "body"; body[i].classType = "body";
Composite.add(engine.world, body[i]); //add to world Composite.add(engine.world, body[i]); //add to world
} }

View File

@@ -131,10 +131,15 @@ summary {
#training-button { #training-button {
position: absolute; position: absolute;
bottom: 58px; bottom: 4px;
right: 4px; right: 0px;
left: 0px;
margin: auto;
/* bottom: 58px; */
/* right: 4px; */
z-index: 12; z-index: 12;
transition: opacity 5s ease-in; transition: opacity 5s ease-in;
} }
#construct { #construct {

View File

@@ -1,50 +1,41 @@
******************************************************** NEXT PATCH ************************************************** ******************************************************** NEXT PATCH **************************************************
first 4 levels of the training maps are live more training levels: "trainingWalk", "trainingCrouch", "trainingJump", "trainingHold", "trainingThrow", "trainingHit", "trainingHeal", "trainingFire", "trainingDeflect"
this is very much a work in progress, but I'm putting it up for feedback
stunned and frozen mobs do no harm by default tech: Bose Einstein condensate is removed until I can balance it
removed tech: osmoprotectant - stunned and frozen mobs do no harm
tech: annelids - randomly increase worm size and damage up to 100% bug fixes
weak anthropic principle gives 45->50% duplication chance after almost dieing
complex spin-statistics immune to harm for 1.5->1.8 s every 7 s
exciton gives 60->66% damage
electronegativity gives 1% dmg for every 11->10 stored energy
arsenal gives 14->12% more damage per gun
pair production is now also a standing wave field tech
mass-energy takes 10% less damage
JUNK tech black hole cluster spawns mobs farther away, so you have a better chance to survive
undefinded tech no longer shows up on your first couple times playing, since it's a distraction for new players
******************************************************** TODO ******************************************************** ******************************************************** TODO ********************************************************
door.openClose(); is flipped T/F
balance time dilation with bose einstein (you can freeze everything and take no damage) balance time dilation with bose einstein (you can freeze everything and take no damage)
code is still there, need to balance
balance with energy drain?
training training
button takes you to a series of levels that teach simple game mechanics
make the button more obvious if the account has only played 1-2 times make the button more obvious if the account has only played 1-2 times
at high levels has some puzzle aspects?
uses the lore voice/text code? uses the lore voice/text code?
save training level progress as local variable add vertical tunnels for power ups spawns like in intro?
rooms: tutorial rooms:
jump over wall and gap done walk forwards and backwards
crouch through tunnel done crouch through tunnel
push block onto button to open door done jump over wall and gap
pick up a block an drop onto a button to open door done pick up a block an drop onto a button to open door
fire block at button to open door done fire block at button to open door
fire block at mob to open door done fire block at mob to open door
pick up power ups with field to open door done pick up heal power ups with field to open door
use gun to kill a mob and use it's block body to activate a button to open a door done use a gun to kill a mob and use it's block body to activate a button to open a door
use field to deflect a mob that is stationary, but blocking a passage done use field to deflect bullets
set health to very low use field to pick up a field and research
final room, takes you back to the menu, like when winning the game research once to open door
puzzle or combat rooms? puzzle rooms
save training level progress as local variable if puzzles are added
combat rooms:
boss gauntlet, spawn with nothing but a few power ups and fight 10 bosses boss gauntlet, spawn with nothing but a few power ups and fight 10 bosses
JUNK tech disable level exit for 5 minutes
level.disableExit = true
setTimeout( () => {level.disableExit = false;}, 5*60000);
tech: basic research - heal power ups spawn as research power ups instead, and using research heals you (needs to be pretty low, like 3% health) tech: basic research - heal power ups spawn as research power ups instead, and using research heals you (needs to be pretty low, like 3% health)
tech: maintenance - heals no longer spawn, but using research heals you 100% tech: maintenance - heals no longer spawn, but using research heals you 100%
@@ -67,6 +58,7 @@ electric motors: increases movement speed and jump height, but jumping and movin
JUNK tech? JUNK tech?
mob that fires bullets in 4,5,6,7 different directions at once, no aiming mob that fires bullets in 4,5,6,7 different directions at once, no aiming
grow a bit before it fires to indicate state
bug once: switching from shotgun to harpoon somehow set b.activeGun to not defined bug once: switching from shotgun to harpoon somehow set b.activeGun to not defined
https://discord.com/channels/645222059647172618/646505973610971165/919116288008290324 https://discord.com/channels/645222059647172618/646505973610971165/919116288008290324
@@ -103,13 +95,6 @@ mob/boss that fires a laser at player, but give player time to avoid
they target where player was 1 second ago they target where player was 1 second ago
they turn to face player? they turn to face player?
dart: a new bullet type for string-less harpoons
can turn harder
dart, draw quick line to indicate targeting
can get new targets?
tech: dart - alt fire several small harpoons, with guidance
requires not railgun
tech: open a new tab for n-gon, spawn things in the original game based on events in new game tech: open a new tab for n-gon, spawn things in the original game based on events in new game
if you die in new die in original? if you die in new die in original?
new is n-gon classic? new is n-gon classic?
@@ -361,7 +346,7 @@ blue triangle boss can move backwards and aim away from you if set up properly
mouse event e.which is deprecated mouse event e.which is deprecated
fix door.isOpen actually meaning isClosed? fix door.isClosing actually meaning isClosed?
make it so that when you are immune to harm you can either jump on mobs or you pass through them make it so that when you are immune to harm you can either jump on mobs or you pass through them