catabolism and inductive coupling update
catabolism - lowers your max health by 1 (was 3 harm) and gives 4 ammo inductive coupling - gives max energy for leftover power ups (was max health) now requires mass-energy equivalence switched to a newer copy, paste URL this seems to fix issues with failed text copy in the level builder if you hold mouse down for over 6 seconds
This commit is contained in:
25
js/bullet.js
25
js/bullet.js
@@ -96,13 +96,16 @@ const b = {
|
|||||||
outOfAmmo() { //triggers after firing when you have NO ammo
|
outOfAmmo() { //triggers after firing when you have NO ammo
|
||||||
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span><span class='color-symbol'>:</span> 0`);
|
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span><span class='color-symbol'>:</span> 0`);
|
||||||
m.fireCDcycle = m.cycle + 30; //fire cooldown
|
m.fireCDcycle = m.cycle + 30; //fire cooldown
|
||||||
if (tech.isAmmoFromHealth) {
|
if (tech.isAmmoFromHealth && m.maxHealth > 0.01) {
|
||||||
if (m.health > 0.03) {
|
tech.extraMaxHealth -= 0.01 //decrease max health
|
||||||
m.damage(0.03 / m.harmReduction()); // /m.harmReduction() undoes damage increase from difficulty
|
m.setMaxHealth();
|
||||||
if (!(tech.isRewindAvoidDeath && m.energy > 0.66)) { //don't give ammo if CPT triggered
|
|
||||||
for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x + 50 * (Math.random() - 0.5), m.pos.y + 50 * (Math.random() - 0.5), "ammo");
|
for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x + 50 * (Math.random() - 0.5), m.pos.y + 50 * (Math.random() - 0.5), "ammo");
|
||||||
}
|
// if (m.health > 0.03) {
|
||||||
}
|
// m.damage(0.03 / m.harmReduction()); // /m.harmReduction() undoes damage increase from difficulty
|
||||||
|
// if (!(tech.isRewindAvoidDeath && m.energy > 0.66)) { //don't give ammo if CPT triggered
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
giveGuns(gun = "random", ammoPacks = 10) {
|
giveGuns(gun = "random", ammoPacks = 10) {
|
||||||
@@ -1206,7 +1209,7 @@ const b = {
|
|||||||
didExtruderDrain: false,
|
didExtruderDrain: false,
|
||||||
canExtruderFire: true,
|
canExtruderFire: true,
|
||||||
extruder() {
|
extruder() {
|
||||||
const DRAIN = 0.0006 + m.fieldRegen
|
const DRAIN = 0.0007 + m.fieldRegen
|
||||||
if (m.energy > DRAIN && b.canExtruderFire) {
|
if (m.energy > DRAIN && b.canExtruderFire) {
|
||||||
m.energy -= DRAIN
|
m.energy -= DRAIN
|
||||||
if (m.energy < 0) {
|
if (m.energy < 0) {
|
||||||
@@ -1225,7 +1228,7 @@ const b = {
|
|||||||
frictionAir: 0,
|
frictionAir: 0,
|
||||||
isInHole: true, //this keeps the bullet from entering wormholes
|
isInHole: true, //this keeps the bullet from entering wormholes
|
||||||
minDmgSpeed: 0,
|
minDmgSpeed: 0,
|
||||||
dmg: b.dmgScale * 1.5, //damage also changes when you divide by mob.mass on in .do()
|
dmg: b.dmgScale * 1.4, //damage also changes when you divide by mob.mass on in .do()
|
||||||
classType: "bullet",
|
classType: "bullet",
|
||||||
isBranch: false,
|
isBranch: false,
|
||||||
restitution: 0,
|
restitution: 0,
|
||||||
@@ -2107,7 +2110,7 @@ const b = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//power ups
|
//power ups
|
||||||
if (!this.isImproved && !simulation.isChoosing && !tech.isExtraMaxHealth) {
|
if (!this.isImproved && !simulation.isChoosing && !tech.isExtraMaxEnergy) {
|
||||||
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) {
|
||||||
@@ -3460,8 +3463,8 @@ const b = {
|
|||||||
name: "shotgun",
|
name: "shotgun",
|
||||||
description: "fire a wide <strong>burst</strong> of short range <strong> bullets</strong>",
|
description: "fire a wide <strong>burst</strong> of short range <strong> bullets</strong>",
|
||||||
ammo: 0,
|
ammo: 0,
|
||||||
ammoPack: 5.5,
|
ammoPack: 5,
|
||||||
defaultAmmoPack: 5.5,
|
defaultAmmoPack: 5,
|
||||||
have: false,
|
have: false,
|
||||||
do() {},
|
do() {},
|
||||||
fire() {
|
fire() {
|
||||||
|
|||||||
22
js/index.js
22
js/index.js
@@ -504,13 +504,30 @@ const build = {
|
|||||||
if (isCustom) {
|
if (isCustom) {
|
||||||
url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}`
|
url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}`
|
||||||
url += `&noPower=${Number(document.getElementById("no-power-ups").checked)}`
|
url += `&noPower=${Number(document.getElementById("no-power-ups").checked)}`
|
||||||
alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
// alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||||
} else {
|
} else {
|
||||||
simulation.makeTextLog("n-gon build URL copied to clipboard.<br>Paste into browser address bar.")
|
simulation.makeTextLog("n-gon build URL copied to clipboard.<br>Paste into browser address bar.")
|
||||||
}
|
}
|
||||||
console.log('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
console.log('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||||
console.log(url)
|
console.log(url)
|
||||||
simulation.copyToClipBoard(url)
|
|
||||||
|
navigator.clipboard.writeText(url).then(function() {
|
||||||
|
/* clipboard successfully set */
|
||||||
|
if (isCustom) {
|
||||||
|
setTimeout(function() {
|
||||||
|
alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
}, function() {
|
||||||
|
/* clipboard write failed */
|
||||||
|
if (isCustom) {
|
||||||
|
setTimeout(function() {
|
||||||
|
alert('copy failed')
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
console.log('copy failed')
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
startExperiment() {
|
startExperiment() {
|
||||||
build.isExperimentSelection = false;
|
build.isExperimentSelection = false;
|
||||||
@@ -1165,7 +1182,6 @@ function cycle() {
|
|||||||
simulation.clearMap();
|
simulation.clearMap();
|
||||||
level.start();
|
level.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
simulation.loop();
|
simulation.loop();
|
||||||
// if (isNaN(m.health) || isNaN(m.energy)) {
|
// if (isNaN(m.health) || isNaN(m.energy)) {
|
||||||
// console.log(`m.health = ${m.health}`)
|
// console.log(`m.health = ${m.health}`)
|
||||||
|
|||||||
145
js/level.js
145
js/level.js
@@ -80,9 +80,9 @@ const level = {
|
|||||||
simulation.draw.setPaths();
|
simulation.draw.setPaths();
|
||||||
b.respawnBots();
|
b.respawnBots();
|
||||||
m.resetHistory();
|
m.resetHistory();
|
||||||
if (tech.isExtraMaxHealth) {
|
if (tech.isExtraMaxEnergy) {
|
||||||
tech.extraMaxHealth += Math.min(0.03 * powerUps.totalPowerUps, 0.51)
|
tech.healMaxEnergyBonus += 0.03 * powerUps.totalPowerUps //Math.min(0.02 * powerUps.totalPowerUps, 0.51)
|
||||||
m.setMaxHealth();
|
m.setMaxEnergy();
|
||||||
}
|
}
|
||||||
if (tech.isGunCycle) {
|
if (tech.isGunCycle) {
|
||||||
b.inventoryGun++;
|
b.inventoryGun++;
|
||||||
@@ -1099,9 +1099,7 @@ const level = {
|
|||||||
doCustomTopLayer = []
|
doCustomTopLayer = []
|
||||||
offset = { x: 0, y: 0 }
|
offset = { x: 0, y: 0 }
|
||||||
enterOptions = [
|
enterOptions = [
|
||||||
() => { //lasers
|
(x = offset.x, y = offset.y) => { //lasers
|
||||||
const x = offset.x
|
|
||||||
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 + 1850, y - 1350, 50, 450); //entrance left wall
|
spawn.mapRect(x + 1850, y - 1350, 50, 450); //entrance left wall
|
||||||
@@ -1163,9 +1161,7 @@ const level = {
|
|||||||
// }
|
// }
|
||||||
]
|
]
|
||||||
exitOptions = [
|
exitOptions = [
|
||||||
() => { //8 spinners
|
(x = offset.x, y = offset.y) => { //8 spinners
|
||||||
const x = offset.x
|
|
||||||
const y = offset.y
|
|
||||||
level.exit.x = x + 1250;
|
level.exit.x = x + 1250;
|
||||||
level.exit.y = y - 980;
|
level.exit.y = y - 980;
|
||||||
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20);
|
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20);
|
||||||
@@ -1188,7 +1184,7 @@ const level = {
|
|||||||
spawn.bodyRect(x + 1075, y - 1075, 100, 125, 0.25);
|
spawn.bodyRect(x + 1075, y - 1075, 100, 125, 0.25);
|
||||||
spawn.bodyRect(x + 1450, y - 1050, 100, 100, 0.25);
|
spawn.bodyRect(x + 1450, y - 1050, 100, 100, 0.25);
|
||||||
|
|
||||||
const density = 0.001
|
const density = 0.0015 + (simulation.difficultyMode < 3 ? 0.003 : 0)
|
||||||
const angle = 0
|
const angle = 0
|
||||||
const variance = Math.PI
|
const variance = Math.PI
|
||||||
const frictionAir = 0
|
const frictionAir = 0
|
||||||
@@ -1240,9 +1236,7 @@ const level = {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
() => { //7 spinners
|
(x = offset.x, y = offset.y) => { //7 spinners
|
||||||
const x = offset.x
|
|
||||||
const y = offset.y
|
|
||||||
level.exit.x = x + 2450;
|
level.exit.x = x + 2450;
|
||||||
level.exit.y = y - 980;
|
level.exit.y = y - 980;
|
||||||
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20);
|
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20);
|
||||||
@@ -1252,33 +1246,39 @@ const level = {
|
|||||||
spawn.bodyRect(x + 1275, y - 475, 125, 125, 0.25);
|
spawn.bodyRect(x + 1275, y - 475, 125, 125, 0.25);
|
||||||
spawn.bodyRect(x + 1825, y - 125, 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 + 500, y - 100, 125, 100, 0.25);
|
||||||
spawn.bodyRect(x + 0, y - 150, 100, 150, 0.25);
|
spawn.bodyRect(x + 800, y - 150, 100, 150, 0.25);
|
||||||
spawn.bodyRect(x + 2375, y - 150, 125, 150, 0.25);
|
spawn.bodyRect(x + 2375, y - 150, 125, 150, 0.25);
|
||||||
|
|
||||||
if (Math.random() > 0.5) {
|
if (Math.random() > 0.5) {
|
||||||
const density = 0.0013
|
const density = 0.0012 + (simulation.difficultyMode < 3 ? 0.002 : 0)
|
||||||
const angle = Math.PI / 2
|
const angle = Math.PI / 2
|
||||||
const variance = 0.3 //Math.PI
|
const variance = 0.2 //Math.PI
|
||||||
const frictionAir = 0.01
|
const frictionAir = 0.012
|
||||||
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) {
|
const height = 35
|
||||||
balance3 = level.spinner(x + 600, y - 600, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
balance1 = level.spinner(x + 1150, y - 500, height, 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 + 125, y - 850, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
balance3 = level.spinner(x + 600, y - 600, height, 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)
|
balance2 = level.spinner(x + 125, y - 850, height, 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)
|
balance4 = level.spinner(x + 650, y - 1145, height, 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)
|
balance5 = level.spinner(x + 1100, y - 1145, height, 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)
|
balance6 = level.spinner(x + 1550, y - 1145, height, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
||||||
|
balance7 = level.spinner(x + 2000, y - 1145, height, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
||||||
} else {
|
} else {
|
||||||
const density = 0.0013
|
const density = 0.001 + (simulation.difficultyMode < 3 ? 0.002 : 0)
|
||||||
const angle = Math.PI / 2
|
const angle = Math.PI / 2
|
||||||
const variance = 0 //Math.PI
|
const variance = Math.PI
|
||||||
const frictionAir = 0.01
|
const frictionAir = 0
|
||||||
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) {
|
const width = 200
|
||||||
balance2 = level.spinner(x + 2300, y - 550, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
const height = 200
|
||||||
balance4 = level.spinner(x + 1850, y - 550, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
const angularVelocity = 0.01
|
||||||
balance3 = level.spinner(x + 650, y - 700, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
const spinVariance = 0.02
|
||||||
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)
|
balance1 = level.spinner(x + 50, y - 350, height, width, density, angle + variance * (Math.random() - 0.5), frictionAir, angularVelocity + spinVariance * (Math.random() - 0.5)) // spinner(x, y, width, height, density = 0.001, angle=0,frictionAir=0.001,angularVelocity=0) {
|
||||||
balance7 = level.spinner(x + 1970, y - 1150, 25, 410, density, angle + variance * (Math.random() - 0.5), frictionAir)
|
balance4 = level.spinner(x + 350, y - 550, height, width, density, angle + variance * (Math.random() - 0.5), frictionAir, angularVelocity + spinVariance * (Math.random() - 0.5))
|
||||||
|
balance3 = level.spinner(x + 650, y - 700, height, width, density, angle + variance * (Math.random() - 0.5), frictionAir, angularVelocity + spinVariance * (Math.random() - 0.5))
|
||||||
|
balance5 = level.spinner(x + 950, y - 850, height, width, density, angle + variance * (Math.random() - 0.5), frictionAir, angularVelocity + spinVariance * (Math.random() - 0.5))
|
||||||
|
balance2 = level.spinner(x + 1250, y - 650, height, width, density, angle + variance * (Math.random() - 0.5), frictionAir, angularVelocity + spinVariance * (Math.random() - 0.5))
|
||||||
|
balance6 = level.spinner(x + 1600, y - 850, height, width, density, angle + variance * (Math.random() - 0.5), frictionAir, angularVelocity + spinVariance * (Math.random() - 0.5))
|
||||||
|
balance7 = level.spinner(x + 2000, y - 800, height, width, density, angle + variance * (Math.random() - 0.5), frictionAir, angularVelocity + spinVariance * (Math.random() - 0.5))
|
||||||
}
|
}
|
||||||
spawn.randomMob(x + 1175, y - 725, 0.1);
|
spawn.randomMob(x + 1175, y - 725, 0.1);
|
||||||
spawn.randomMob(x + 1450, y - 725, 0.2);
|
spawn.randomMob(x + 1450, y - 725, 0.2);
|
||||||
@@ -1314,35 +1314,78 @@ const level = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
emptyOptions = [ //nothing good here
|
emptyOptions = [ //nothing good here
|
||||||
() => {
|
(x = offset.x, y = offset.y) => {
|
||||||
const x = offset.x
|
|
||||||
const y = offset.y
|
|
||||||
if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) spawn.randomLevelBoss(x + 1250, y - 600);
|
if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) spawn.randomLevelBoss(x + 1250, y - 600);
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
lootOptions = [ //has some power up reward //field, ammo, research, gun
|
lootOptions = [ //has some power up reward //field, ammo, research, gun
|
||||||
() => {
|
(x = offset.x, y = offset.y) => {
|
||||||
const x = offset.x
|
|
||||||
const y = offset.y
|
|
||||||
powerUps.spawnStartingPowerUps(x + 1250, y - 100);
|
powerUps.spawnStartingPowerUps(x + 1250, y - 100);
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
upDownOptions = [ //extra tall vertical section 3000x3000 //this is where the level boss is
|
upDownOptions = [ //extra tall vertical section 3000x3000 //this is where the level boss is
|
||||||
|
(x = offset.x, y = offset.y) => {
|
||||||
|
const elevator1 = level.elevator(x + 1100, y - 200, 250, 30, -2100, 0.0015) // elevator(x, y, width, height, maxHeight, force = 0.003, friction = { up: 0.01, down: 0.2 }, isTeleport = false) {
|
||||||
|
const toggle = level.toggle(650, 0, false, true) // toggle(x, y, isOn = false, isLockOn = false) {
|
||||||
|
toggle.isAddedElements = false
|
||||||
|
|
||||||
|
doCustomTopLayer.push(
|
||||||
() => {
|
() => {
|
||||||
const x = offset.x
|
elevator1.move()
|
||||||
const y = offset.y
|
toggle.query();
|
||||||
|
if (toggle.isOn && !toggle.isAddedElements) {
|
||||||
|
toggle.isAddedElements = true //only do this once
|
||||||
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)
|
// if (simulation.difficulty > 3)
|
||||||
spawn.randomLevelBoss(x + 1250, y - 1400);
|
spawn.randomLevelBoss(x + 1250, y - 1400);
|
||||||
doCustomTopLayer.push(
|
|
||||||
() => {
|
spawn.mapRect(1375, -1400, 1375, 1225);
|
||||||
elevator.move()
|
len = map.length - 1
|
||||||
|
map[len].collisionFilter.category = cat.map;
|
||||||
|
map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
|
||||||
|
Matter.Body.setStatic(map[len], true); //make static
|
||||||
|
World.add(engine.world, map[len]); //add to world
|
||||||
|
|
||||||
|
// spawn.mapRect(1800, -1825, 725, 1550);
|
||||||
|
spawn.mapRect(-175, -1400, 1250, 1225);
|
||||||
|
len = map.length - 1
|
||||||
|
map[len].collisionFilter.category = cat.map;
|
||||||
|
map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
|
||||||
|
Matter.Body.setStatic(map[len], true); //make static
|
||||||
|
World.add(engine.world, map[len]); //add to world
|
||||||
|
|
||||||
|
//see map in world
|
||||||
|
simulation.draw.setPaths() //update map graphics
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
(x = offset.x, y = offset.y) => {
|
||||||
|
const elevator1 = level.elevator(x + 1100, y - 200, 250, 30, -2100, 0.0015) // elevator(x, y, width, height, maxHeight, force = 0.003, friction = { up: 0.01, down: 0.2 }, isTeleport = false) {
|
||||||
|
// const elevator1 = level.elevator(x + 175, y - 200, 250, 30, -1400, 0.001)
|
||||||
|
// const elevator2 = level.elevator(x + 2175, y - 200, 250, 30, -1400, 0.001)
|
||||||
|
|
||||||
|
spawn.mapRect(-200, -1400, 350, 50); //up left door ledge
|
||||||
|
spawn.mapRect(2450, -1400, 350, 50); //up right door ledge
|
||||||
|
|
||||||
|
spawn.mapRect(225, -450, 350, 350); //left crawl zone
|
||||||
|
// spawn.mapRect(725, -175, 275, 75);
|
||||||
|
spawn.mapRect(725, -225, 350, 100);
|
||||||
|
spawn.mapRect(275, -750, 200, 200);
|
||||||
|
spawn.mapRect(1375, -700, 500, 750); //right side big elevator wall
|
||||||
|
spawn.mapRect(2375, -325, 350, 50);
|
||||||
|
spawn.mapRect(1800, -500, 250, 50);
|
||||||
|
|
||||||
|
//up high elevator
|
||||||
|
spawn.mapRect(1375, -2100, 500, 175);
|
||||||
|
spawn.mapRect(600, -2100, 475, 175);
|
||||||
|
|
||||||
|
if (simulation.difficulty > 3) spawn.randomLevelBoss(x + 1250, y - 1400);
|
||||||
|
doCustomTopLayer.push(
|
||||||
|
() => {
|
||||||
|
elevator1.move()
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
//pick which type of room spawns
|
//pick which type of room spawns
|
||||||
@@ -1350,8 +1393,8 @@ const level = {
|
|||||||
exit = exitOptions[Math.floor(Math.random() * exitOptions.length)];
|
exit = exitOptions[Math.floor(Math.random() * exitOptions.length)];
|
||||||
empty = emptyOptions[Math.floor(Math.random() * emptyOptions.length)];
|
empty = emptyOptions[Math.floor(Math.random() * emptyOptions.length)];
|
||||||
loot = lootOptions[Math.floor(Math.random() * lootOptions.length)];
|
loot = lootOptions[Math.floor(Math.random() * lootOptions.length)];
|
||||||
upDown = upDownOptions[Math.floor(Math.random() * upDownOptions.length)];
|
// upDown = upDownOptions[Math.floor(Math.random() * upDownOptions.length)];
|
||||||
|
upDown = upDownOptions[0] //********************************* DO !NOT! RUN THIS LINE IN THE FINAL VERSION ***************************************
|
||||||
//3x2: 4 short rooms (3000x1500), 1 double tall room (3000x3000)
|
//3x2: 4 short rooms (3000x1500), 1 double tall room (3000x3000)
|
||||||
//rooms
|
//rooms
|
||||||
let rooms = ["enter", "empty", "loot", "exit"]
|
let rooms = ["enter", "empty", "loot", "exit"]
|
||||||
@@ -1457,7 +1500,7 @@ const level = {
|
|||||||
};
|
};
|
||||||
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 ***************************************
|
level.setPosToSpawn(200, -100); //********************************* 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
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ const m = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tech.isEnergyHealth) {
|
if (tech.isEnergyHealth) {
|
||||||
m.energy -= dmg * 1.1;
|
m.energy -= dmg * 1.15;
|
||||||
if (m.energy < 0 || isNaN(m.energy)) { //taking deadly damage
|
if (m.energy < 0 || isNaN(m.energy)) { //taking deadly damage
|
||||||
if (tech.isDeathAvoid && powerUps.research.count && !tech.isDeathAvoidedThisLevel) {
|
if (tech.isDeathAvoid && powerUps.research.count && !tech.isDeathAvoidedThisLevel) {
|
||||||
tech.isDeathAvoidedThisLevel = true
|
tech.isDeathAvoidedThisLevel = true
|
||||||
@@ -1312,7 +1312,7 @@ 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 (who.isOrbital) Matter.Body.setVelocity(who, { x: 0, y: 0 });
|
||||||
|
|
||||||
if (m.crouch) {
|
if (m.crouch) {
|
||||||
Matter.Body.setVelocity(player, {
|
Matter.Body.setVelocity(player, {
|
||||||
@@ -1332,7 +1332,7 @@ 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.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
|
||||||
|
|||||||
@@ -1104,42 +1104,6 @@ const simulation = {
|
|||||||
// if line1 and line2 are segments, they intersect if both of the above are true
|
// if line1 and line2 are segments, they intersect if both of the above are true
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
copyToClipBoard(value) {
|
|
||||||
// Create a fake textarea
|
|
||||||
const textAreaEle = document.createElement('textarea');
|
|
||||||
|
|
||||||
// Reset styles
|
|
||||||
textAreaEle.style.border = '0';
|
|
||||||
textAreaEle.style.padding = '0';
|
|
||||||
textAreaEle.style.margin = '0';
|
|
||||||
|
|
||||||
// Set the absolute position
|
|
||||||
// User won't see the element
|
|
||||||
textAreaEle.style.position = 'absolute';
|
|
||||||
textAreaEle.style.left = '-9999px';
|
|
||||||
textAreaEle.style.top = `0px`;
|
|
||||||
|
|
||||||
// Set the value
|
|
||||||
textAreaEle.value = value
|
|
||||||
|
|
||||||
// Append the textarea to body
|
|
||||||
document.body.appendChild(textAreaEle);
|
|
||||||
|
|
||||||
// Focus and select the text
|
|
||||||
textAreaEle.focus();
|
|
||||||
textAreaEle.select();
|
|
||||||
|
|
||||||
// Execute the "copy" command
|
|
||||||
try {
|
|
||||||
document.execCommand('copy');
|
|
||||||
} catch (err) {
|
|
||||||
// Unable to copy
|
|
||||||
console.log(err)
|
|
||||||
} finally {
|
|
||||||
// Remove the textarea
|
|
||||||
document.body.removeChild(textAreaEle);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
constructMouseDownPosition: {
|
constructMouseDownPosition: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
@@ -1160,18 +1124,6 @@ const simulation = {
|
|||||||
ctx.strokeRect(x, y, dx, dy);
|
ctx.strokeRect(x, y, dx, dy);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
outputMapString(string) {
|
|
||||||
if (string) simulation.constructMapString.push(string) //store command as a string in the next element of an array
|
|
||||||
let out = "" //combine set of map strings to one string
|
|
||||||
let outHTML = ""
|
|
||||||
for (let i = 0, len = simulation.constructMapString.length; i < len; i++) {
|
|
||||||
out += simulation.constructMapString[i];
|
|
||||||
outHTML += "<div>" + simulation.constructMapString[i] + "</div>"
|
|
||||||
}
|
|
||||||
console.log(out)
|
|
||||||
simulation.copyToClipBoard(out)
|
|
||||||
document.getElementById("construct").innerHTML = outHTML
|
|
||||||
},
|
|
||||||
enableConstructMode() {
|
enableConstructMode() {
|
||||||
simulation.isConstructionMode = true;
|
simulation.isConstructionMode = true;
|
||||||
simulation.isHorizontalFlipped = false;
|
simulation.isHorizontalFlipped = false;
|
||||||
@@ -1203,8 +1155,8 @@ const simulation = {
|
|||||||
map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
|
map[len].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
|
||||||
Matter.Body.setStatic(map[len], true); //make static
|
Matter.Body.setStatic(map[len], true); //make static
|
||||||
World.add(engine.world, map[len]); //add to world
|
World.add(engine.world, map[len]); //add to world
|
||||||
|
|
||||||
simulation.draw.setPaths() //update map graphics
|
simulation.draw.setPaths() //update map graphics
|
||||||
|
|
||||||
} else if (e.which === 3) { //add body
|
} else if (e.which === 3) { //add body
|
||||||
simulation.outputMapString(`spawn.bodyRect(${x}, ${y}, ${dx}, ${dy});`);
|
simulation.outputMapString(`spawn.bodyRect(${x}, ${y}, ${dx}, ${dy});`);
|
||||||
|
|
||||||
@@ -1246,5 +1198,53 @@ const simulation = {
|
|||||||
simulation.outputMapString();
|
simulation.outputMapString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
outputMapString(string) {
|
||||||
|
if (string) simulation.constructMapString.push(string) //store command as a string in the next element of an array
|
||||||
|
let out = "" //combine set of map strings to one string
|
||||||
|
let outHTML = ""
|
||||||
|
for (let i = 0, len = simulation.constructMapString.length; i < len; i++) {
|
||||||
|
out += simulation.constructMapString[i];
|
||||||
|
outHTML += "<div>" + simulation.constructMapString[i] + "</div>"
|
||||||
}
|
}
|
||||||
|
console.log(out)
|
||||||
|
navigator.clipboard.writeText(out).then(function() { /* clipboard successfully set */ }, function() { /* clipboard write failed */ console.log('copy failed') });
|
||||||
|
document.getElementById("construct").innerHTML = outHTML
|
||||||
|
},
|
||||||
|
// copyToClipBoard(value) {
|
||||||
|
// // Create a fake textarea
|
||||||
|
// const textAreaEle = document.createElement('textarea');
|
||||||
|
|
||||||
|
// // Reset styles
|
||||||
|
// textAreaEle.style.border = '0';
|
||||||
|
// textAreaEle.style.padding = '0';
|
||||||
|
// textAreaEle.style.margin = '0';
|
||||||
|
|
||||||
|
// // Set the absolute position
|
||||||
|
// // User won't see the element
|
||||||
|
// textAreaEle.style.position = 'absolute';
|
||||||
|
// textAreaEle.style.left = '-9999px';
|
||||||
|
// textAreaEle.style.top = `0px`;
|
||||||
|
|
||||||
|
// // Set the value
|
||||||
|
// textAreaEle.value = value
|
||||||
|
|
||||||
|
// // Append the textarea to body
|
||||||
|
// document.body.appendChild(textAreaEle);
|
||||||
|
|
||||||
|
// // Focus and select the text
|
||||||
|
// textAreaEle.focus();
|
||||||
|
// textAreaEle.select();
|
||||||
|
|
||||||
|
// // Execute the "copy" command
|
||||||
|
// try {
|
||||||
|
// document.execCommand('copy');
|
||||||
|
// } catch (err) {
|
||||||
|
// // Unable to copy
|
||||||
|
// console.log(err)
|
||||||
|
// } finally {
|
||||||
|
// // Remove the textarea
|
||||||
|
// document.body.removeChild(textAreaEle);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
};
|
};
|
||||||
@@ -1477,7 +1477,7 @@ const spawn = {
|
|||||||
mobs.spawn(x, y, 0, radius, "transparent");
|
mobs.spawn(x, y, 0, radius, "transparent");
|
||||||
let me = mob[mob.length - 1];
|
let me = mob[mob.length - 1];
|
||||||
Matter.Body.setDensity(me, 0.25); //extra dense //normal is 0.001
|
Matter.Body.setDensity(me, 0.25); //extra dense //normal is 0.001
|
||||||
me.laserRange = 350;
|
me.laserRange = 300;
|
||||||
me.seeAtDistance2 = 2000000;
|
me.seeAtDistance2 = 2000000;
|
||||||
me.isBoss = true;
|
me.isBoss = true;
|
||||||
me.showHealthBar = false; //drawn in this.awake
|
me.showHealthBar = false; //drawn in this.awake
|
||||||
@@ -1534,9 +1534,9 @@ const spawn = {
|
|||||||
const rotation = simulation.cycle * 0.015
|
const rotation = simulation.cycle * 0.015
|
||||||
const phase = simulation.cycle * 0.021
|
const phase = simulation.cycle * 0.021
|
||||||
ctx.lineWidth = 1;
|
ctx.lineWidth = 1;
|
||||||
ctx.fillStyle = "rgba(150,0,255,0.1)"
|
ctx.fillStyle = "rgba(150,0,255,0.05)"
|
||||||
ctx.strokeStyle = "#70f"
|
ctx.strokeStyle = "#70f"
|
||||||
for (let i = 0, len = 7; i < len; i++) {
|
for (let i = 0, len = 6; i < len; i++) {
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.ellipse(this.position.x, this.position.y, this.laserRange * Math.abs(Math.sin(phase + i / len * Math.PI)), this.laserRange, rotation, 0, 2 * Math.PI);
|
ctx.ellipse(this.position.x, this.position.y, this.laserRange * Math.abs(Math.sin(phase + i / len * Math.PI)), this.laserRange, rotation, 0, 2 * Math.PI);
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
|
|||||||
302
js/tech.js
302
js/tech.js
File diff suppressed because it is too large
Load Diff
10
todo.txt
10
todo.txt
@@ -1,11 +1,11 @@
|
|||||||
******************************************************** NEXT PATCH ********************************************************
|
******************************************************** NEXT PATCH ********************************************************
|
||||||
|
|
||||||
tech: quenching - if you're at full health heal power ups do harm but they also increase your max health
|
catabolism - lowers your max health by 1 (was 3 harm) and gives 4 ammo
|
||||||
|
inductive coupling - gives max energy for leftover power ups (was max health)
|
||||||
|
now requires mass-energy equivalence
|
||||||
|
|
||||||
you can play with camera smoothing now in the console
|
switched to a newer copy, paste URL
|
||||||
m.lookSmoothing = 0.07, //1 is instant/jerky, 0.01 is slow zoom, 0.07 is standard
|
this seems to fix issues with failed text copy in the level builder if you hold mouse down for over 6 seconds
|
||||||
|
|
||||||
more progress on level - labs
|
|
||||||
|
|
||||||
******************************************************** BUGS ********************************************************
|
******************************************************** BUGS ********************************************************
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user