quenching

tech: quenching - if you're at full health heal power ups do harm but they also increase your max health

you can play with camera smoothing now in the console
  m.lookSmoothing = 0.07, //1 is instant/jerky,  0.01 is slow zoom, 0.07 is standard

more progress on level - labs
This commit is contained in:
landgreen
2021-06-18 13:20:02 -07:00
parent f89b228226
commit cb2a8e4243
9 changed files with 226 additions and 100 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -459,7 +459,7 @@ const b = {
}, },
pulse(charge, angle = m.angle, where = m.pos) { pulse(charge, angle = m.angle, where = m.pos) {
let best; let best;
let explosionRadius = 6 * charge let explosionRadius = 5.5 * charge
let range = 5000 let range = 5000
const path = [{ const path = [{
x: where.x + 20 * Math.cos(angle), x: where.x + 20 * Math.cos(angle),
@@ -547,7 +547,7 @@ const b = {
} }
if (best.who) { if (best.who) {
b.explosion(path[1], explosionRadius) b.explosion(path[1], explosionRadius)
const off = explosionRadius const off = explosionRadius * 1.2
b.explosion({ x: path[1].x + off * (Math.random() - 0.5), y: path[1].y + off * (Math.random() - 0.5) }, explosionRadius) b.explosion({ x: path[1].x + off * (Math.random() - 0.5), y: path[1].y + off * (Math.random() - 0.5) }, explosionRadius)
b.explosion({ x: path[1].x + off * (Math.random() - 0.5), y: path[1].y + off * (Math.random() - 0.5) }, explosionRadius) b.explosion({ x: path[1].x + off * (Math.random() - 0.5), y: path[1].y + off * (Math.random() - 0.5) }, explosionRadius)
} }
@@ -2107,7 +2107,7 @@ const b = {
} }
} }
//power ups //power ups
if (!this.isImproved && !simulation.isChoosing && !tech.isArmorFromPowerUps) { if (!this.isImproved && !simulation.isChoosing && !tech.isExtraMaxHealth) {
if (this.lockedOn) { if (this.lockedOn) {
//grab, but don't lock onto nearby power up //grab, but don't lock onto nearby power up
for (let i = 0, len = powerUp.length; i < len; ++i) { for (let i = 0, len = powerUp.length; i < len; ++i) {
@@ -3623,7 +3623,7 @@ const b = {
} }
}, { }, {
name: "super balls", name: "super balls",
description: "fire <strong>four</strong> balls in a wide arc<br>balls <strong>bounce</strong> with no momentum loss", description: "fire <strong>3</strong> balls in a wide arc<br>balls <strong>bounce</strong> with no momentum loss",
ammo: 0, ammo: 0,
ammoPack: 11, ammoPack: 11,
have: false, have: false,

View File

@@ -21,13 +21,15 @@ const level = {
// b.giveGuns("grenades") // b.giveGuns("grenades")
// tech.isExplodeRadio = true // tech.isExplodeRadio = true
// tech.giveTech("chain reaction") // tech.giveTech("chain reaction")
// tech.giveTech("MACHO") // tech.giveTech("quenching")
// tech.giveTech("decoherence")
// tech.giveTech("supertemporal") // tech.giveTech("supertemporal")
// for (let i = 0; i < 3; i++) tech.giveTech("packet length") // for (let i = 0; i < 3; i++) tech.giveTech("packet length")
// for (let i = 0; i < 3; i++) tech.giveTech("propagation") // for (let i = 0; i < 3; i++) tech.giveTech("propagation")
// for (let i = 0; i < 3; i++) tech.giveTech("bound state") // for (let i = 0; i < 3; i++) tech.giveTech("bound state")
// for (let i = 0; i < 9; i++) tech.giveTech("WIMPs") // for (let i = 0; i < 9; i++) tech.giveTech("WIMPs")
level.intro(); //starting level level.intro(); //starting level
// level.labs(); // level.labs();
// level.testing(); //not in rotation, used for testing // level.testing(); //not in rotation, used for testing
@@ -54,6 +56,7 @@ const level = {
// level.vats() //community level // level.vats() //community level
// level["n-gon"]() //community level // level["n-gon"]() //community level
// level.tunnel() //community level // level.tunnel() //community level
// for (let i = 0; i < 39; i++) powerUps.spawn(player.position.x + Math.random() * 50, player.position.y - Math.random() * 50, "tech", false);
// for (let i = 0; i < 7; i++) tech.giveTech("undefined") // for (let i = 0; i < 7; i++) tech.giveTech("undefined")
// lore.techCount = 6 // lore.techCount = 6
// localSettings.loreCount = 1; // localSettings.loreCount = 1;
@@ -77,8 +80,8 @@ const level = {
simulation.draw.setPaths(); simulation.draw.setPaths();
b.respawnBots(); b.respawnBots();
m.resetHistory(); m.resetHistory();
if (tech.isArmorFromPowerUps) { if (tech.isExtraMaxHealth) {
tech.armorFromPowerUps += Math.min(0.03 * powerUps.totalPowerUps, 0.51) tech.extraMaxHealth += Math.min(0.03 * powerUps.totalPowerUps, 0.51)
m.setMaxHealth(); m.setMaxHealth();
} }
if (tech.isGunCycle) { if (tech.isGunCycle) {
@@ -1101,16 +1104,25 @@ const level = {
const y = offset.y const y = offset.y
level.setPosToSpawn(x + 2300, y - 800); level.setPosToSpawn(x + 2300, y - 800);
spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20); spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20);
spawn.mapRect(x + 1450, y - 750, 1300, 50); //entrance shelf
spawn.mapRect(x + 1850, y - 1350, 50, 450); //entrance left wall spawn.mapRect(x + 1850, y - 1350, 50, 450); //entrance left wall
spawn.bodyRect(x + 1860, y - 900, 30, 150); //entrance door spawn.bodyRect(x + 1860, y - 900, 30, 150); //entrance door
spawn.mapRect(x + 2000, y - 350, 750, 150); //toggle shelf spawn.mapRect(x + 2000, y - 350, 750, 150); //toggle shelf
const toggle = level.toggle(x + 2050, y - 350, true) //(x,y,isOn,isLockOn = true/false) const toggle = level.toggle(x + 2050, y - 350, true) //(x,y,isOn,isLockOn = true/false)
const hazard = level.hazard(x + 1040, y - 660, 1700, 10, 0.4) //laser let hazard
spawn.mapRect(x + 1050, y - 665, 10, 20); //laser nose if (Math.random() > 0.5) {
spawn.mapRect(x + 650, y - 705, 400, 100); //laser body spawn.mapRect(x + 550, y - 750, 2200, 50); //entrance shelf
hazard = level.hazard(x + 850, y - 920, 1000, 10, 0.4) //laser
spawn.mapRect(x + 860, y - 925, 10, 20); //laser nose
spawn.mapRect(x + 660, y - 975, 200, 120); //laser body
} else {
spawn.mapRect(x + 1450, y - 750, 1300, 50); //entrance shelf
hazard = level.hazard(x + 1040, y - 660, 1700, 10, 0.4) //laser
spawn.mapRect(x + 1050, y - 665, 10, 20); //laser nose
spawn.mapRect(x + 650, y - 705, 400, 100); //laser body
}
const hazard2 = level.hazard(x - 150, y - 330, 600, 10, 0.4) //laser const hazard2 = level.hazard(x - 150, y - 330, 600, 10, 0.4) //laser
spawn.mapRect(x + 440, y - 335, 10, 20); //laser nose spawn.mapRect(x + 440, y - 335, 10, 20); //laser nose
spawn.mapRect(x + 450, y - 375, 400, 100); //laser body spawn.mapRect(x + 450, y - 375, 400, 100); //laser body
@@ -1118,8 +1130,10 @@ const level = {
const Xoffset = Math.floor(400 * Math.random()) const Xoffset = Math.floor(400 * Math.random())
const hazard3 = level.hazard(x + Xoffset, y - 1300, 10, 1300, 0.4) //laser const hazard3 = level.hazard(x + Xoffset, y - 1300, 10, 1300, 0.4) //laser
spawn.mapRect(x + Xoffset - 5, y - 1310, 20, 20); //laser nose spawn.mapRect(x + Xoffset - 5, y - 1310, 20, 20); //laser nose
const hazard4 = level.hazard(x + 2100, y - 200, 10, 200, 0.4) //laser
spawn.mapRect(x + 2100 - 5, y - 210, 20, 20); //laser nose const Xoffset2 = 2050 + Math.floor(550 * Math.random())
const hazard4 = level.hazard(x + Xoffset2, y - 200, 10, 200, 0.4) //laser
spawn.mapRect(x + Xoffset2 - 5, y - 210, 20, 20); //laser nose
spawn.randomSmallMob(x + 2225, y - 100); spawn.randomSmallMob(x + 2225, y - 100);
spawn.randomMob(x + 0, y - 125, 0); spawn.randomMob(x + 0, y - 125, 0);
@@ -1149,7 +1163,7 @@ const level = {
// } // }
] ]
exitOptions = [ exitOptions = [
() => { //9 spinners () => { //8 spinners
const x = offset.x const x = offset.x
const y = offset.y const y = offset.y
level.exit.x = x + 1250; level.exit.x = x + 1250;
@@ -1225,6 +1239,78 @@ const level = {
ctx.fill(); ctx.fill();
} }
) )
},
() => { //7 spinners
const x = offset.x
const y = offset.y
level.exit.x = x + 2450;
level.exit.y = y - 980;
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20);
spawn.mapRect(x + 2250, y - 950, 500, 25); //exit platform
spawn.mapRect(x + 2300, y - 1300, 25, 175); //exit side wall
spawn.bodyRect(x + 1275, y - 475, 125, 125, 0.25);
spawn.bodyRect(x + 1825, y - 125, 125, 125, 0.25);
spawn.bodyRect(x + 500, y - 100, 125, 100, 0.25);
spawn.bodyRect(x + 0, y - 150, 100, 150, 0.25);
spawn.bodyRect(x + 2375, y - 150, 125, 150, 0.25);
if (Math.random() > 0.5) {
const density = 0.0013
const angle = Math.PI / 2
const variance = 0.3 //Math.PI
const frictionAir = 0.01
balance1 = level.spinner(x + 1150, y - 500, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir) // spinner(x, y, width, height, density = 0.001, angle=0,frictionAir=0.001,angularVelocity=0) {
balance3 = level.spinner(x + 600, y - 600, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance2 = level.spinner(x + 125, y - 850, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance4 = level.spinner(x + 650, y - 1145, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance5 = level.spinner(x + 1100, y - 1145, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance6 = level.spinner(x + 1550, y - 1145, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance7 = level.spinner(x + 2000, y - 1145, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
} else {
const density = 0.0013
const angle = Math.PI / 2
const variance = 0 //Math.PI
const frictionAir = 0.01
balance1 = level.spinner(x + 150, y - 500, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir) // spinner(x, y, width, height, density = 0.001, angle=0,frictionAir=0.001,angularVelocity=0) {
balance2 = level.spinner(x + 2300, y - 550, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance4 = level.spinner(x + 1850, y - 550, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance3 = level.spinner(x + 650, y - 700, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance5 = level.spinner(x + 1100, y - 900, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance6 = level.spinner(x + 1550, y - 900, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
balance7 = level.spinner(x + 1970, y - 1150, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
}
spawn.randomMob(x + 1175, y - 725, 0.1);
spawn.randomMob(x + 1450, y - 725, 0.2);
spawn.randomMob(x + 425, y - 100, 0.3);
spawn.randomMob(x + 2300, y - 125, 0.4);
spawn.randomMob(x + 1300, y - 375, 0.5);
doCustom.push(
() => {
ctx.fillStyle = "#d4f4f4"
ctx.fillRect(x + 2300, y - 1300, 400, 350)
}
)
doCustomTopLayer.push(
() => {
ctx.fillStyle = "#233"
ctx.beginPath();
ctx.arc(balance1.pointA.x, balance1.pointA.y, 9, 0, 2 * Math.PI);
ctx.moveTo(balance2.pointA.x, balance2.pointA.y)
ctx.arc(balance2.pointA.x, balance2.pointA.y, 9, 0, 2 * Math.PI);
ctx.moveTo(balance3.pointA.x, balance3.pointA.y)
ctx.arc(balance3.pointA.x, balance3.pointA.y, 9, 0, 2 * Math.PI);
ctx.moveTo(balance4.pointA.x, balance4.pointA.y)
ctx.arc(balance4.pointA.x, balance4.pointA.y, 9, 0, 2 * Math.PI);
ctx.moveTo(balance5.pointA.x, balance5.pointA.y)
ctx.arc(balance5.pointA.x, balance5.pointA.y, 9, 0, 2 * Math.PI);
ctx.moveTo(balance6.pointA.x, balance6.pointA.y)
ctx.arc(balance6.pointA.x, balance6.pointA.y, 9, 0, 2 * Math.PI);
ctx.moveTo(balance7.pointA.x, balance7.pointA.y)
ctx.arc(balance7.pointA.x, balance7.pointA.y, 9, 0, 2 * Math.PI);
ctx.fill();
}
)
} }
] ]
emptyOptions = [ //nothing good here emptyOptions = [ //nothing good here
@@ -1245,7 +1331,17 @@ const level = {
() => { () => {
const x = offset.x const x = offset.x
const y = offset.y const y = offset.y
if (simulation.difficulty > 3) spawn.randomLevelBoss(x + 1250, y - 600);
const elevator = level.elevator(x + 1200, y - 100, 380, 50, -2000, 0.001) // elevator(x, y, width, height, maxHeight, force = 0.003, friction = { up: 0.01, down: 0.2 }, isTeleport = false) {
// if (simulation.difficulty > 3)
spawn.randomLevelBoss(x + 1250, y - 1400);
doCustomTopLayer.push(
() => {
elevator.move()
}
)
} }
] ]
@@ -1273,8 +1369,7 @@ const level = {
if (rooms[i] === "empty") rooms[i] = empty if (rooms[i] === "empty") rooms[i] = empty
if (rooms[i] === "loot") rooms[i] = loot if (rooms[i] === "loot") rooms[i] = loot
} }
//*********************************DON"T RUN THIS LINE IN THE FINAL VERSION *************************************** rooms = [empty, loot, exit, enter, ] //controls what level spawns for map designing building //********************************* DO !NOT! RUN THIS LINE IN THE FINAL VERSION ***************************************
rooms = [exit, enter, empty, loot] //this is used to control what level spawns while building
outlineDoors = () => { outlineDoors = () => {
spawn.mapRect(offset.x - 200, offset.y, 3000, 100); //floor spawn.mapRect(offset.x - 200, offset.y, 3000, 100); //floor
@@ -1290,52 +1385,53 @@ const level = {
} }
} }
outlineUpDown = () => { outlineUpDown = () => {
spawn.mapRect(offset.x - 200, offset.y + 1400, 3000, 100); //floor spawn.mapRect(offset.x - 200, offset.y + 0, 3000, 100); //floor
spawn.mapRect(offset.x - 200, offset.y - 1400, 3000, 100); //ceiling spawn.mapRect(offset.x - 200, offset.y - 2800, 3000, 100); //ceiling
if (!isDoorLeft) spawn.mapRect(offset.x - 200, offset.y - 1400, 100, 2800); //left wall if (!isDoorLeft) spawn.mapRect(offset.x - 200, offset.y - 2800, 100, 2800); //left wall
if (isDoorRight) { //if door only add wall on right side if (isDoorRight) { //if door only add wall on right side
//upper door //upper door
spawn.mapRect(offset.x + 2700, offset.y - 2800, 100, 1225); //right wall
spawn.mapRect(offset.x + 2700, offset.y - 1410, 100, 20); //right doorstep
const doorWidth = 15 + Math.floor(100 * Math.random() * Math.random())
spawn.bodyRect(offset.x + 2750 - doorWidth / 2, offset.y - 1225, doorWidth, 165); //block door
//lower door
spawn.mapRect(offset.x + 2700, offset.y - 1400, 100, 1225); //right wall spawn.mapRect(offset.x + 2700, offset.y - 1400, 100, 1225); //right wall
spawn.mapRect(offset.x + 2700, offset.y - 10, 100, 20); //right doorstep spawn.mapRect(offset.x + 2700, offset.y - 10, 100, 20); //right doorstep
const doorWidth = 15 + Math.floor(100 * Math.random() * Math.random())
spawn.bodyRect(offset.x + 2750 - doorWidth / 2, offset.y - 175, doorWidth, 165); //block door
//lower door
spawn.mapRect(offset.x + 2700, offset.y - 1400 + 1400, 100, 1225); //right wall
spawn.mapRect(offset.x + 2700, offset.y - 10 + 1400, 100, 20); //right doorstep
const doorWidth2 = 15 + Math.floor(100 * Math.random() * Math.random()) const doorWidth2 = 15 + Math.floor(100 * Math.random() * Math.random())
spawn.bodyRect(offset.x + 2750 - doorWidth2 / 2, offset.y - 175 + 1400, doorWidth2, 165); //block door spawn.bodyRect(offset.x + 2750 - doorWidth2 / 2, offset.y - 175, doorWidth2, 165); //block door
} else { } else {
spawn.mapRect(offset.x + 2700, offset.y - 1400, 100, 2800); //right wall spawn.mapRect(offset.x + 2700, offset.y - 2800, 100, 2800); //right wall
} }
} }
let rows = [ let rows = [
() => { () => {
offset.y = 0 offset.y = 0
rooms[0]()
outlineDoors()
offset.y = -1400
rooms[1]()
outlineDoors()
},
() => {
offset.y = -1400
upDown()
outlineUpDown() outlineUpDown()
upDown()
}, },
() => { () => {
offset.y = 0 offset.y = 0
rooms[2]()
outlineDoors() outlineDoors()
rooms[0]()
offset.y = -1400 offset.y = -1400
rooms[3]()
outlineDoors() outlineDoors()
rooms[1]()
},
() => {
offset.y = 0
outlineDoors()
rooms[2]()
offset.y = -1400
outlineDoors()
rooms[3]()
} }
] ]
//*********************************RUN THIS LINE IN THE FINAL VERSION ***************************************
// rows = shuffle(rows) // rows = shuffle(rows) //********************************* RUN THIS LINE IN THE FINAL VERSION ***************************************
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
if (i === 0) { if (i === 0) {
isDoorLeft = false isDoorLeft = false
@@ -1360,6 +1456,8 @@ const level = {
for (let i = 0, len = doCustomTopLayer.length; i < len; i++) doCustomTopLayer[i]() //runs all the active code from each room for (let i = 0, len = doCustomTopLayer.length; i < len; i++) doCustomTopLayer[i]() //runs all the active code from each room
}; };
powerUps.addResearchToLevel() //needs to run after mobs are spawned powerUps.addResearchToLevel() //needs to run after mobs are spawned
level.setPosToSpawn(0, 0); //********************************* DO !NOT! RUN THIS LINE IN THE FINAL VERSION ***************************************
}, },
null() { null() {
level.levels.pop(); //remove lore level from rotation level.levels.pop(); //remove lore level from rotation

View File

@@ -174,20 +174,8 @@ const m = {
transSmoothY: 0, transSmoothY: 0,
lastGroundedPositionY: 0, lastGroundedPositionY: 0,
// mouseZoom: 0, // mouseZoom: 0,
look() { lookSmoothing: 0.07, //1 is instant jerky, 0.001 is slow smooth zoom, 0.07 is standard
//always on mouse look look() {}, //set to lookDefault()
m.angle = Math.atan2(
simulation.mouseInGame.y - m.pos.y,
simulation.mouseInGame.x - m.pos.x
);
//smoothed mouse look translations
const scale = 0.8;
m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale;
m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale;
m.transX += (m.transSmoothX - m.transX) * 0.07;
m.transY += (m.transSmoothY - m.transY) * 0.07;
},
lookDefault() { lookDefault() {
//always on mouse look //always on mouse look
m.angle = Math.atan2( m.angle = Math.atan2(
@@ -199,8 +187,8 @@ const m = {
m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale; m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale;
m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale; m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale;
m.transX += (m.transSmoothX - m.transX) * 0.07; m.transX += (m.transSmoothX - m.transX) * m.lookSmoothing;
m.transY += (m.transSmoothY - m.transY) * 0.07; m.transY += (m.transSmoothY - m.transY) * m.lookSmoothing;
}, },
doCrouch() { doCrouch() {
if (!m.crouch) { if (!m.crouch) {
@@ -333,7 +321,7 @@ const m = {
// tech.addLoreTechToPool(); // tech.addLoreTechToPool();
// tech.removeJunkTechFromPool(); // tech.removeJunkTechFromPool();
tech.cancelCount = 0; tech.cancelCount = 0;
tech.armorFromPowerUps = 0; tech.extraMaxHealth = 0;
tech.totalCount = 0; tech.totalCount = 0;
const randomBotCount = b.totalBots() const randomBotCount = b.totalBots()
b.zeroBotCount() b.zeroBotCount()
@@ -485,7 +473,7 @@ const m = {
}, },
baseHealth: 1, baseHealth: 1,
setMaxHealth() { setMaxHealth() {
m.maxHealth = m.baseHealth + tech.armorFromPowerUps + tech.isFallingDamage //+ tech.bonusHealth m.maxHealth = m.baseHealth + tech.extraMaxHealth + tech.isFallingDamage //+ tech.bonusHealth
document.getElementById("health-bg").style.width = `${Math.floor(300*m.maxHealth)}px` document.getElementById("health-bg").style.width = `${Math.floor(300*m.maxHealth)}px`
simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-h'>maxHealth</span> <span class='color-symbol'>=</span> ${m.maxHealth.toFixed(2)}`) simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-h'>maxHealth</span> <span class='color-symbol'>=</span> ${m.maxHealth.toFixed(2)}`)
if (m.health > m.maxHealth) m.health = m.maxHealth; if (m.health > m.maxHealth) m.health = m.maxHealth;
@@ -1250,9 +1238,9 @@ const m = {
const dyP = m.pos.y - powerUp[i].position.y; const dyP = m.pos.y - powerUp[i].position.y;
const dist2 = dxP * dxP + dyP * dyP; const dist2 = dxP * dxP + dyP * dyP;
// float towards player if looking at and in range or if very close to player // float towards player if looking at and in range or if very close to player
if (dist2 < m.grabPowerUpRange2 && if (
dist2 < m.grabPowerUpRange2 &&
(m.lookingAt(powerUp[i]) || dist2 < 16000) && (m.lookingAt(powerUp[i]) || dist2 < 16000) &&
!(m.health === m.maxHealth && powerUp[i].name === "heal") &&
Matter.Query.ray(map, powerUp[i].position, m.pos).length === 0 Matter.Query.ray(map, powerUp[i].position, m.pos).length === 0
) { ) {
powerUp[i].force.x += 0.05 * (dxP / Math.sqrt(dist2)) * powerUp[i].mass; powerUp[i].force.x += 0.05 * (dxP / Math.sqrt(dist2)) * powerUp[i].mass;
@@ -1262,7 +1250,11 @@ const m = {
x: powerUp[i].velocity.x * 0.11, x: powerUp[i].velocity.x * 0.11,
y: powerUp[i].velocity.y * 0.11 y: powerUp[i].velocity.y * 0.11
}); });
if (dist2 < 5000 && !simulation.isChoosing) { //use power up if it is close enough if ( //use power up if it is close enough
dist2 < 5000 &&
!simulation.isChoosing &&
!(m.health === m.maxHealth && powerUp[i].name === "heal" && !tech.isOverHeal)
) {
powerUps.onPickUp(powerUp[i]); powerUps.onPickUp(powerUp[i]);
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
x: player.velocity.x + powerUp[i].velocity.x / player.mass * 5, x: player.velocity.x + powerUp[i].velocity.x / player.mass * 5,
@@ -1320,6 +1312,8 @@ const m = {
x: player.velocity.x - (15 * unit.x) / massRoot, x: player.velocity.x - (15 * unit.x) / massRoot,
y: player.velocity.y - (15 * unit.y) / massRoot y: player.velocity.y - (15 * unit.y) / massRoot
}); });
if (mob[i].isOrbital) Matter.Body.setVelocity(who, { x: 0, y: 0 });
if (m.crouch) { if (m.crouch) {
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x + 0.1 * m.blockingRecoil * unit.x * massRoot, x: player.velocity.x + 0.1 * m.blockingRecoil * unit.x * massRoot,
@@ -1338,6 +1332,8 @@ const m = {
x: player.velocity.x - (20 * unit.x) / massRoot, x: player.velocity.x - (20 * unit.x) / massRoot,
y: player.velocity.y - (20 * unit.y) / massRoot y: player.velocity.y - (20 * unit.y) / massRoot
}); });
if (mob[i].isOrbital) Matter.Body.setVelocity(who, { x: 0, y: 0 });
if (who.isDropPowerUp && player.speed < 12) { if (who.isDropPowerUp && player.speed < 12) {
const massRootCap = Math.sqrt(Math.min(10, Math.max(0.4, who.mass))); // masses above 12 can start to overcome the push back const massRootCap = Math.sqrt(Math.min(10, Math.max(0.4, who.mass))); // masses above 12 can start to overcome the push back
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
@@ -2946,7 +2942,6 @@ const m = {
const d = Math.max(dx * dx, dy * dy) const d = Math.max(dx * dx, dy * dy)
simulation.edgeZoomOutSmooth = (1 + 4 * d * d) * 0.04 + simulation.edgeZoomOutSmooth * 0.96 simulation.edgeZoomOutSmooth = (1 + 4 * d * d) * 0.04 + simulation.edgeZoomOutSmooth * 0.96
ctx.save(); ctx.save();
ctx.translate(canvas.width2, canvas.height2); //center ctx.translate(canvas.width2, canvas.height2); //center
ctx.scale(simulation.zoom / simulation.edgeZoomOutSmooth, simulation.zoom / simulation.edgeZoomOutSmooth); //zoom in once centered ctx.scale(simulation.zoom / simulation.edgeZoomOutSmooth, simulation.zoom / simulation.edgeZoomOutSmooth); //zoom in once centered

View File

@@ -275,14 +275,32 @@ const powerUps = {
size() { size() {
return 40 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5); //(simulation.healScale ** 0.25) gives a smaller radius as heal scale goes down return 40 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5); //(simulation.healScale ** 0.25) gives a smaller radius as heal scale goes down
}, },
calculateHeal(size) {
return tech.largerHeals * (size / 40 / Math.sqrt(tech.largerHeals) / (simulation.healScale ** 0.25)) ** 2 //heal scale is undone here because heal scale is properly affected on m.addHealth()
},
effect() { effect() {
if (!tech.isEnergyHealth && m.alive) { if (!tech.isEnergyHealth && m.alive) {
const heal = tech.largerHeals * (this.size / 40 / Math.sqrt(tech.largerHeals) / (simulation.healScale ** 0.25)) ** 2 //heal scale is undone here because heal scale is properly affected on m.addHealth() const heal = powerUps.heal.calculateHeal(this.size)
if (heal > 0) { if (heal > 0) {
const healOutput = Math.min(m.maxHealth - m.health, heal) * simulation.healScale if (tech.isOverHeal && m.health === m.maxHealth) { //tech quenching
m.addHealth(heal); if (m.immuneCycle < m.cycle) {
simulation.makeTextLog(`<span class='color-var'>m</span>.health <span class='color-symbol'>+=</span> ${(healOutput).toFixed(3)}`) // <br>${m.health.toFixed(3)} m.damage(heal * simulation.healScale);
// simulation.makeTextLog("<div class='circle heal'></div> &nbsp; <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (Math.min(m.maxHealth - m.health, heal) * simulation.healScale * 100).toFixed(0) + "%</span>", 300) //draw damage
simulation.drawList.push({ //add dmg to draw queue
x: m.pos.x,
y: m.pos.y,
radius: heal * 500 * simulation.healScale,
color: simulation.mobDmgColor,
time: simulation.drawTime
});
}
tech.extraMaxHealth += heal * simulation.healScale //increase max health
m.setMaxHealth();
} else {
const healOutput = Math.min(m.maxHealth - m.health, heal) * simulation.healScale
m.addHealth(heal);
simulation.makeTextLog(`<span class='color-var'>m</span>.health <span class='color-symbol'>+=</span> ${(healOutput).toFixed(3)}`) // <br>${m.health.toFixed(3)}
}
} }
} }
if (tech.healGiveMaxEnergy) { if (tech.healGiveMaxEnergy) {

View File

@@ -15,7 +15,6 @@ const simulation = {
m.move(); m.move();
m.look(); m.look();
simulation.checks(); simulation.checks();
ctx.save();
simulation.camera(); simulation.camera();
level.custom(); level.custom();
powerUps.do(); powerUps.do();
@@ -52,7 +51,6 @@ const simulation = {
m.move(); m.move();
m.look(); m.look();
simulation.checks(); simulation.checks();
ctx.save();
simulation.camera(); simulation.camera();
level.custom(); level.custom();
m.draw(); m.draw();
@@ -422,7 +420,6 @@ const simulation = {
const d = Math.max(dx * dx, dy * dy) const d = Math.max(dx * dx, dy * dy)
simulation.edgeZoomOutSmooth = (1 + 4 * d * d) * 0.04 + simulation.edgeZoomOutSmooth * 0.96 simulation.edgeZoomOutSmooth = (1 + 4 * d * d) * 0.04 + simulation.edgeZoomOutSmooth * 0.96
ctx.save(); ctx.save();
ctx.translate(canvas.width2, canvas.height2); //center ctx.translate(canvas.width2, canvas.height2); //center
ctx.scale(simulation.zoom / simulation.edgeZoomOutSmooth, simulation.zoom / simulation.edgeZoomOutSmooth); //zoom in once centered ctx.scale(simulation.zoom / simulation.edgeZoomOutSmooth, simulation.zoom / simulation.edgeZoomOutSmooth); //zoom in once centered

View File

@@ -3412,6 +3412,7 @@ const spawn = {
me.isDropPowerUp = false; me.isDropPowerUp = false;
me.isBadTarget = true; me.isBadTarget = true;
me.showHealthBar = false; me.showHealthBar = false;
me.isOrbital = true;
// me.isShielded = true // me.isShielded = true
me.collisionFilter.category = cat.mobBullet; me.collisionFilter.category = cat.mobBullet;
me.collisionFilter.mask = cat.bullet; //cat.player | cat.map | cat.body me.collisionFilter.mask = cat.bullet; //cat.player | cat.map | cat.body

View File

@@ -25,7 +25,7 @@
// tech.removeJunkTechFromPool(); // tech.removeJunkTechFromPool();
// tech.removeLoreTechFromPool(); // tech.removeLoreTechFromPool();
// tech.addLoreTechToPool(); // tech.addLoreTechToPool();
tech.armorFromPowerUps = 0; tech.extraMaxHealth = 0;
tech.totalCount = 0; tech.totalCount = 0;
simulation.updateTechHUD(); simulation.updateTechHUD();
}, },
@@ -2390,6 +2390,24 @@
m.setMaxHealth(); m.setMaxHealth();
} }
}, },
{
name: "quenching",
description: "if you're at full <strong class='color-h'>health</strong> heal power ups do <strong class='color-harm'>harm</strong><br>but they also increase your <strong>maximum</strong> <strong class='color-h'>health</strong>",
maxCount: 1,
count: 0,
frequency: 1,
frequencyDefault: 1,
allowed() {
return !tech.isEnergyHealth && !tech.isNoHeals
},
requires: "not mass-energy equivalence, ergodicity",
effect() {
tech.isOverHeal = true;
},
remove() {
tech.isOverHeal = false;
}
},
{ {
name: "inductive coupling", name: "inductive coupling",
description: "for each unused <strong>power up</strong> at the end of a <strong>level</strong><br>add 3 <strong>max</strong> <strong class='color-h'>health</strong> <em>(up to 51 health per level)</em>", description: "for each unused <strong>power up</strong> at the end of a <strong>level</strong><br>add 3 <strong>max</strong> <strong class='color-h'>health</strong> <em>(up to 51 health per level)</em>",
@@ -2402,11 +2420,11 @@
}, },
requires: "not mass-energy equivalence, not drone harvester, ergodicity", requires: "not mass-energy equivalence, not drone harvester, ergodicity",
effect() { effect() {
tech.isArmorFromPowerUps = true; //tracked by tech.armorFromPowerUps tech.isExtraMaxHealth = true; //tracked by tech.extraMaxHealth
}, },
remove() { remove() {
tech.isArmorFromPowerUps = false; tech.isExtraMaxHealth = false;
// tech.armorFromPowerUps = 0; //this is now reset in tech.setupAllTech(); // tech.extraMaxHealth = 0; //this is now reset in tech.setupAllTech();
m.setMaxHealth(); m.setMaxHealth();
} }
}, },
@@ -2417,7 +2435,7 @@
count: 0, count: 0,
frequency: 2, frequency: 2,
allowed() { allowed() {
return tech.isArmorFromPowerUps return tech.isExtraMaxHealth
}, },
requires: "inductive coupling", requires: "inductive coupling",
effect() { effect() {
@@ -2435,7 +2453,7 @@
frequency: 2, frequency: 2,
isHealTech: true, isHealTech: true,
allowed() { allowed() {
return m.health > 0.1 && (m.maxHealth > 1 || tech.isArmorFromPowerUps) && !tech.isNoHeals return m.health > 0.1 && (m.maxHealth > 1 || tech.isExtraMaxHealth) && !tech.isNoHeals
}, },
requires: "increased max health, not ergodicity", requires: "increased max health, not ergodicity",
effect() { effect() {
@@ -4180,7 +4198,7 @@
count: 0, count: 0,
frequency: 2, frequency: 2,
allowed() { allowed() {
return !tech.isArmorFromPowerUps && (tech.haveGunCheck("drones") || (m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField))) return !tech.isExtraMaxHealth && (tech.haveGunCheck("drones") || (m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField)))
}, },
requires: "drones, not inductive coupling", requires: "drones, not inductive coupling",
effect() { effect() {
@@ -4430,13 +4448,13 @@
requires: "laser, not wide beam, diffuse beam, pulse, or slow light", requires: "laser, not wide beam, diffuse beam, pulse, or slow light",
effect() { effect() {
tech.laserReflections++; tech.laserReflections++;
tech.laserDamage += 0.08; //base is 0.12 tech.laserDamage += 0.075; //base is 0.12
tech.laserFieldDrain += 0.0009 //base is 0.002 tech.laserFieldDrain += 0.001 //base is 0.002
}, },
remove() { remove() {
tech.laserReflections = 2; tech.laserReflections = 2;
tech.laserDamage = 0.16; tech.laserDamage = 0.15;
tech.laserFieldDrain = 0.0018; tech.laserFieldDrain = 0.002;
} }
}, },
{ {
@@ -6802,7 +6820,7 @@
squirrelJump: null, squirrelJump: null,
fastTimeJump: null, fastTimeJump: null,
isFastRadiation: null, isFastRadiation: null,
isArmorFromPowerUps: null, isExtraMaxHealth: null,
isAmmoForGun: null, isAmmoForGun: null,
isRapidPulse: null, isRapidPulse: null,
isPulseAim: null, isPulseAim: null,
@@ -6838,7 +6856,7 @@
isFreezeHarmImmune: null, isFreezeHarmImmune: null,
isSmallExplosion: null, isSmallExplosion: null,
isExplosionHarm: null, isExplosionHarm: null,
armorFromPowerUps: null, extraMaxHealth: null,
// bonusHealth: null, // bonusHealth: null,
isIntangible: null, isIntangible: null,
isCloakStun: null, isCloakStun: null,
@@ -6947,5 +6965,6 @@
isStandingWaveExpand: null, isStandingWaveExpand: null,
isBlockExplosion: null, isBlockExplosion: null,
superBallDelay: null, superBallDelay: null,
isBlockExplode: null isBlockExplode: null,
isOverHeal: null
} }

View File

@@ -1,14 +1,11 @@
******************************************************** NEXT PATCH ******************************************************** ******************************************************** NEXT PATCH ********************************************************
tech: chain reaction - blocks caught in explosions, explode tech: quenching - if you're at full health heal power ups do harm but they also increase your max health
tech: shock wave reduces explosion damage by 30% (was 40%)
slime hazards now draw themselves in hazard.query() you can play with camera smoothing now in the console
I updated all the maps to remove hazard.draw() m.lookSmoothing = 0.07, //1 is instant/jerky, 0.01 is slow zoom, 0.07 is standard
but maybe I missed one let me know if you find a buggy slime
laser hazards also draw themselves in hazard.opticalQuery()
2/6 rooms for new level.labs() are completed more progress on level - labs
******************************************************** BUGS ******************************************************** ******************************************************** BUGS ********************************************************
@@ -42,17 +39,15 @@ labs - procedural generation
entrance - no mobs, starting power ups` entrance - no mobs, starting power ups`
exit - possible duplication boss spawn location exit - possible duplication boss spawn location
up, down - 2 paired rooms - boost, elevator, portal up, down - 2 paired rooms - boost, elevator, portal
boss - standard random boss spawns standard random boss spawns
loot - some power ups
empty - a dead end empty - a dead end
button - like empty, but also has a switch that opens door to exit room
room ideas - room ideas -
low gravity room, controlled with a button? low gravity room, controlled with a button?
portal room portal room
endlessly falling blocks down a slide, that the player has to climb up endlessly falling blocks down a slide, that the player has to climb up
portal + rotor + falling blocks = perpetual motion portal + rotor + falling blocks = perpetual motion
laser room
slime radiation room slime radiation room
spinner room
make a switch level element make a switch level element
basically button, but go off and on when it hits player (or block?) basically button, but go off and on when it hits player (or block?)
@@ -73,6 +68,12 @@ level element: carousel
******************************************************** TODO ******************************************************** ******************************************************** TODO ********************************************************
tech: picking up heal power ups at max health does harm, but increases max health
scales with heal value
does catabolism give too much ammo?
synergy with shotgun harm immunity
let standing wave harmonics get tech decorrelation let standing wave harmonics get tech decorrelation
tech: cloaking field - decrease/increase cooldown on sneak attack? tech: cloaking field - decrease/increase cooldown on sneak attack?
@@ -96,9 +97,6 @@ what about the single axis graphic? (find the code in standing wave harmonic)
maybe just save it for a mob maybe just save it for a mob
maybe use it on lore maybe use it on lore
tech: picking up heal power ups when at full health does harm equal to the heal values
benefit on pick up: get 1% damage
buttons can now on/off boosts buttons can now on/off boosts
energy conservation 6% damage recovered as energy energy conservation 6% damage recovered as energy
@@ -373,7 +371,7 @@ possible names for tech
Pigeonhole principle - if there are several things that are matched up Pigeonhole principle - if there are several things that are matched up
regression to the mean regression to the mean
tessellation = tiling of a flat surface is the covering of a plane using one or more geometric shapes, called tiles, with no overlaps and no gaps. tessellation = tiling of a flat surface is the covering of a plane using one or more geometric shapes, called tiles, with no overlaps and no gaps.
phlogiston theory is a superseded scientific theory that postulated the existence of a fire-like element called phlogiston
plot script: plot script: