constraints and gel hair

difficulty
  difficulty level 6 adds flat damage and damage taken
  bonus tech no longer spawns on level 2 and 3 on difficulty level 6
  at the end of subway you get 1 tech, but not on difficulty level 6
  difficulty level 3 and 5 add a random constraint that changes each level
constraints are effects that only last until the level ends
  50% JUNK chance
  4x shielded mob chance
  power ups are sent to next level
  +33% chance for mobs to respawn
  -1 choice
  2x ammo costs
  duplication is set to zero
  50% max energy
  50% max health
  bots follow slow
  full damage taken after boss dies
  0.1x damage after a power up
  mob death heals mobs
  mobs heal for your lost health
  periodically spawn WIMPs

exciton damage boost power up has a chance to spawn without the tech (~3%/mob)
  damage boost has a unique gel/hair aura for each skin
  damage boost timer no longer ticks with time dilation field
JUNK tech: stationary - thrown blocks can't move, but they still have momentum
added a classic n-gon link for the previous patch in settings
  but images are disabled to save space
on levels where you can fall endlessly, power ups will also fall endlessly
  they no longer teleport to the exit, sorry

Newton's 1st and 2nd laws are field tech, and they give twice the effect
abelian group 4->3x damage while invulnerable
bot fabrication price increases after 5->4 bots
wikipedia 4->3 research per correct quiz
upgraded sound bots fire fewer waves but do more damage per wave
  not much changed except improved performance, I think
incendiary ammunition drones explode when they run out of durability not on the first hit
  this allows better synergy with other drone tech
grappling hook retract momentum no longer scales with distance
  this should give you more control
pressing the 3rd button in factory will remove blocks resting on the second block
  preventing an endless toggle

bug fixes
  fleas no longer die early after hitting a high health target only once
  something with super ball density calculations for tech rebound
  grabbing a big block can make grappling hook go flying
    added 3 potential fixes, but the bug is too rare know if it's fixed
This commit is contained in:
landgreen
2024-08-12 16:34:33 -07:00
parent 8dacb023c0
commit 52046ca88b
12 changed files with 1425 additions and 893 deletions

View File

@@ -20,7 +20,8 @@
<body> <body>
<div id='guns'></div> <div id='guns'></div>
<div id='field'></div> <div id='field'></div>
<div id='tech'></div> <div id='right-HUD-constraint'></div>
<div id='right-HUD'></div>
<div id="text-log"></div> <div id="text-log"></div>
<div id="fade-out"></div> <div id="fade-out"></div>
<div id="health-bg"></div> <div id="health-bg"></div>
@@ -89,6 +90,7 @@
<option value="classic/7-15-2020/">n-gon: summer-2020</option> <option value="classic/7-15-2020/">n-gon: summer-2020</option>
<option value="classic/6-1-2021/">n-gon: spring-2021</option> <option value="classic/6-1-2021/">n-gon: spring-2021</option>
<option value="classic/11-1-2022/">n-gon: fall-2022</option> <option value="classic/11-1-2022/">n-gon: fall-2022</option>
<option value="classic/7-29-2024/">n-gon: summer-2024</option>
<option value="" selected>current version</option> <option value="" selected>current version</option>
</select> </select>
<br> <br>

View File

@@ -85,11 +85,13 @@ const b = {
if (tech.crouchAmmoCount && m.crouch) { if (tech.crouchAmmoCount && m.crouch) {
if (tech.crouchAmmoCount % 2) { if (tech.crouchAmmoCount % 2) {
b.guns[b.activeGun].ammo--; b.guns[b.activeGun].ammo--;
if (level.is2xAmmo && b.guns[b.activeGun].ammo > 0) b.guns[b.activeGun].ammo--;
simulation.updateGunHUD(); simulation.updateGunHUD();
} }
tech.crouchAmmoCount++ //makes the no ammo toggle off and on tech.crouchAmmoCount++ //makes the no ammo toggle off and on
} else { } else {
b.guns[b.activeGun].ammo--; b.guns[b.activeGun].ammo--;
if (level.is2xAmmo && b.guns[b.activeGun].ammo > 0) b.guns[b.activeGun].ammo--;
simulation.updateGunHUD(); simulation.updateGunHUD();
} }
}, },
@@ -1360,29 +1362,6 @@ const b = {
ctx.lineWidth = 0.5 ctx.lineWidth = 0.5
ctx.stroke(); ctx.stroke();
// ctx.lineTo(this.vertices[0].x, this.vertices[0].y);
// if (tech.isHookWire) {
// //draw wire
// const hitMob = Matter.Query.ray(mob, this.position, m.pos, 10)
// if (hitMob.length && m.immuneCycle < m.cycle) {
// for (let i = 0; i < hitMob.length; i++) {
// console.log(hitMob[i].bodyA)
// // simulation.drawList.push({ //add dmg to draw queue
// // x: path[path.length - 1].x,
// // y: path[path.length - 1].y,
// // radius: Math.sqrt(2000 * damage * best.who.damageReduction) + 2,
// // color: tech.laserColorAlpha,
// // time: simulation.drawTime
// // });
// hitMob[i].bodyA.damage(0.001)
// }
// }
// //draw glow around wire
// ctx.strokeStyle = "rgba(0,255,255,0.2)" // "#0ce"
// ctx.lineWidth = 20
// ctx.stroke();
// }
if (this.powerUpDamage) { if (this.powerUpDamage) {
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.vertices[0].x, this.vertices[0].y); ctx.moveTo(this.vertices[0].x, this.vertices[0].y);
@@ -1416,9 +1395,7 @@ const b = {
beforeDmg(who) { beforeDmg(who) {
if (tech.isShieldPierce && who.isShielded) { //disable shields if (tech.isShieldPierce && who.isShielded) { //disable shields
who.isShielded = false who.isShielded = false
requestAnimationFrame(() => { requestAnimationFrame(() => { who.isShielded = true });
who.isShielded = true
});
} }
if (m.fieldCDcycle < m.cycle + 40) m.fieldCDcycle = m.cycle + 40 //extra long cooldown on hitting mobs if (m.fieldCDcycle < m.cycle + 40) m.fieldCDcycle = m.cycle + 40 //extra long cooldown on hitting mobs
if (tech.hookNails) { if (tech.hookNails) {
@@ -1501,8 +1478,10 @@ const b = {
if (this.angularSpeed < 0.5) this.torque += this.inertia * 0.001 * (Math.random() - 0.5) //(Math.round(Math.random()) ? 1 : -1) if (this.angularSpeed < 0.5) this.torque += this.inertia * 0.001 * (Math.random() - 0.5) //(Math.round(Math.random()) ? 1 : -1)
this.collisionFilter.mask = 0//cat.map | cat.mob | cat.mobBullet | cat.mobShield // | cat.body this.collisionFilter.mask = 0//cat.map | cat.mob | cat.mobBullet | cat.mobShield // | cat.body
//recoil on pulling grapple back //recoil on pulling grapple back
const mag = this.pickUpTarget ? Math.max(this.pickUpTarget.mass, 0.5) : 0.5 // if (this.pickUpTarget.mass) console.log(this.pickUpTarget.mass)
const momentum = Vector.mult(Vector.sub(this.position, m.pos), mag * (m.crouch ? 0.0001 : 0.0002)) const mag = this.pickUpTarget ? Math.min(5, Math.max(this.pickUpTarget.mass, 0.5)) : 0.5
const unit = Vector.normalise(Vector.sub(this.position, m.pos))
const momentum = Vector.mult(unit, mag * (m.crouch ? 0.1 : 0.2))
player.force.x += momentum.x player.force.x += momentum.x
player.force.y += momentum.y player.force.y += momentum.y
}, },
@@ -1511,7 +1490,9 @@ const b = {
if (Vector.magnitude(Vector.sub(this.position, m.pos)) < returnRadius) { //near player if (Vector.magnitude(Vector.sub(this.position, m.pos)) < returnRadius) { //near player
this.endCycle = 0; this.endCycle = 0;
//recoil on catching grapple //recoil on catching grapple
const momentum = Vector.mult(Vector.sub(this.velocity, player.velocity), (m.crouch ? 0.0001 : 0.0002)) // const momentum = Vector.mult(Vector.sub(this.velocity, player.velocity), (m.crouch ? 0.0001 : 0.0002))
const unit = Vector.normalise(Vector.sub(this.velocity, player.velocity))
const momentum = Vector.mult(unit, (m.crouch ? 0.0001 : 0.0002))
player.force.x += momentum.x player.force.x += momentum.x
player.force.y += momentum.y player.force.y += momentum.y
if (this.pickUpTarget) { if (this.pickUpTarget) {
@@ -1530,8 +1511,11 @@ const b = {
// give block to player after it returns // give block to player after it returns
m.isHolding = true; m.isHolding = true;
//conserve momentum when player mass changes //conserve momentum when player mass changes
totalMomentum = Vector.add(Vector.mult(player.velocity, player.mass), Vector.mult(Vector.normalise(this.velocity), 15 * Math.min(20, this.pickUpTarget.mass))) const blockMass = Math.min(5, this.pickUpTarget.mass)
Matter.Body.setVelocity(player, Vector.mult(totalMomentum, 1 / (m.defaultMass + this.pickUpTarget.mass))); const grappleMomentum = Vector.mult(Vector.normalise(this.velocity), 15 * blockMass)
const playerMomentum = Vector.mult(player.velocity, player.mass)
totalMomentum = Vector.add(playerMomentum, grappleMomentum)
Matter.Body.setVelocity(player, Vector.mult(totalMomentum, 1 / (m.defaultMass + blockMass)));
m.definePlayerMass(m.defaultMass + this.pickUpTarget.mass * m.holdingMassScale) m.definePlayerMass(m.defaultMass + this.pickUpTarget.mass * m.holdingMassScale)
//make block collide with nothing //make block collide with nothing
@@ -1542,7 +1526,7 @@ const b = {
} else { } else {
if (m.energy > this.drain) m.energy -= this.drain if (m.energy > this.drain) m.energy -= this.drain
const sub = Vector.sub(this.position, m.pos) const sub = Vector.sub(this.position, m.pos)
const rangeScale = 1 + 0.000001 * Vector.magnitude(sub) * Vector.magnitude(sub) //return faster when far from player const rangeScale = 1 + 0.000003 * Vector.magnitude(sub) //return faster when far from player
const returnForce = Vector.mult(Vector.normalise(sub), rangeScale * this.thrustMag * this.mass) const returnForce = Vector.mult(Vector.normalise(sub), rangeScale * this.thrustMag * this.mass)
this.force.x -= returnForce.x this.force.x -= returnForce.x
this.force.y -= returnForce.y this.force.y -= returnForce.y
@@ -1582,16 +1566,13 @@ const b = {
//position block on hook //position block on hook
Matter.Body.setPosition(this.pickUpTarget, Vector.add(this.vertices[2], this.velocity)) Matter.Body.setPosition(this.pickUpTarget, Vector.add(this.vertices[2], this.velocity))
Matter.Body.setVelocity(this.pickUpTarget, { x: 0, y: 0 }) Matter.Body.setVelocity(this.pickUpTarget, { x: 0, y: 0 })
} else { // if (!input.down) } else {
const blocks = Matter.Query.collides(this, body) const blocks = Matter.Query.collides(this, body)
if (blocks.length) { if (blocks.length) {
// console.log(blocks)
for (let i = 0; i < blocks.length; i++) { for (let i = 0; i < blocks.length; i++) {
if (blocks[i].bodyA.classType === "body" && !blocks[i].bodyA.isNotHoldable && blocks[0].bodyA.mass < 60) { if (blocks[i].bodyA.classType === "body" && !blocks[i].bodyA.isNotHoldable && blocks[0].bodyA.mass < 40) {
this.retract() this.retract()
if (tech.hookNails) { if (tech.hookNails) {
// if (m.immuneCycle < m.cycle + m.collisionImmuneCycles) m.immuneCycle = m.cycle + 5; //player is immune to damage for 5 cycles
// b.explosion(this.position, 300 + 150 * Math.random()); //makes bullet do explosive damage at end
b.targetedNail(this.position, 3 * tech.hookNails) b.targetedNail(this.position, 3 * tech.hookNails)
const ANGLE = 2 * Math.PI * Math.random() //make a few random ones const ANGLE = 2 * Math.PI * Math.random() //make a few random ones
for (let i = 0; i < 13; i++) b.nail(this.position, { x: 10.5 * Math.cos(ANGLE), y: 10.5 * Math.sin(ANGLE) }, 1.2) for (let i = 0; i < 13; i++) b.nail(this.position, { x: 10.5 * Math.cos(ANGLE), y: 10.5 * Math.sin(ANGLE) }, 1.2)
@@ -1620,22 +1601,7 @@ const b = {
this.blockDist = Vector.magnitude(Vector.sub(this.pickUpTarget.position, m.pos)) this.blockDist = Vector.magnitude(Vector.sub(this.pickUpTarget.position, m.pos))
} }
} }
// else if (blocks[i].bodyB.classType === "body" && !blocks[i].bodyB.isNotHoldable && blocks[0].bodyB.mass < 60) {
// this.retract()
// this.pickUpTarget = blocks[i].bodyB
// this.blockDist = Vector.magnitude(Vector.sub(this.pickUpTarget.position, m.pos))
// if (tech.hookNails) {
// // if (m.immuneCycle < m.cycle + m.collisionImmuneCycles) m.immuneCycle = m.cycle + 5; //player is immune to damage for 5 cycles
// // b.explosion(this.position, 300 + 150 * Math.random()); //makes bullet do explosive damage at end
// b.targetedNail(this.position, tech.hookNails)
// const ANGLE = 2 * Math.PI * Math.random() //make a few random ones
// for (let i = 0; i < 4; i++) b.nail(this.position, { x: 10.5 * Math.cos(ANGLE), y: 10.5 * Math.sin(ANGLE) }, 1.2)
// }
// }
} }
// if (blocks[0].bodyA.mass > 2.5 && blocks[0].bodyA.mass > 15) {
} }
} }
}, },
@@ -1665,41 +1631,17 @@ const b = {
}, },
do() { do() {
if (m.fieldCDcycle < m.cycle + 5) m.fieldCDcycle = m.cycle + 5 if (m.fieldCDcycle < m.cycle + 5) m.fieldCDcycle = m.cycle + 5
if (input.field) { //&& !Matter.Query.collides(this, body).length if (input.field) {
// this.destroyBlocks()
this.grabBlocks() this.grabBlocks()
this.grabPowerUp() this.grabPowerUp()
// if (this.endCycle < simulation.cycle + 1) { //if at end of lifespan, but player is holding down field, force retraction
// this.endCycle = simulation.cycle + 30
// // m.fireCDcycle = m.cycle + 120 // cool down
// this.do = this.returnToPlayer
// Matter.Body.setDensity(this, 0.0005); //reduce density on return
// if (this.angularSpeed < 0.5) this.torque += this.inertia * 0.001 * (Math.random() - 0.5) //(Math.round(Math.random()) ? 1 : -1)
// this.collisionFilter.mask = cat.map | cat.mob | cat.mobBullet | cat.mobShield // | cat.body
// }
} else { } else {
//if not enough energy
// if (m.energy < 0.01) this.dropCaughtPowerUp()
// const returnForce = Vector.mult(Vector.normalise(Vector.sub(this.position, m.pos)), 3 * this.thrustMag * this.mass)
// this.force.x -= returnForce.x
// this.force.y -= returnForce.y
// this.frictionAir = 0.002
// this.do = () => {
// if (this.speed < 20) this.force.y += 0.0005 * this.mass;
// }
// } else {
//return to player
this.retract() this.retract()
// }
} }
//grappling hook //grappling hook
if (input.field && Matter.Query.collides(this, map).length) { if (input.field && Matter.Query.collides(this, map).length) {
Matter.Body.setPosition(this, Vector.add(this.position, { x: -20 * Math.cos(this.angle), y: -20 * Math.sin(this.angle) })) Matter.Body.setPosition(this, Vector.add(this.position, { x: -20 * Math.cos(this.angle), y: -20 * Math.sin(this.angle) }))
if (Matter.Query.collides(this, map).length) { if (Matter.Query.collides(this, map).length) {
if (tech.hookNails) { if (tech.hookNails) {
// if (m.immuneCycle < m.cycle + m.collisionImmuneCycles) m.immuneCycle = m.cycle + 5; //player is immune to damage for 5 cycles
// b.explosion(this.position, 200 + 150 * Math.random()); //makes bullet do explosive damage at end
b.targetedNail(this.position, tech.hookNails) b.targetedNail(this.position, tech.hookNails)
const ANGLE = 2 * Math.PI * Math.random() //make a few random ones const ANGLE = 2 * Math.PI * Math.random() //make a few random ones
for (let i = 0; i < 4; i++) b.nail(this.position, { x: 10.5 * Math.cos(ANGLE), y: 10.5 * Math.sin(ANGLE) }, 1.2) for (let i = 0; i < 4; i++) b.nail(this.position, { x: 10.5 * Math.cos(ANGLE), y: 10.5 * Math.sin(ANGLE) }, 1.2)
@@ -1709,22 +1651,14 @@ const b = {
Matter.Body.setVelocity(this, { x: 0, y: 0 }); Matter.Body.setVelocity(this, { x: 0, y: 0 });
Matter.Sleeping.set(this, true) Matter.Sleeping.set(this, true)
this.endCycle = simulation.cycle + 5 this.endCycle = simulation.cycle + 5
// this.dropCaughtPowerUp()
this.do = () => { this.do = () => {
if (m.fieldCDcycle < m.cycle + 5) m.fieldCDcycle = m.cycle + 5 if (m.fieldCDcycle < m.cycle + 5) m.fieldCDcycle = m.cycle + 5
// if (this.caughtPowerUp) {
// Matter.Body.setPosition(this.caughtPowerUp, Vector.add(this.vertices[2], this.velocity))
// Matter.Body.setVelocity(this.caughtPowerUp, { x: 0, y: 0 })
// }
this.grabPowerUp() this.grabPowerUp()
//between player nose and the grapple //between player nose and the grapple
const sub = Vector.sub(this.vertices[0], { x: m.pos.x + 30 * Math.cos(m.angle), y: m.pos.y + 30 * Math.sin(m.angle) }) const sub = Vector.sub(this.vertices[0], { x: m.pos.x + 30 * Math.cos(m.angle), y: m.pos.y + 30 * Math.sin(m.angle) })
let dist = Vector.magnitude(sub) let dist = Vector.magnitude(sub)
if (input.field) { if (input.field) {
// m.fireCDcycle = m.cycle + 30; // cool down if out of energy
// m.fireCDcycle = m.cycle + 5 + 40 * b.fireCDscale + 60 * (m.energy < 0.05)
// if (m.fieldCDcycle < m.cycle + 5) m.fieldCDcycle = m.cycle + 5
this.endCycle = simulation.cycle + 10 this.endCycle = simulation.cycle + 10
if (input.down) { //down if (input.down) { //down
this.isSlowPull = true this.isSlowPull = true
@@ -1738,52 +1672,18 @@ const b = {
// pulling friction that allowed a slight swinging, but has high linear pull at short dist // pulling friction that allowed a slight swinging, but has high linear pull at short dist
const drag = 1 - 30 / Math.min(Math.max(100, dist), 700) - 0.1 * (player.speed > 66) const drag = 1 - 30 / Math.min(Math.max(100, dist), 700) - 0.1 * (player.speed > 66)
// console.log(player.speed)
Matter.Body.setVelocity(player, { x: player.velocity.x * drag, y: player.velocity.y * drag }); Matter.Body.setVelocity(player, { x: player.velocity.x * drag, y: player.velocity.y * drag });
const pullScale = 0.0004 const pull = Vector.mult(Vector.normalise(sub), 0.0004 * Math.min(Math.max(15, dist), this.isSlowPull ? 70 : 200))
const pull = Vector.mult(Vector.normalise(sub), pullScale * Math.min(Math.max(15, dist), this.isSlowPull ? 70 : 200))
//original pulling force with high friction and very linear pull //original pulling force with high friction and very linear pull
// Matter.Body.setVelocity(player, { x: player.velocity.x * 0.85, y: player.velocity.y * 0.85 }); // Matter.Body.setVelocity(player, { x: player.velocity.x * 0.85, y: player.velocity.y * 0.85 });
// const pull = Vector.mult(Vector.normalise(sub), 0.0008 * Math.min(Math.max(15, dist), this.isSlowPull ? 100 : 200)) // const pull = Vector.mult(Vector.normalise(sub), 0.0008 * Math.min(Math.max(15, dist), this.isSlowPull ? 100 : 200))
player.force.x += pull.x player.force.x += pull.x
player.force.y += pull.y player.force.y += pull.y
if (dist > 500) { if (dist > 500) m.energy -= this.drain
m.energy -= this.drain
// if (m.energy < 0) this.endCycle = 0;
}
// if (tech.isImmuneGrapple && m.immuneCycle < m.cycle + 10) {
// m.immuneCycle = m.cycle + 10;
// if (m.energy > 0.001) {
// m.energy -= 0.001
// } else { //out of energy
// Matter.Sleeping.set(this, false)
// this.collisionFilter.category = 0
// this.collisionFilter.mask = 0
// this.do = this.returnToPlayer
// this.endCycle = simulation.cycle + 60
// // m.fireCDcycle = m.cycle + 120; //fire cooldown
// if (m.fieldCDcycle < m.cycle + 120) m.fieldCDcycle = m.cycle + 120
// //recoil on catching
// const momentum = Vector.mult(Vector.sub(this.velocity, player.velocity), (m.crouch ? 0.0001 : 0.0002))
// player.force.x += momentum.x
// player.force.y += momentum.y
// }
// }
} else { } else {
Matter.Sleeping.set(this, false) Matter.Sleeping.set(this, false)
this.retract() this.retract()
// Matter.Sleeping.set(this, false)
// this.collisionFilter.category = 0
// this.collisionFilter.mask = 0
// this.do = this.returnToPlayer
// this.endCycle = simulation.cycle + 60
// //recoil on catching
// const momentum = Vector.mult(Vector.sub(this.velocity, player.velocity), (m.crouch ? 0.0001 : 0.0002))
// player.force.x += momentum.x
// player.force.y += momentum.y
} }
this.draw(); this.draw();
} }
@@ -1976,6 +1876,7 @@ const b = {
// refund ammo // refund ammo
if (isReturnAmmo) { if (isReturnAmmo) {
b.guns[9].ammo++; b.guns[9].ammo++;
if (level.is2xAmmo) b.guns[9].ammo++;
simulation.updateGunHUD(); simulation.updateGunHUD();
// 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
// if (b.guns[i].name === "harpoon") { // if (b.guns[i].name === "harpoon") {
@@ -3101,13 +3002,13 @@ const b = {
cd: simulation.cycle + 10, cd: simulation.cycle + 10,
dmg: 0, dmg: 0,
setDamage() { //dmg is set to zero after doing damage once, and set back to normal after jumping setDamage() { //dmg is set to zero after doing damage once, and set back to normal after jumping
this.dmg = radius * (tech.isMutualism ? 2.9 : 1) //damage done in addition to the damage from momentum //spores do 7 dmg, worms do 18 this.dmg = radius * (tech.isMutualism ? 3.3 : 1.1) //damage done in addition to the damage from momentum //spores do 7 dmg, worms do 18
}, },
beforeDmg(who) { beforeDmg(who) {
Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(Vector.sub(this.position, who.position)), 10 + 10 * Math.random())); //push away from target Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(Vector.sub(this.position, who.position)), 10 + 10 * Math.random())); //push away from target
this.cd = simulation.cycle + this.delay; this.cd = simulation.cycle + this.delay;
if (!who.isInvulnerable) { if (!who.isInvulnerable && this.dmg !== 0) {
this.endCycle -= 130 this.endCycle -= 110
if (tech.isSporeFreeze) mobs.statusSlow(who, 90) if (tech.isSporeFreeze) mobs.statusSlow(who, 90)
if (tech.isSpawnBulletsOnDeath && who.alive && who.isDropPowerUp) { if (tech.isSpawnBulletsOnDeath && who.alive && who.isDropPowerUp) {
setTimeout(() => { setTimeout(() => {
@@ -3164,10 +3065,7 @@ const b = {
if (tech.isSporeFollow && !this.lockedOn && Matter.Query.ray(map, this.position, m.pos).length === 0) { if (tech.isSporeFollow && !this.lockedOn && Matter.Query.ray(map, this.position, m.pos).length === 0) {
this.lockedOn = { //make target player if there are no mobs to target this.lockedOn = { //make target player if there are no mobs to target
position: m.pos, position: m.pos,
velocity: { velocity: { x: 0, y: 0 }
x: 0,
y: 0
}
} }
} }
if (this.lockedOn) { //hop towards mob target if (this.lockedOn) { //hop towards mob target
@@ -3189,10 +3087,7 @@ const b = {
} }
this.force.y = -(0.03 + 0.08 * Math.random()) * this.mass this.force.y = -(0.03 + 0.08 * Math.random()) * this.mass
} }
Matter.Body.setVelocity(this, { Matter.Body.setVelocity(this, { x: 0, y: 0 });
x: 0,
y: 0
});
this.setDamage() //after jumping damage is no longer zero this.setDamage() //after jumping damage is no longer zero
} }
} }
@@ -3262,17 +3157,17 @@ const b = {
Matter.Body.setVelocity(this, { x: unit.x, y: unit.y }); Matter.Body.setVelocity(this, { x: unit.x, y: unit.y });
this.lockedOn = null this.lockedOn = null
} else { } else {
if (tech.isIncendiary && simulation.cycle + this.deathCycles < this.endCycle && !tech.isForeverDrones) { // if (tech.isIncendiary && simulation.cycle + this.deathCycles < this.endCycle && !tech.isForeverDrones) {
const max = Math.max(Math.min(this.endCycle - simulation.cycle - this.deathCycles, 1500), 0) // const max = Math.max(Math.min(this.endCycle - simulation.cycle - this.deathCycles, 1500), 0)
b.explosion(this.position, max * 0.14 + this.isImproved * 110 + 60 * Math.random()); //makes bullet do explosive damage at end // b.explosion(this.position, max * 0.14 + this.isImproved * 110 + 60 * Math.random()); //makes bullet do explosive damage at end
if (tech.isForeverDrones) { // if (tech.isForeverDrones) {
this.endCycle = 0 // this.endCycle = 0
b.drone({ x: m.pos.x + 30 * (Math.random() - 0.5), y: m.pos.y + 30 * (Math.random() - 0.5) }, 5) // b.drone({ x: m.pos.x + 30 * (Math.random() - 0.5), y: m.pos.y + 30 * (Math.random() - 0.5) }, 5)
bullet[bullet.length - 1].endCycle = Infinity // bullet[bullet.length - 1].endCycle = Infinity
} else { // } else {
this.endCycle -= max // this.endCycle -= max
} // }
} else { // } else {
//move away from target after hitting //move away from target after hitting
const unit = Vector.mult(Vector.normalise(Vector.sub(this.position, who.position)), -20) const unit = Vector.mult(Vector.normalise(Vector.sub(this.position, who.position)), -20)
Matter.Body.setVelocity(this, { x: unit.x, y: unit.y }); Matter.Body.setVelocity(this, { x: unit.x, y: unit.y });
@@ -3281,7 +3176,7 @@ const b = {
this.endCycle -= 60 this.endCycle -= 60
if (simulation.cycle + this.deathCycles > this.endCycle) this.endCycle = simulation.cycle + this.deathCycles if (simulation.cycle + this.deathCycles > this.endCycle) this.endCycle = simulation.cycle + this.deathCycles
} }
} // }
} }
}, },
onEnd() { onEnd() {
@@ -3344,8 +3239,15 @@ const b = {
const scale = 0.995; const scale = 0.995;
Matter.Body.scale(this, scale, scale); Matter.Body.scale(this, scale, scale);
}, },
hasExploded: false,
do() { do() {
if (simulation.cycle + this.deathCycles > this.endCycle) { if (simulation.cycle + this.deathCycles > this.endCycle) {
if (tech.isIncendiary && !this.hasExploded) {
this.hasExploded = true
// const max = Math.max(Math.min(this.endCycle - simulation.cycle - this.deathCycles, 1500), 0)
// this.endCycle -= max
b.explosion(this.position, 200 + this.isImproved * 110 + 60 * Math.random()); //makes bullet do explosive damage at end
}
this.restitution = 0.2; this.restitution = 0.2;
if (tech.isDroneRespawn) { if (tech.isDroneRespawn) {
this.do = this.doRespawning this.do = this.doRespawning
@@ -3749,8 +3651,7 @@ const b = {
bullet[me] = Bodies.polygon(where.x, where.y, 12, radius, b.fireAttributes(dir, false)); bullet[me] = Bodies.polygon(where.x, where.y, 12, radius, b.fireAttributes(dir, false));
Composite.add(engine.world, bullet[me]); //add bullet to world Composite.add(engine.world, bullet[me]); //add bullet to world
Matter.Body.setVelocity(bullet[me], velocity); Matter.Body.setVelocity(bullet[me], velocity);
bullet[me].calcDensity = function () { return 0.0007 + 0.0007 * tech.isSuperHarm + 0.0007 * tech.isBulletTeleport } Matter.Body.setDensity(bullet[me], 0.0007 + 0.0007 * tech.isSuperHarm + 0.0007 * tech.isBulletTeleport);
Matter.Body.setDensity(bullet[me], bullet[me].calcDensity());
bullet[me].endCycle = simulation.cycle + Math.floor(270 + 90 * Math.random()); bullet[me].endCycle = simulation.cycle + Math.floor(270 + 90 * Math.random());
bullet[me].minDmgSpeed = 0; bullet[me].minDmgSpeed = 0;
bullet[me].restitution = 1; bullet[me].restitution = 1;
@@ -3812,7 +3713,7 @@ const b = {
this.endCycle = 0 this.endCycle = 0
} else if (tech.isSuperBounce) { } else if (tech.isSuperBounce) {
const cycle = () => { const cycle = () => {
Matter.Body.setDensity(bullet[me], bullet[me].calcDensity() * 1.33);//33% more density and damage Matter.Body.setDensity(this, (0.0007 + 0.0007 * tech.isSuperHarm + 0.0007 * tech.isBulletTeleport) * 1.33);//33% more density and damage
this.endCycle = simulation.cycle + Math.floor(300 + 90 * Math.random()); //reset to full duration of time this.endCycle = simulation.cycle + Math.floor(300 + 90 * Math.random()); //reset to full duration of time
Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(this.velocity), 60)); //reset to high velocity Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(this.velocity), 60)); //reset to high velocity
let count = 5 let count = 5
@@ -4614,31 +4515,31 @@ const b = {
for (let i = 0; i < tech.dynamoBotCount; i++) b.dynamoBot({ for (let i = 0; i < tech.dynamoBotCount; i++) b.dynamoBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
}) }, !level.isSlowBots)
for (let i = 0; i < tech.laserBotCount; i++) b.laserBot({ for (let i = 0; i < tech.laserBotCount; i++) b.laserBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
}) }, !level.isSlowBots)
for (let i = 0; i < tech.nailBotCount; i++) b.nailBot({ for (let i = 0; i < tech.nailBotCount; i++) b.nailBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
}) }, !level.isSlowBots)
for (let i = 0; i < tech.foamBotCount; i++) b.foamBot({ for (let i = 0; i < tech.foamBotCount; i++) b.foamBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
}) }, !level.isSlowBots)
for (let i = 0; i < tech.soundBotCount; i++) b.soundBot({ for (let i = 0; i < tech.soundBotCount; i++) b.soundBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
}) }, !level.isSlowBots)
for (let i = 0; i < tech.boomBotCount; i++) b.boomBot({ for (let i = 0; i < tech.boomBotCount; i++) b.boomBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
}) }, !level.isSlowBots)
for (let i = 0; i < tech.orbitBotCount; i++) b.orbitBot({ for (let i = 0; i < tech.orbitBotCount; i++) b.orbitBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
}) }, !level.isSlowBots)
for (let i = 0; i < tech.plasmaBotCount; i++) b.plasmaBot({ for (let i = 0; i < tech.plasmaBotCount; i++) b.plasmaBot({
x: player.position.x + 50 * (Math.random() - 0.5), x: player.position.x + 50 * (Math.random() - 0.5),
y: player.position.y + 50 * (Math.random() - 0.5) y: player.position.y + 50 * (Math.random() - 0.5)
@@ -5067,8 +4968,8 @@ const b = {
lookFrequency: 17 + Math.floor(7 * Math.random()) - 3 * tech.isSoundBotUpgrade, lookFrequency: 17 + Math.floor(7 * Math.random()) - 3 * tech.isSoundBotUpgrade,
cd: 0, cd: 0,
fireCount: 0, fireCount: 0,
fireLimit: 5 + 3 * tech.isSoundBotUpgrade, fireLimit: 5,
delay: Math.floor((140 + (tech.isSoundBotUpgrade ? 0 : 50))),// + 30 - 20 * tech.isFoamBotUpgrade,//20 + Math.floor(85 * b.fireCDscale) - 20 * tech.isFoamBotUpgrade, delay: Math.floor(140),// + 30 - 20 * tech.isFoamBotUpgrade,//20 + Math.floor(85 * b.fireCDscale) - 20 * tech.isFoamBotUpgrade,
acceleration: (isKeep ? 0.005 : 0.001) * (1 + 0.5 * Math.random()), acceleration: (isKeep ? 0.005 : 0.001) * (1 + 0.5 * Math.random()),
range: 60 * (1 + 0.3 * Math.random()) + 3 * b.totalBots() + !isKeep * 100, //how far from the player the bot will move range: 60 * (1 + 0.3 * Math.random()) + 3 * b.totalBots() + !isKeep * 100, //how far from the player the bot will move
endCycle: Infinity, endCycle: Infinity,
@@ -5092,11 +4993,11 @@ const b = {
arc: halfArc * 2, arc: halfArc * 2,
radius: 25, radius: 25,
resonanceCount: 0, resonanceCount: 0,
dmg: (tech.isUpgraded ? 3.5 : 1.5) * m.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.5 : 1), dmg: (tech.isUpgraded ? 9 : 1.5) * m.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.5 : 1),
}) })
}, },
fire() { fire() {
if (!(simulation.cycle % (6 - 2 * tech.isSoundBotUpgrade))) { if (!(simulation.cycle % 6)) {
this.fireCount++ this.fireCount++
if (this.fireCount > this.fireLimit) { if (this.fireCount > this.fireLimit) {
this.fireCount = 0 this.fireCount = 0

View File

@@ -443,7 +443,7 @@ const build = {
build.generatePauseLeft() //makes the left side of the pause menu with the tech build.generatePauseLeft() //makes the left side of the pause menu with the tech
build.generatePauseRight() //makes the right side of the pause menu with the tech build.generatePauseRight() //makes the right side of the pause menu with the tech
// build.sortTech('') //sorts tech into the order the player got them using tech.tech[i].cycle = m.cycle // build.sortTech('') //sorts tech into the order the player got them using tech.tech[i].cycle = m.cycle
document.getElementById("tech").style.display = "none" document.getElementById("right-HUD").style.display = "none"
document.getElementById("guns").style.display = "none" document.getElementById("guns").style.display = "none"
document.getElementById("field").style.display = "none" document.getElementById("field").style.display = "none"
document.getElementById("health").style.display = "none" document.getElementById("health").style.display = "none"
@@ -496,7 +496,7 @@ const build = {
<span style="float: right;">mass ${player.mass.toFixed(1)}</span> <span style="float: right;">mass ${player.mass.toFixed(1)}</span>
${m.coupling ? `<br><span style = 'font-size:90%;'>` + m.couplingDescription(m.coupling) + `</span> from ${(m.coupling).toFixed(0)} ${powerUps.orb.coupling(1)}` : ""} ${m.coupling ? `<br><span style = 'font-size:90%;'>` + m.couplingDescription(m.coupling) + `</span> from ${(m.coupling).toFixed(0)} ${powerUps.orb.coupling(1)}` : ""}
<br><strong class='color-dup'>duplication</strong> ${(tech.duplicationChance() * 100).toFixed(0)}% <br><strong class='color-dup'>duplication</strong> ${(tech.duplicationChance() * 100).toFixed(0)}%
<span style="float: right;"><strong class='color-junk'>JUNK</strong> ${(100 * tech.junkChance).toFixed(0)}%</span> <span style="float: right;"><strong class='color-junk'>JUNK</strong> ${(100 * (tech.junkChance + level.junkAdded)).toFixed(0)}%</span>
${botText} ${botText}
<br> <br>
<br> ${level.levelAnnounce()} <br> ${level.levelAnnounce()}
@@ -518,14 +518,15 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>" : ""}
<details id="difficulty-parameters-details" style="padding: 0 8px;"> <details id="difficulty-parameters-details" style="padding: 0 8px;">
<summary>difficulty parameters</summary> <summary>difficulty parameters</summary>
<div class="pause-details"> <div class="pause-details">
${simulation.difficultyMode > 0 ? `<div class="pause-difficulty-row"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div>` : " "} ${simulation.difficultyMode > 0 ? `<div class="pause-difficulty-row"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.2x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> boss on each level</div>` : " "}
${simulation.difficultyMode > 1 ? `<div class="pause-difficulty-row"><strong>-5</strong> initial <strong>power ups</strong><br><strong>faster</strong> mobs and <strong>more</strong> mobs</div>` : " "} ${simulation.difficultyMode > 1 ? `<div class="pause-difficulty-row"><strong>more</strong> mob per level<br><strong>faster</strong> mobs per level</div>` : " "}
${simulation.difficultyMode > 2 ? `<div class="pause-difficulty-row"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div>` : " "} ${simulation.difficultyMode > 2 ? `<div class="pause-difficulty-row"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.2x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> random <strong class="constraint">constraint</strong> on each level</div>` : " "}
${simulation.difficultyMode > 3 ? `<div class="pause-difficulty-row"><strong>+1</strong> boss per level<br><strong>-1</strong> ${powerUps.orb.tech()} per boss</div>` : " "} ${simulation.difficultyMode > 3 ? `<div class="pause-difficulty-row"><strong>+1</strong> boss on each level<br>bosses spawn <strong>1</strong> fewer ${powerUps.orb.tech()}</div>` : " "}
${simulation.difficultyMode > 4 ? `<div class="pause-difficulty-row"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div>` : " "} ${simulation.difficultyMode > 4 ? `<div class="pause-difficulty-row"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.2x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> random <strong class="constraint">constraint</strong> on each level</div>` : " "}
${simulation.difficultyMode > 5 ? `<div class="pause-difficulty-row"><strong>3x</strong> chance for <strong>shielded</strong> mobs<br><strong>-3</strong> initial power ups</div>` : " "} ${simulation.difficultyMode > 5 ? `<div class="pause-difficulty-row"><strong>0.5x</strong> initial <strong class='color-d'>damage</strong><br><strong>2x</strong> initial <strong class='color-defense'>damage taken</strong></div>` : " "}
</div> </div>
</details> </details>
${simulation.difficultyMode > 2 ? `<details id="constraints-details" style="padding: 0 8px;"><summary>active constraints</summary><div class="pause-details"><span class="constraint">${level.constraintDescription1}<br>${level.constraintDescription2}</span></div></details>` : ""}
</div>` </div>`
if (!localSettings.isHideHUD) text += `<div class="pause-grid-module card-background" style="height:auto;"> if (!localSettings.isHideHUD) text += `<div class="pause-grid-module card-background" style="height:auto;">
<details id = "console-log-details" style="padding: 0 8px;"> <details id = "console-log-details" style="padding: 0 8px;">
@@ -577,6 +578,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>" : ""}
document.getElementById("simulation-variables-details").open = localSettings.pauseMenuDetailsOpen[0] document.getElementById("simulation-variables-details").open = localSettings.pauseMenuDetailsOpen[0]
document.getElementById("difficulty-parameters-details").open = localSettings.pauseMenuDetailsOpen[1] document.getElementById("difficulty-parameters-details").open = localSettings.pauseMenuDetailsOpen[1]
document.getElementById("console-log-details").open = localSettings.pauseMenuDetailsOpen[2] document.getElementById("console-log-details").open = localSettings.pauseMenuDetailsOpen[2]
if (document.getElementById("constraints-details")) document.getElementById("constraints-details").open = localSettings.pauseMenuDetailsOpen[3]
} }
}); });
}, },
@@ -742,6 +744,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>" : ""}
if (document.getElementById("simulation-variables-details")) localSettings.pauseMenuDetailsOpen[0] = document.getElementById("simulation-variables-details").open if (document.getElementById("simulation-variables-details")) localSettings.pauseMenuDetailsOpen[0] = document.getElementById("simulation-variables-details").open
if (document.getElementById("difficulty-parameters-details")) localSettings.pauseMenuDetailsOpen[1] = document.getElementById("difficulty-parameters-details").open if (document.getElementById("difficulty-parameters-details")) localSettings.pauseMenuDetailsOpen[1] = document.getElementById("difficulty-parameters-details").open
if (document.getElementById("console-log-details")) localSettings.pauseMenuDetailsOpen[2] = document.getElementById("console-log-details").open if (document.getElementById("console-log-details")) localSettings.pauseMenuDetailsOpen[2] = document.getElementById("console-log-details").open
if (document.getElementById("constraints-details")) localSettings.pauseMenuDetailsOpen[3] = document.getElementById("constraints-details").open
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
} }
@@ -755,7 +758,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>" : ""}
document.getElementById("health-bg").style.display = "inline" document.getElementById("health-bg").style.display = "inline"
} }
if (!localSettings.isHideHUD) { if (!localSettings.isHideHUD) {
document.getElementById("tech").style.display = "inline" document.getElementById("right-HUD").style.display = "inline"
document.getElementById("defense-bar").style.display = "inline" document.getElementById("defense-bar").style.display = "inline"
document.getElementById("damage-bar").style.display = "inline" document.getElementById("damage-bar").style.display = "inline"
} }
@@ -1404,7 +1407,6 @@ window.addEventListener("keydown", function (event) {
simulation.previousGun(); simulation.previousGun();
break break
case input.key.pause: case input.key.pause:
if (input.isPauseKeyReady && m.alive && !build.isExperimentSelection) { if (input.isPauseKeyReady && m.alive && !build.isExperimentSelection) {
input.isPauseKeyReady = false input.isPauseKeyReady = false
setTimeout(function () { input.isPauseKeyReady = true }, 300); setTimeout(function () { input.isPauseKeyReady = true }, 300);
@@ -1464,7 +1466,7 @@ window.addEventListener("keydown", function (event) {
break break
case input.key.testing: case input.key.testing:
if (m.alive && localSettings.loreCount > 0 && !simulation.paused && !build.isExperimentSelection) { if (m.alive && localSettings.loreCount > 0 && !simulation.paused && !build.isExperimentSelection) {
if (simulation.difficultyMode > 4) { if (simulation.difficultyMode > 5) {
simulation.inGameConsole("<em>testing mode disabled for this difficulty</em>"); simulation.inGameConsole("<em>testing mode disabled for this difficulty</em>");
break break
} }
@@ -1686,7 +1688,7 @@ window.addEventListener("keydown", function (event) {
case "l": case "l":
document.getElementById("field").style.display = "none" document.getElementById("field").style.display = "none"
document.getElementById("guns").style.display = "none" document.getElementById("guns").style.display = "none"
document.getElementById("tech").style.display = "none" document.getElementById("right-HUD").style.display = "none"
break break
} }
} }
@@ -1841,7 +1843,7 @@ if (localSettings.isAllowed && !localSettings.isEmpty) {
lore.setTechGoal() lore.setTechGoal()
if (localSettings.pauseMenuDetailsOpen === undefined) { if (localSettings.pauseMenuDetailsOpen === undefined) {
localSettings.pauseMenuDetailsOpen = [true, false, false] localSettings.pauseMenuDetailsOpen = [true, false, false, true]
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
} }
} else { } else {
@@ -1865,7 +1867,7 @@ if (localSettings.isAllowed && !localSettings.isEmpty) {
key: undefined, key: undefined,
isHideImages: true, //default to hide images isHideImages: true, //default to hide images
isHideHUD: false, isHideHUD: false,
pauseMenuDetailsOpen: [true, false, false] pauseMenuDetailsOpen: [true, false, false, true]
}; };
input.setDefault() input.setDefault()
if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage

View File

@@ -36,29 +36,29 @@ const level = {
// simulation.molecularMode = 2 // simulation.molecularMode = 2
// m.damage(0.1); // m.damage(0.1);
// b.giveGuns("super balls") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser // b.giveGuns("super balls") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser
// b.giveGuns("shotgun") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser // b.giveGuns("spores") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser
// b.giveGuns("laser") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser // b.giveGuns("laser") //0 nail gun 1 shotgun 2 super balls 3 wave 4 missiles 5 grenades 6 spores 7 drones 8 foam 9 harpoon 10 mine 11 laser
// tech.laserColor = "#fff" // tech.laserColor = "#fff"
// tech.laserColorAlpha = "rgba(255, 255, 255, 0.5)" // tech.laserColorAlpha = "rgba(255, 255, 255, 0.5)"
// b.guns[8].ammo = 100000000 // b.guns[8].ammo = 100000000
// requestAnimationFrame(() => { tech.giveTech("stimulated emission") }); // requestAnimationFrame(() => { tech.giveTech("stimulated emission") });
// tech.giveTech("1st ionization energy") // tech.giveTech("Hilbert space")
// for (let i = 0; i < 1; ++i) tech.giveTech("emergence") // for (let i = 0; i < 1; ++i) tech.giveTech("decoherence")
// for (let i = 0; i < 1; ++i) tech.giveTech("foam-bot") // for (let i = 0; i < 1; ++i) tech.giveTech("mass-energy equivalence")
// for (let i = 0; i < 1; ++i) tech.giveTech("Bitter electromagnet") // for (let i = 0; i < 1; ++i) tech.giveTech("depolarization")
// requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("wikipedia") }); // requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("wikipedia") });
// requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("field coupling") }); // requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("field coupling") });
// for (let i = 0; i < 1; i++) tech.giveTech("Verlet integration") // for (let i = 0; i < 1; i++) tech.giveTech("interest")
// m.lastKillCycle = m.cycle // m.lastKillCycle = m.cycle
// for (let i = 0; i < 1; i++) powerUps.directSpawn(450, -50, "tech"); // for (let i = 0; i < 1; i++) powerUps.directSpawn(450, -50, "tech");
// for (let i = 0; i < 1; i++) powerUps.directSpawn(m.pos.x, m.pos.y - 50, "difficulty", false); // for (let i = 0; i < 3; i++) powerUps.directSpawn(m.pos.x + 200, m.pos.y - 50, "boost", false);
// spawn.mapRect(575, -700, 25, 425); //block mob line of site on testing // spawn.bodyRect(575, -700, 150, 150); //block mob line of site on testing
// level.testing(); // level.satellite();
level[simulation.isTraining ? "walk" : "initial"]() //normal starting level ************************************************** level[simulation.isTraining ? "walk" : "initial"]() //normal starting level **************************************************
// for (let i = 0; i < 1; ++i) spawn.powerUpBoss(1900, -500) // for (let i = 0; i < 1; ++i) spawn.revolutionBoss(1900, -500)
// for (let i = 0; i < 3; i++) spawn.starter(1900, -500) //ghosters need to spawn after the map loads // for (let i = 0; i < 3; i++) spawn.starter(1900, -500) //ghosters need to spawn after the map loads
// for (let i = 0; i < 1; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "entanglement"); // for (let i = 0; i < 1; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "entanglement");
@@ -96,10 +96,6 @@ const level = {
if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
} }
} }
if (!simulation.isTraining) {
document.title = "n-gon: " + level.levelAnnounce();
simulation.inGameConsole(`<span class='color-var'>level</span>.onLevel <span class='color-symbol'>=</span> "<span class='color-text'>${level.levels[level.onLevel]}</span>"`);
}
simulation.setupCamera(player.position); simulation.setupCamera(player.position);
simulation.setZoom(); simulation.setZoom();
level.addToWorld(); //add bodies to game engine level.addToWorld(); //add bodies to game engine
@@ -133,6 +129,29 @@ const level = {
powerUps.directSpawn(flip * localSettings.entanglement.position.x, localSettings.entanglement.position.y, "entanglement", false); powerUps.directSpawn(flip * localSettings.entanglement.position.x, localSettings.entanglement.position.y, "entanglement", false);
} }
level.newLevelOrPhase() level.newLevelOrPhase()
if (!simulation.isTraining) {
simulation.inGameConsole(`<span class='color-var'>level</span>.onLevel <span class='color-symbol'>=</span> "<span class='color-text'>${level.levels[level.onLevel]}</span>"`);
document.title = "n-gon: " + level.levelAnnounce();
}
level.setConstraints()
if (!localSettings.isHideHUD) {
requestAnimationFrame(() => {
//grow and get bright
document.getElementById("right-HUD-constraint").style.opacity = 1
document.getElementById("right-HUD-constraint").style.fontSize = "23px"
document.getElementById("right-HUD-constraint").style.top = simulation.difficultyMode > 4 ? "6px" : "9px"
setTimeout(() => {
if (m.alive) {
//fade to background
document.getElementById("right-HUD-constraint").style.opacity = 0.35
document.getElementById("right-HUD-constraint").style.fontSize = "20px"
document.getElementById("right-HUD-constraint").style.top = "12px"
}
}, 5000);
});
}
}, },
newLevelOrPhase() { //runs on each new level but also on final boss phases newLevelOrPhase() { //runs on each new level but also on final boss phases
//used for generalist and pigeonhole principle //used for generalist and pigeonhole principle
@@ -161,12 +180,23 @@ const level = {
} }
if (tech.interestRate > 0) { if (tech.interestRate > 0) {
const rate = ((level[level.levels[level.onLevel]].name === "final" || level[level.levels[level.onLevel]].name === "subway") ? 1 / 3 : 1) * tech.interestRate //this effect triggers extra times on these final levels const rate = ((level[level.levels[level.onLevel]].name === "final" || level[level.levels[level.onLevel]].name === "subway") ? 1 / 3 : 1) * tech.interestRate //this effect triggers extra times on these final levels
if (b.activeGun !== null && b.activeGun !== undefined && b.guns[b.activeGun].ammo !== Infinity) {
const ammoPerOrb = b.guns[b.activeGun].ammoPack let ammoSum = 0
const a = Math.ceil(rate * b.guns[b.activeGun].ammo / ammoPerOrb) for (let i = 0; i < b.inventory.length; i++) {
powerUps.spawnDelay("ammo", a, 4); if (b.guns[b.inventory[i]].ammo !== Infinity) ammoSum += b.guns[b.inventory[i]].ammo / b.guns[b.inventory[i]].ammoPack
simulation.inGameConsole(`${(rate * 100).toFixed(0)}<span class='color-symbol'>%</span> <span class='color-m'>interest</span> on <span class='color-g'>ammo</span> <span class='color-symbol'>=</span> ${a > 20 ? a + powerUps.orb.ammo(1) : powerUps.orb.ammo(a)}`)
} }
if (ammoSum > 0 && b.inventory.length > 0) {
const amount = Math.ceil(rate * ammoSum / b.inventory.length)
powerUps.spawnDelay("ammo", amount, 4);
simulation.inGameConsole(`${(rate * 100).toFixed(0)}<span class='color-symbol'>%</span> <span class='color-m'>interest</span> on <span class='color-g'>ammo</span> <span class='color-symbol'>=</span> ${amount > 20 ? amount + powerUps.orb.ammo(1) : powerUps.orb.ammo(amount)}`)
}
// if (b.activeGun !== null && b.activeGun !== undefined && b.guns[b.activeGun].ammo !== Infinity) {
// const ammoPerOrb = b.guns[b.activeGun].ammoPack
// const a = Math.ceil(rate * b.guns[b.activeGun].ammo / ammoPerOrb)
// powerUps.spawnDelay("ammo", a, 4);
// simulation.inGameConsole(`${(rate * 100).toFixed(0)}<span class='color-symbol'>%</span> <span class='color-m'>interest</span> on <span class='color-g'>ammo</span> <span class='color-symbol'>=</span> ${a > 20 ? a + powerUps.orb.ammo(1) : powerUps.orb.ammo(a)}`)
// }
if (powerUps.research.count > 0) { if (powerUps.research.count > 0) {
const r = Math.ceil(rate * powerUps.research.count) const r = Math.ceil(rate * powerUps.research.count)
simulation.inGameConsole(`${(rate * 100).toFixed(0)}<span class='color-symbol'>%</span> <span class='color-m'>interest</span> on <span class='color-r'>research</span> <span class='color-symbol'>=</span> ${r > 20 ? r + powerUps.orb.research(1) : powerUps.orb.research(r)}`) simulation.inGameConsole(`${(rate * 100).toFixed(0)}<span class='color-symbol'>%</span> <span class='color-m'>interest</span> on <span class='color-r'>research</span> <span class='color-symbol'>=</span> ${r > 20 ? r + powerUps.orb.research(1) : powerUps.orb.research(r)}`)
@@ -199,7 +229,6 @@ const level = {
index = i index = i
} }
} }
console.log(index)
if (index) { //eject it if (index) { //eject it
const effect = Math.pow(1.1, tech.tech[index].count) const effect = Math.pow(1.1, tech.tech[index].count)
simulation.inGameConsole(`<strong>${(effect).toFixed(2)}x</strong> <strong class='color-d'>damage</strong> <em>//from obsolescence</em>`, 360) simulation.inGameConsole(`<strong>${(effect).toFixed(2)}x</strong> <strong class='color-d'>damage</strong> <em>//from obsolescence</em>`, 360)
@@ -221,23 +250,6 @@ const level = {
simulation.difficulty = level.levelsCleared * simulation.difficultyMode simulation.difficulty = level.levelsCleared * simulation.difficultyMode
if (simulation.isTraining) simulation.difficulty = 1 if (simulation.isTraining) simulation.difficulty = 1
// old
// normal mode m.dmgScale = 1, 0.81, 0.63, 0.5
// why mode m.dmgScale = 1, 0.56, 0.3, 0.17
// new
//constraint 0,1 m.dmgScale = 1, 0.8, 0.6, 0.5
//constraint 2,3 m.dmgScale = 1,
//constraint 4,5 m.dmgScale = 1, 0.5, 0.3, 0.15
// old
//normal: simulation.dmgScale = 0.1, 0.5 ,1 ,1.5 ,2 ,2.5
//hard: simulation.dmgScale = 0.1, 1 ,2 ,3 ,4 ,5
//why: simulation.dmgScale = 0.1, 1.25 ,2.5 ,3.75 ,5 ,6.25
// new
//0,1: simulation.dmgScale = 0.1, 0.5 ,1 ,1.5 ,2 ,2.5
//2,3: simulation.dmgScale = 0.1, 1 ,2 ,3 ,4 ,5
//3,4: simulation.dmgScale = 0.1, 1.25 ,2.5 ,3.75 ,5 ,6.25
let scale = 1 let scale = 1
if (simulation.difficultyMode > 3) { if (simulation.difficultyMode > 3) {
scale = 3 scale = 3
@@ -245,9 +257,12 @@ const level = {
scale = 2 scale = 2
} }
m.dmgScale = Math.pow(0.87, level.levelsCleared * scale) m.dmgScale = Math.pow(0.87, level.levelsCleared * scale)
simulation.dmgScale = Math.max(0.1, 0.22 * level.levelsCleared * scale) //damage done by mobs scales with total levels simulation.dmgScale = Math.max(0.1, 0.22 * level.levelsCleared * scale) //damage done by mobs scales with total levels //a bigger number means the player takes more damage
if (simulation.difficultyMode === 6) {
m.dmgScale *= 0.5
simulation.dmgScale *= 2
}
//
simulation.healScale = 1 / (1 + simulation.difficulty * 0.043) //a higher denominator makes for lower heals // m.health += heal * simulation.healScale; simulation.healScale = 1 / (1 + simulation.difficulty * 0.043) //a higher denominator makes for lower heals // m.health += heal * simulation.healScale;
if (simulation.difficultyMode === 1) { if (simulation.difficultyMode === 1) {
simulation.accelScale = 1.1 simulation.accelScale = 1.1
@@ -257,17 +272,283 @@ const level = {
simulation.CDScale = Math.max(0.15, Math.pow(0.964, simulation.difficulty)) simulation.CDScale = Math.max(0.15, Math.pow(0.964, simulation.difficulty))
} }
}, },
// difficultyIncrease(num = 1) { constraintIndex: 0,
// for (let i = 0; i < num; i++) { setConstraints() {
// simulation.difficulty++ //populate array with possible constraints and reset constraints
// m.dmgScale *= 0.89; //damage done by player decreases each level level.constraintDescription1 = level.constraintDescription2 = ""
// if (simulation.accelScale < 6) simulation.accelScale *= 1.024 //mob acceleration increases each level const possible = []
// if (simulation.CDScale > 0.15) simulation.CDScale *= 0.964 //mob CD time decreases each level for (let i = 0; i < level.constraint.length; i++) {
// } level.constraint[i].remove()
// simulation.dmgScale = Math.max(0.1, 0.25 * simulation.difficulty) //damage done by mobs scales with total levels possible.push(i)
// simulation.healScale = 1 / (1 + simulation.difficulty * 0.043) //a higher denominator makes for lower heals // m.health += heal * simulation.healScale; }
// // console.log(`CD = ${simulation.CDScale}`) if (level.levels[level.onLevel] !== "null" && level.levels[level.onLevel] !== "initial" && !simulation.isTraining && m.alive && level.levelsCleared) {
// }, if (simulation.difficultyMode > 2 && possible.length) {
//choose a random constraint from possible array and remove it from that array
// const index = possible[Math.floor(possible.length * Math.random())]
// const index = level.constraintIndex
// level.constraintIndex = 0 //REMOVE THIS FROM LIVE GAME, FOR TESTING ONLY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
level.constraint[level.constraintIndex].effect()
possible.splice(level.constraintIndex, 1)
//generate text to describe the active constraints for the pause menu
level.constraintDescription1 = level.constraint[level.constraintIndex].description
// simulation.inGameConsole(`<span class='constraint'>${level.constraint[level.constraintIndex].description}</span>`, 900);
level.constraintIndex++
if (level.constraintIndex > level.constraint.length - 1) level.constraintIndex = 0
if (simulation.difficultyMode > 4 && possible.length) {
// const index = possible[Math.floor(possible.length * Math.random())]
level.constraint[level.constraintIndex].effect()
possible.splice(level.constraintIndex, 1)
level.constraintDescription2 += level.constraint[level.constraintIndex].description
// simulation.inGameConsole(`<span class='constraint'>${level.constraint[level.constraintIndex].description}</span>`, 900);
level.constraintIndex++
if (level.constraintIndex > level.constraint.length - 1) level.constraintIndex = 0
}
document.getElementById("right-HUD-constraint").style.display = "block";
} else {
document.getElementById("right-HUD-constraint").style.display = "none";
}
} else {
document.getElementById("right-HUD-constraint").style.display = "none";
}
//update HUD with constraints
let text = `${level.constraintDescription1}`
if (simulation.difficultyMode > 4 && level.constraintDescription2) {
text += `<br>${level.constraintDescription2}`
}
document.getElementById("right-HUD-constraint").innerHTML = text
if (level.constraintDescription1) {
if (level.constraintDescription2) {
document.getElementById("right-HUD").style.top = "80px";
} else {
document.getElementById("right-HUD").style.top = "57px"; //make room for tech list in "right-HUD"
}
} else {
document.getElementById("right-HUD").style.top = "15px";
}
},
constraintDescription1: "", //used in pause menu and console
constraintDescription2: "",
constraint: [
{
description: "0.5x max health",
effect() {
level.isReducedHealth = true
m.setMaxHealth()
},
remove() {
if (level.isReducedHealth) {
level.isReducedHealth = false
m.setMaxHealth()
m.addHealth(level.reducedHealthLost);
level.reducedHealthLost = 0
} else {
level.isReducedHealth = false
}
}
},
{
description: "periodically spawn WIMPs",
effect() {
simulation.ephemera.push({
name: "WIMPS",
time: 0,
levelName: level.levels[level.onLevel],
do() {
this.time++
if (level.levels[level.onLevel] === this.levelName) {
if (!(this.time % 900)) spawn.WIMP(level.enter.x, level.enter.y)
} else {
simulation.removeEphemera(this.name);
}
},
})
},
remove() {
}
},
{
description: "0.1x damage after getting power ups",
effect() {
level.isNoDamage = true
level.noDamageCycle = 0
},
remove() {
level.isNoDamage = false
level.noDamageCycle = 0
}
},
{
description: "mobs heal for your lost health",
effect() {
level.isMobHealPlayerDamage = true
},
remove() {
level.isMobHealPlayerDamage = false
}
},
{
description: "mob death heals nearby mobs",
effect() {
level.isMobDeathHeal = true
},
remove() {
level.isMobDeathHeal = false
}
},
{
description: "full damage taken after boss dies",
// description: "after boss dies damage taken = 1",
effect() {
level.noDefenseSetting = 1 //defense goes to zero once equal to 2
},
remove() {
level.noDefenseSetting = 0
}
},
{
description: "4x shielded mobs",
effect() {
level.isMobShields = true
},
remove() {
level.isMobShields = false
}
},
{
description: "50% JUNK chance",
effect() {
level.junkAdded = 0.5
},
remove() {
level.junkAdded = 0
}
},
{
description: "-1 choice",
effect() {
level.fewerChoices = true
},
remove() {
level.fewerChoices = false
}
},
{
description: "power ups in stasis",
effect() {
level.isNextLevelPowerUps = true
//remove all current power ups
for (let i = powerUp.length - 1; i > -1; i--) {
powerUps.powerUpStorage.push({ name: powerUp[i].name, size: powerUp[i].size })
Matter.Composite.remove(engine.world, powerUp[i]);
powerUp.splice(i, 1)
}
},
remove() {
level.isNextLevelPowerUps = false
if (powerUps.powerUpStorage.length) {
const delay = 5
let i = 0
let cycle = () => {
if (powerUps.powerUpStorage.length && m.alive && powerUp.length < 300) {
requestAnimationFrame(cycle);
if (!simulation.paused && !simulation.isChoosing) {
if (!(simulation.cycle % delay)) {
const where = { x: m.pos.x + 70 * (Math.random() - 0.5), y: m.pos.y + 70 * (Math.random() - 0.5) }
powerUps.directSpawn(where.x, where.y, powerUps.powerUpStorage[i].name, true, powerUps.powerUpStorage[i].size);
powerUps.powerUpStorage.splice(i, 1);
}
}
} else {
powerUps.powerUpStorage = []
}
}
requestAnimationFrame(cycle);
}
}
},
{
description: "33% of mobs respawn",
effect() {
level.isMobRespawn = true
},
remove() {
level.isMobRespawn = false
}
},
{
description: "0 duplication",
effect() {
level.isNoDuplicate = true
},
remove() {
level.isNoDuplicate = false
}
},
{
description: "2x ammo cost",
effect() {
level.is2xAmmo = true
},
remove() {
level.is2xAmmo = false
}
},
{
description: "0.5x max energy",
effect() {
level.isReducedEnergy = true
m.setMaxEnergy()
},
remove() {
if (level.isReducedEnergy) {
level.isReducedEnergy = false
m.setMaxEnergy()
} else {
level.isReducedEnergy = false
}
}
},
{
description: "slow bots",
effect() {
level.isSlowBots = true
b.clearPermanentBots();
b.respawnBots();
},
remove() {
if (level.isSlowBots) {
level.isSlowBots = false
b.clearPermanentBots();
b.respawnBots();
} else {
level.isSlowBots = false
}
}
},
],
isMobShields: false,
junkAdded: 0,
isNextLevelPowerUps: false,
isMobRespawn: false,
fewerChoices: false,
isNoDuplicate: false,
is2xAmmo: false,
isReducedEnergy: false,
isSlowBots: false,
noDefenseSetting: 0,
isMobDeathHeal: false,
isMobHealPlayerDamage: false,
isNoDamage: false,
noDamageCycle: 0,
reducedHealthLost: 0,
isReducedHealth: false,
levelAnnounce() { levelAnnounce() {
const cheating = simulation.isCheating ? "(testing)" : "" const cheating = simulation.isCheating ? "(testing)" : ""
if (level.levelsCleared === 0) { if (level.levelsCleared === 0) {
@@ -310,8 +591,6 @@ const level = {
} else { } else {
if (level.onLevel > level.levels.length - 1) level.onLevel = 0; if (level.onLevel > level.levels.length - 1) level.onLevel = 0;
} }
//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;
@@ -321,7 +600,8 @@ const level = {
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
//pop up new level info screen for a few seconds //|| level.levels[level.onLevel] === "subway" //pop up new level info screen for a few seconds //|| level.levels[level.onLevel] === "subway"
if (!localSettings.isHideHUD && !simulation.isCheating && m.alive && (level.levels[level.onLevel] === "final" || level.levels[level.onLevel] === "reactor")) { if (!localSettings.isHideHUD && m.alive && (level.levels[level.onLevel] === "final" || level.levels[level.onLevel] === "reactor")) {
// if (!localSettings.isHideHUD && m.alive) {
//pause //pause
if (!simulation.paused) { if (!simulation.paused) {
simulation.paused = true; simulation.paused = true;
@@ -330,7 +610,8 @@ const level = {
//build level info //build level info
document.getElementById("choose-grid").style.gridTemplateColumns = "250px" document.getElementById("choose-grid").style.gridTemplateColumns = "250px"
//onclick="level.unPause()" //onclick="level.unPause()"
let text = `<div><div class="card-background" style="height:auto; border: none; background-color: transparent; line-height: 160%; background-color: var(--card-color); font-size: 1.15em;"> <div class="card-text">` // if (level.levels[level.onLevel] === "final") { //|| level.levels[level.onLevel] === "reactor"
let text = `<div class="card-background" style="height:auto; border: none; background-color: transparent; line-height: 160%; background-color: var(--card-color); font-size: 1.15em;"> <div class="card-text">`
for (let i = 0; i < level.levels.length; i++) { for (let i = 0; i < level.levels.length; i++) {
if (i < level.levelsCleared) { if (i < level.levelsCleared) {
text += `<div style="user-select: none;">${level.levels[i]}</div>` text += `<div style="user-select: none;">${level.levels[i]}</div>`
@@ -345,14 +626,14 @@ const level = {
// text += `</div>` // text += `</div>`
} }
} }
text += `</div> </div></div>` text += `</div></div>`
document.getElementById("choose-grid").innerHTML = text document.getElementById("choose-grid").innerHTML = text
//show level info //show level info
document.getElementById("choose-grid").style.opacity = "1" document.getElementById("choose-grid").style.opacity = "1"
document.getElementById("choose-grid").style.transitionDuration = "0.25s"; //how long is the fade in on document.getElementById("choose-grid").style.transitionDuration = "0.25s"; //how long is the fade in on
document.getElementById("choose-grid").style.visibility = "visible" document.getElementById("choose-grid").style.visibility = "visible"
// }
simulation.draw.cons(); simulation.draw.cons();
simulation.draw.body(); simulation.draw.body();
level.customTopLayer(); level.customTopLayer();
@@ -386,37 +667,6 @@ const level = {
} }
requestAnimationFrame(newLevelDraw); requestAnimationFrame(newLevelDraw);
} }
// else {
// //pause
// if (!simulation.paused) {
// simulation.paused = true;
// simulation.isChoosing = true; //stops p from un pausing on key down
// }
// let count = countMax = simulation.testing ? 0 : 60
// let newLevelDraw = () => {
// count--
// if (count > 0) {
// requestAnimationFrame(newLevelDraw);
// } else { //unpause
// // if (m.immuneCycle < m.cycle + 15) m.immuneCycle = m.cycle + 30; //player is immune to damage for 30 cycles
// if (simulation.paused) requestAnimationFrame(cycle);
// if (m.alive) simulation.paused = false;
// simulation.isChoosing = false; //stops p from un pausing on key down
// build.unPauseGrid()
// }
// //draw
// simulation.wipe();
// m.look();
// simulation.camera();
// const scale = 30
// ctx.setLineDash([scale * (countMax - count), scale * count]);
// simulation.draw.wireFrame();
// ctx.setLineDash([]);
// ctx.restore();
// simulation.drawCursor();
// }
// requestAnimationFrame(newLevelDraw);
// }
} }
}, },
unPause() { unPause() {
@@ -515,21 +765,6 @@ const level = {
level.exit.x = -level.exit.x - 100 //minus the 100 because of the width of the graphic level.exit.x = -level.exit.x - 100 //minus the 100 because of the width of the graphic
}, },
exitCount: 0, exitCount: 0,
// playerExitCheck() {
// if (
// player.position.x > level.exit.x &&
// player.position.x < level.exit.x + 100 &&
// player.position.y > level.exit.y - 150 &&
// player.position.y < level.exit.y - 40 &&
// player.velocity.y < 0.1
// ) {
// level.exitCount++
// if (level.exitCount > 120) {
// level.exitCount = 0
// level.nextLevel()
// }
// }
// },
setPosToSpawn(xPos, yPos) { setPosToSpawn(xPos, yPos) {
m.spawnPos.x = m.pos.x = xPos; m.spawnPos.x = m.pos.x = xPos;
m.spawnPos.y = m.pos.y = yPos; m.spawnPos.y = m.pos.y = yPos;
@@ -626,7 +861,7 @@ const level = {
let text = ` let text = `
<div class="choose-grid-module" id = "choose-training" style = "font-size: 1em; padding:10px;color:#333;"> <div class="choose-grid-module" id = "choose-training" style = "font-size: 1em; padding:10px;color:#333;">
<h2 style="text-align: center;letter-spacing: 5px;">training</h2> <h2 style="text-align: center;letter-spacing: 5px;">training</h2>
Begin the <strong>guided tutorial</strong> that shows you how to use your ${powerUps.field()} and ${powerUps.orb.gun()}. Begin the <strong>guided tutorial</strong> that shows you how to use your ${powerUps.orb.field()} and ${powerUps.orb.gun()}.
</div> </div>
<div class="choose-grid-module" id = "choose-unPause" style = "font-size: 1em; padding:10px;color:#333;"> <div class="choose-grid-module" id = "choose-unPause" style = "font-size: 1em; padding:10px;color:#333;">
<h2 style="text-align: center; letter-spacing: 7px;">play</h2> <h2 style="text-align: center; letter-spacing: 7px;">play</h2>
@@ -1296,10 +1531,7 @@ const level = {
y: list[0].position.y y: list[0].position.y
}) })
} }
Matter.Body.setVelocity(list[0], { Matter.Body.setVelocity(list[0], { x: 0, y: 0 });
x: 0,
y: 0
});
} }
} }
this.isUp = false; this.isUp = false;
@@ -2714,8 +2946,13 @@ const level = {
spawn.mapRect(3000, -2800, 2600, 4600); //right wall spawn.mapRect(3000, -2800, 2600, 4600); //right wall
// spawn.mapRect(-250, 0, 3600, 1800); //ground // spawn.mapRect(-250, 0, 3600, 1800); //ground
spawn.mapRect(-250, 0, 2300, 1800); //split roof spawn.mapRect(-250, 0, 2300, 1800); //ground
spawn.mapRect(2150, 0, 1200, 1800); //split roof
Matter.Body.setVelocity(map[map.length - 1], {
x: 10,
y: -10
});
spawn.mapRect(2150, 0, 1200, 1800); //ground
spawn.mapRect(2025, -3, 25, 15); //lip on power up chamber spawn.mapRect(2025, -3, 25, 15); //lip on power up chamber
spawn.mapRect(2150, -3, 25, 15); //lip on power up chamber spawn.mapRect(2150, -3, 25, 15); //lip on power up chamber
@@ -2923,7 +3160,6 @@ const level = {
level.exit.x = 0; level.exit.x = 0;
level.exit.y = -9000; level.exit.y = -9000;
// spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump disabled for performance // spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump disabled for performance
const stationWidth = 9000 const stationWidth = 9000
let stationNumber = 0; let stationNumber = 0;
let stationCustom = () => { } let stationCustom = () => { }
@@ -3004,6 +3240,7 @@ const level = {
if (isExitOpen) { if (isExitOpen) {
level.exit.x = x - 50; level.exit.x = x - 50;
level.exit.y = -260; level.exit.y = -260;
if (simulation.difficultyMode < 6) powerUps.spawn(level.exit.x, level.exit.y - 100, "tech");
} else { } else {
var gateButton = level.button(x - 62, -237, 125, false) //x, y, width = 126, isSpawnBase = true var gateButton = level.button(x - 62, -237, 125, false) //x, y, width = 126, isSpawnBase = true
gateButton.isUp = true gateButton.isUp = true
@@ -4178,8 +4415,7 @@ const level = {
// powerUps.spawnBossPowerUp(-3600, -100) // powerUps.spawnBossPowerUp(-3600, -100)
powerUps.spawn(-3650, -50, "tech") powerUps.spawn(-3650, -50, "tech")
powerUps.spawn(-3650, -150, "tech") powerUps.spawn(-3650, -150, "tech")
powerUps.spawn(-3650, -300, "tech") if (simulation.difficultyMode < 6) powerUps.spawn(-3650, -300, "tech")
// if (player.position.x < 2760 && player.position.x > 210) {}
} }
} }
}; };
@@ -4669,6 +4905,23 @@ const level = {
if (!buttonLeft.isUp) { if (!buttonLeft.isUp) {
setMoverDirection(7) setMoverDirection(7)
buttonRight.isUp = true //flip the other button up buttonRight.isUp = true //flip the other button up
//remove any blocks on top of right button
const badBlocks = Matter.Query.region(body, buttonRight)
//figure out block's index
for (let j = 0; j < badBlocks.length; j++) {
let index = null
for (let i = 0; i < body.length; i++) {
if (badBlocks[j] === body[i]) index = i
}
//remove block
console.log(index, j)
if (index) {
Matter.Composite.remove(engine.world, badBlocks[j]);
body.splice(index, 1);
}
}
} }
} else if (buttonRight.isUp) { } else if (buttonRight.isUp) {
buttonRight.query(); buttonRight.query();
@@ -4690,7 +4943,7 @@ const level = {
} }
} }
if (button1.isUp) { if (button1.isUp) { //opens up secondary zone
button1.query(); button1.query();
if (!button1.isUp) { if (!button1.isUp) {
isPowerLeft = false isPowerLeft = false
@@ -5375,7 +5628,7 @@ const level = {
powerUps.directSpawn(x + 998, y - 333, "tech", false); powerUps.directSpawn(x + 998, y - 333, "tech", false);
} }
const powerUp1 = powerUp[powerUp.length - 1] const powerUp1 = powerUp[powerUp.length - 1]
powerUp1.holdPosition = { x: powerUp1.position.x, y: powerUp1.position.y } if (powerUp1) powerUp1.holdPosition = { x: powerUp1.position.x, y: powerUp1.position.y }
let isSpawnedMobs = false let isSpawnedMobs = false
doCustom.push( doCustom.push(
() => { () => {
@@ -5384,7 +5637,7 @@ const level = {
// if (!isInRoom && m.pos.x > x - 100 && m.pos.x < x + 2000 && m.pos.y > y - 1300 && m.pos.y < y) { //is player inside this room? // if (!isInRoom && m.pos.x > x - 100 && m.pos.x < x + 2000 && m.pos.y > y - 1300 && m.pos.y < y) { //is player inside this room?
// isInRoom = true // isInRoom = true
// } else // } else
if (powerUp1.velocity.y !== 0) { //don't run this code if power up is gone //hack: powerUp1.velocity.y !== 0 seems to only be true if the power up up doesn't exist and is no longer being affected by gravity if (powerUp1 && powerUp1.velocity.y !== 0) { //don't run this code if power up is gone //hack: powerUp1.velocity.y !== 0 seems to only be true if the power up doesn't exist and is no longer being affected by gravity
ctx.strokeStyle = "#f0f" ctx.strokeStyle = "#f0f"
ctx.lineWidth = 2; ctx.lineWidth = 2;
if (Vector.magnitudeSquared(Vector.sub(m.pos, powerUp1.position)) < 90000) { //zone radius is 300 if (Vector.magnitudeSquared(Vector.sub(m.pos, powerUp1.position)) < 90000) { //zone radius is 300
@@ -5446,10 +5699,7 @@ const level = {
x: powerUp1.holdPosition.x + 4 * Math.random(), //1300 -2 x: powerUp1.holdPosition.x + 4 * Math.random(), //1300 -2
y: powerUp1.holdPosition.y + 4 * Math.random() //335 -2 y: powerUp1.holdPosition.y + 4 * Math.random() //335 -2
}); });
Matter.Body.setVelocity(powerUp1, { Matter.Body.setVelocity(powerUp1, { x: 0, y: 0 });
x: 0,
y: 0
});
} else if (!isSpawnedMobs) { } else if (!isSpawnedMobs) {
isSpawnedMobs = true isSpawnedMobs = true
if (chamberY === -650) { //lower chamber if (chamberY === -650) { //lower chamber
@@ -7226,7 +7476,7 @@ const level = {
}, },
rooftops() { rooftops() {
level.announceMobTypes() level.announceMobTypes()
level.fallMode = "start";
// level.fallPosition = { x: 5000, y:-4000} // level.fallPosition = { x: 5000, y:-4000}
const elevator = level.elevator(1450, -990, 235, 45, -2000) const elevator = level.elevator(1450, -990, 235, 45, -2000)
const boost1 = level.boost(4950, 0, 1100) const boost1 = level.boost(4950, 0, 1100)
@@ -7267,6 +7517,9 @@ const level = {
simulation.zoomTransition(level.defaultZoom) simulation.zoomTransition(level.defaultZoom)
document.body.style.backgroundColor = "#dcdcde"; document.body.style.backgroundColor = "#dcdcde";
// level.fallMode = "start";
let isBackwards = false let isBackwards = false
if (Math.random() < 0.75) { if (Math.random() < 0.75) {
//normal direction start in top left //normal direction start in top left
@@ -7410,6 +7663,12 @@ const level = {
} }
}; };
} }
level.fallMode = "position"; //must set level.fallModeBounds in this mode to prevent player getting stuck left or right
if (level.enter.x > level.exit.x) {
level.fallModeBounds = { left: level.exit.x, right: level.enter.x } //used with level.fallMode = "position";
} else {
level.fallModeBounds = { left: level.enter.x, right: level.exit.x } //used with level.fallMode = "position";
}
}, },
aerie() { aerie() {
level.announceMobTypes() level.announceMobTypes()
@@ -10318,8 +10577,8 @@ const level = {
}, },
vats() { // Made by Dablux#6610 on Discord vats() { // Made by Dablux#6610 on Discord
simulation.inGameConsole(`<strong>vats</strong> by <span class='color-var'>Dablux</span>`); simulation.inGameConsole(`<strong>vats</strong> by <span class='color-var'>Dablux</span>`);
level.defaultZoom = 1500
simulation.zoomScale = 1500; simulation.zoomTransition(level.defaultZoom)
level.setPosToSpawn(4400, -1060) level.setPosToSpawn(4400, -1060)
spawn.mapRect(level.enter.x, level.enter.y + 30, 100, 20) spawn.mapRect(level.enter.x, level.enter.y + 30, 100, 20)
level.exit.x = 3900; level.exit.x = 3900;
@@ -11481,8 +11740,8 @@ const level = {
let isButtonTapped = false; let isButtonTapped = false;
// if (b.inventory.length < 5) powerUps.spawn(3800, -3200, "gun"); // if (b.inventory.length < 5) powerUps.spawn(3800, -3200, "gun");
powerUps.spawn(3900, -3100, "heal", true, null, 30); powerUps.spawn(3900, -3100, "heal", true, 30);
powerUps.spawn(3900, -3100, "heal", true, null, 30); powerUps.spawn(3900, -3100, "heal", true, 30);
// path to the third room // path to the third room
spawn.mapRect(2000, -1850, 50, 200); spawn.mapRect(2000, -1850, 50, 200);
@@ -12445,7 +12704,7 @@ const level = {
// applying forces to player doesn't seem to work inside this method, not sure why // applying forces to player doesn't seem to work inside this method, not sure why
powerUps.spawn(this.position.x + 20, this.position.y, "ammo"); powerUps.spawn(this.position.x + 20, this.position.y, "ammo");
if (Math.random() > 0.5) powerUps.spawn(this.position.x, this.position.y, "ammo"); if (Math.random() > 0.5) powerUps.spawn(this.position.x, this.position.y, "ammo");
if (Math.random() > 0.3) powerUps.spawn(this.position.x, this.position.y, "heal", true, null, 30 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5)); if (Math.random() > 0.3) powerUps.spawn(this.position.x, this.position.y, "heal", true, 30 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5));
}; };
me.damageReduction = 0.25 me.damageReduction = 0.25
me.do = function () { me.do = function () {
@@ -12548,7 +12807,7 @@ const level = {
me.onDeath = function () { me.onDeath = function () {
powerUps.spawn(this.position.x + 20, this.position.y, "ammo"); powerUps.spawn(this.position.x + 20, this.position.y, "ammo");
if (Math.random() > 0.5) powerUps.spawn(this.position.x, this.position.y, "ammo"); if (Math.random() > 0.5) powerUps.spawn(this.position.x, this.position.y, "ammo");
if (Math.random() > 0.3) powerUps.spawn(this.position.x, this.position.y, "heal", true, null, 30 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5)); if (Math.random() > 0.3) powerUps.spawn(this.position.x, this.position.y, "heal", true, 30 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5));
}; };
me.damageReduction = 0.25 me.damageReduction = 0.25
me.do = function () { me.do = function () {
@@ -13380,8 +13639,8 @@ const level = {
relocateWIMPs(level.exit.x, level.exit.y); relocateWIMPs(level.exit.x, level.exit.y);
relocateTo(50, -2050); relocateTo(50, -2050);
simulation.fallHeight = -1000; simulation.fallHeight = -1000;
// simulation.setZoom(1800); level.defaultZoom = 1800
simulation.zoomTransition(1800) simulation.zoomTransition(level.defaultZoom)
templePlayer.startAnim = -1; templePlayer.startAnim = -1;
templePlayer.drawExit = false; templePlayer.drawExit = false;
@@ -34012,7 +34271,7 @@ const level = {
powerUps.addResearchToLevel() powerUps.addResearchToLevel()
powerUps.directSpawn(-775, 125, "tech"); powerUps.directSpawn(-775, 125, "tech");
powerUp[powerUp.length - 1].collisionFilter.mask = cat.map | cat.body | cat.powerUp if (!level.isNextLevelPowerUps && powerUp[powerUp.length - 1]) powerUp[powerUp.length - 1].collisionFilter.mask = cat.map | cat.body | cat.powerUp
spawn.bodyRect(-875, 75, 25, 100); spawn.bodyRect(-875, 75, 25, 100);
let hardBody = body[body.length - 1]; let hardBody = body[body.length - 1];
hardBody.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.powerUp hardBody.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.powerUp

View File

@@ -794,27 +794,6 @@ const mobs = {
} }
} }
}, },
// invulnerability() {
// if (this.isInvulnerable) {
// if (this.invulnerabilityCountDown > 0) {
// this.invulnerabilityCountDown--
// //graphics //draw a super shield?
// ctx.beginPath();
// let vertices = this.vertices;
// ctx.moveTo(vertices[0].x, vertices[0].y);
// for (let j = 1; j < vertices.length; j++) ctx.lineTo(vertices[j].x, vertices[j].y);
// ctx.lineTo(vertices[0].x, vertices[0].y);
// ctx.lineWidth = 20;
// // ctx.fillStyle = `rgba(${Math.floor(255 * Math.random())},${Math.floor(255 * Math.random())},${Math.floor(255 * Math.random())},0.5)`
// // ctx.fill();
// ctx.strokeStyle = "rgba(255,255,255,0.4)";
// ctx.stroke();
// } else {
// this.isInvulnerable = false
// this.damageReduction = this.startingDamageReduction
// }
// }
// },
grow() { grow() {
if (this.seePlayer.recall) { if (this.seePlayer.recall) {
if (this.radius < 80) { if (this.radius < 80) {
@@ -926,10 +905,7 @@ const mobs = {
spawn.bomb(this.position.x, this.position.y + this.radius * 0.7, 9 + Math.ceil(this.radius / 15), 5); spawn.bomb(this.position.x, this.position.y + this.radius * 0.7, 9 + Math.ceil(this.radius / 15), 5);
//add spin and speed //add spin and speed
Matter.Body.setAngularVelocity(mob[mob.length - 1], (Math.random() - 0.5) * 0.5); Matter.Body.setAngularVelocity(mob[mob.length - 1], (Math.random() - 0.5) * 0.5);
Matter.Body.setVelocity(mob[mob.length - 1], { Matter.Body.setVelocity(mob[mob.length - 1], { x: this.velocity.x, y: this.velocity.y });
x: this.velocity.x,
y: this.velocity.y
});
//spin for mob as well //spin for mob as well
Matter.Body.setAngularVelocity(this, (Math.random() - 0.5) * 0.25); Matter.Body.setAngularVelocity(this, (Math.random() - 0.5) * 0.25);
} }
@@ -1164,11 +1140,22 @@ const mobs = {
// console.log(this.shieldCount) // console.log(this.shieldCount)
if (this.isDropPowerUp) { if (this.isDropPowerUp) {
// if (true) { if (level.isMobDeathHeal) {
// //killing a mob heals for the last damage you took for (let i = 0; i < mob.length; i++) {
if (Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position)) < 1000000 && mob[i].alive) { //1000
if (mob[i].health < 1) {
// } mob[i].health = 1
simulation.drawList.push({
x: mob[i].position.x,
y: mob[i].position.y,
radius: mob[i].radius + 20,
color: "rgba(0,255,100,0.5)",
time: 10
});
}
}
}
}
if (this.isSoonZombie) { //spawn zombie on death if (this.isSoonZombie) { //spawn zombie on death
this.leaveBody = false; this.leaveBody = false;
let count = 5 //delay spawn cycles let count = 5 //delay spawn cycles
@@ -1198,6 +1185,34 @@ const mobs = {
}); });
} }
} }
if (level.isMobRespawn && !this.isBoss && 0.33 > Math.random()) {
simulation.drawList.push({
x: this.position.x,
y: this.position.y,
radius: 30,
color: `#fff`,
time: 20
});
simulation.drawList.push({
x: this.position.x,
y: this.position.y,
radius: 20,
color: `#fff`,
time: 40
});
simulation.drawList.push({
x: this.position.x,
y: this.position.y,
radius: 10,
color: `#fff`,
time: 60
});
setTimeout(() => {
const pick = spawn.pickList[Math.floor(Math.random() * spawn.pickList.length)];
const size = 16 + Math.ceil(Math.random() * 15)
spawn[pick](this.position.x, this.position.y, size);
}, 1000);
}
if (tech.healSpawn && Math.random() < tech.healSpawn) { if (tech.healSpawn && Math.random() < tech.healSpawn) {
powerUps.spawn(this.position.x + 20 * (Math.random() - 0.5), this.position.y + 20 * (Math.random() - 0.5), "heal"); powerUps.spawn(this.position.x + 20 * (Math.random() - 0.5), this.position.y + 20 * (Math.random() - 0.5), "heal");
simulation.drawList.push({ simulation.drawList.push({
@@ -1289,6 +1304,9 @@ const mobs = {
tech.cloakDuplication -= 0.01 tech.cloakDuplication -= 0.01
powerUps.setPowerUpMode(); //needed after adjusting duplication chance powerUps.setPowerUpMode(); //needed after adjusting duplication chance
} }
if (level.noDefenseSetting && this.isBoss) {
level.noDefenseSetting = 2
}
} else if (tech.isShieldAmmo && this.shield && this.shieldCount === 1) { } else if (tech.isShieldAmmo && this.shield && this.shieldCount === 1) {
let type = tech.isEnergyNoAmmo ? "heal" : "ammo" let type = tech.isEnergyNoAmmo ? "heal" : "ammo"
if (Math.random() < 0.4) { if (Math.random() < 0.4) {

View File

@@ -97,6 +97,7 @@ const m = {
hardLanding: 130, hardLanding: 130,
squirrelFx: 1, squirrelFx: 1,
squirrelJump: 1, squirrelJump: 1,
velocitySmooth: { x: 0, y: 0 },//use for drawing skin's velocity gel tail
standingOn: undefined, standingOn: undefined,
numTouching: 0, numTouching: 0,
crouch: false, crouch: false,
@@ -536,6 +537,10 @@ const m = {
baseHealth: 1, baseHealth: 1,
setMaxHealth(isMessage) { setMaxHealth(isMessage) {
m.maxHealth = m.baseHealth + tech.extraMaxHealth + 4 * tech.isFallingDamage m.maxHealth = m.baseHealth + tech.extraMaxHealth + 4 * tech.isFallingDamage
if (level.isReducedHealth) {
level.reducedHealthLost = Math.max(0, m.health - m.maxHealth * 0.5)
m.maxHealth *= 0.5
}
document.getElementById("health-bg").style.width = `${Math.floor(300 * m.maxHealth)}px` document.getElementById("health-bg").style.width = `${Math.floor(300 * m.maxHealth)}px`
if (isMessage) simulation.inGameConsole(`<span class='color-var'>m</span>.<span class='color-h'>maxHealth</span> <span class='color-symbol'>=</span> ${m.maxHealth.toFixed(2)}`) if (isMessage) simulation.inGameConsole(`<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;
@@ -546,6 +551,7 @@ const m = {
lastCalculatedDamage: 0, //used to decided if damage bar needs to be redrawn (in simulation.checks) lastCalculatedDamage: 0, //used to decided if damage bar needs to be redrawn (in simulation.checks)
lastCalculatedDefense: 0, //used to decided if defense bar needs to be redrawn (in simulation.checks) lastCalculatedDefense: 0, //used to decided if defense bar needs to be redrawn (in simulation.checks)
defense() { defense() {
if (level.noDefenseSetting === 2) return 1 //zero defense constraint
let dmg = 1 let dmg = 1
if (tech.isMaxHealthDefense && m.health === m.maxHealth) dmg *= 0.3 if (tech.isMaxHealthDefense && m.health === m.maxHealth) dmg *= 0.3
if (tech.isDiaphragm) dmg *= 0.55 + 0.35 * Math.sin(m.cycle * 0.0075); if (tech.isDiaphragm) dmg *= 0.55 + 0.35 * Math.sin(m.cycle * 0.0075);
@@ -556,7 +562,7 @@ const m = {
if (m.fieldMode === 0 || m.fieldMode === 3) dmg *= 0.973 ** m.coupling if (m.fieldMode === 0 || m.fieldMode === 3) dmg *= 0.973 ** m.coupling
if (tech.isHarmReduceNoKill && m.lastKillCycle + 300 < m.cycle) dmg *= 0.3 if (tech.isHarmReduceNoKill && m.lastKillCycle + 300 < m.cycle) dmg *= 0.3
if (tech.isAddBlockMass && m.isHolding) dmg *= 0.1 if (tech.isAddBlockMass && m.isHolding) dmg *= 0.1
if (tech.isSpeedHarm && (tech.speedAdded + player.speed) > 0.1) dmg *= 1 - Math.min((tech.speedAdded + player.speed) * 0.0193, 0.8) //capped at speed of 55 if (tech.isSpeedHarm && (tech.speedAdded + player.speed) > 0.1) dmg *= 1 - Math.min((tech.speedAdded + player.speed) * 0.01583, 0.95) //capped at speed of 55
if (tech.isHarmReduce && input.field) dmg *= 0.1 if (tech.isHarmReduce && input.field) dmg *= 0.1
if (tech.isNeutronium && input.field && m.fieldCDcycle < m.cycle) dmg *= 0.05 if (tech.isNeutronium && input.field && m.fieldCDcycle < m.cycle) dmg *= 0.05
if (tech.isBotArmor) dmg *= 0.96 ** b.totalBots() if (tech.isBotArmor) dmg *= 0.96 ** b.totalBots()
@@ -778,6 +784,21 @@ const m = {
simulation.fpsInterval = 1000 / simulation.fpsCap; simulation.fpsInterval = 1000 / simulation.fpsCap;
} }
m.defaultFPSCycle = m.cycle m.defaultFPSCycle = m.cycle
if (level.isMobHealPlayerDamage) {
for (let i = 0; i < mob.length; i++) {
if (mob[i].health < 1 && mob[i].isDropPowerUp && mob[i].alive) {
simulation.drawList.push({
x: mob[i].position.x,
y: mob[i].position.y,
radius: mob[i].radius + 20,
color: "rgba(0,255,100,0.5)",
time: 10
});
mob[i].health += dmg * 10
if (mob[i].health > 1) mob[i].health = 1
}
}
}
// if (tech.isSlowFPS) { // slow game // if (tech.isSlowFPS) { // slow game
// simulation.fpsCap = 30 //new fps // simulation.fpsCap = 30 //new fps
// simulation.fpsInterval = 1000 / simulation.fpsCap; // simulation.fpsInterval = 1000 / simulation.fpsCap;
@@ -830,6 +851,9 @@ const m = {
}, },
draw() { }, draw() { },
isAltSkin: false, isAltSkin: false,
drawBoost() {
},
resetSkin() { resetSkin() {
simulation.isAutoZoom = true; simulation.isAutoZoom = true;
m.hardLandCDScale = 1 m.hardLandCDScale = 1
@@ -841,8 +865,8 @@ const m = {
m.hardLanding = 130 m.hardLanding = 130
m.squirrelFx = 1; m.squirrelFx = 1;
m.squirrelJump = 1; m.squirrelJump = 1;
m.velocitySmooth = { x: 0, y: 0 }
requestAnimationFrame(() => { m.setMovement() }) requestAnimationFrame(() => { m.setMovement() })
m.color = { m.color = {
hue: 0, hue: 0,
sat: 0, sat: 0,
@@ -973,6 +997,30 @@ const m = {
m.setMovement() m.setMovement()
m.draw = function () { m.draw = function () {
if (powerUps.boost.endCycle > simulation.cycle) {
//gel that acts as if the wind is blowing it when player moves
ctx.save();
ctx.translate(m.pos.x, m.pos.y);
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
ctx.beginPath();
const radius = 39
const mag = 14 * Vector.magnitude(m.velocitySmooth) + radius
ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
// const time = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
ctx.fillStyle = `rgba(0,0,0,${0.04 + 0.3 * time})`
ctx.fill()
// ctx.strokeStyle = "#333"
// ctx.lineWidth = 1
// ctx.stroke();
ctx.restore();
}
m.walk_cycle += m.flipLegs * m.Vx; m.walk_cycle += m.flipLegs * m.Vx;
ctx.save(); ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20) ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20)
@@ -992,7 +1040,6 @@ const m = {
ctx.stroke(); ctx.stroke();
ctx.restore(); ctx.restore();
m.yOff = m.yOff * 0.75 + m.yOffGoal * 0.25; //smoothly move leg height towards height goal m.yOff = m.yOff * 0.75 + m.yOffGoal * 0.25; //smoothly move leg height towards height goal
powerUps.boost.draw()
} }
m.drawLeg = function (stroke) { m.drawLeg = function (stroke) {
if (m.angle > -Math.PI / 2 && m.angle < Math.PI / 2) { if (m.angle > -Math.PI / 2 && m.angle < Math.PI / 2) {
@@ -1150,8 +1197,38 @@ const m = {
m.isAltSkin = true m.isAltSkin = true
m.yOffWhen.stand = 52 m.yOffWhen.stand = 52
m.yOffWhen.jump = 72 m.yOffWhen.jump = 72
// m.speedSmooth = 0
// m.smoothAngle = 0
m.draw = function () { m.draw = function () {
if (powerUps.boost.endCycle > simulation.cycle) {
//gel that acts as if the wind is blowing it when player moves
ctx.save();
ctx.translate(m.pos.x, m.pos.y);
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
ctx.beginPath();
const radius = 40
const mag = 9 * Vector.magnitude(m.velocitySmooth) + radius
ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
// const time = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
// ctx.fillStyle = `rgba(255,0,200,${0.4 * time})`
// ctx.fill()
// ctx.strokeStyle = "#f09"
ctx.fillStyle = `rgba(255,255,255,${0.3 + time})`;
ctx.fill()
ctx.strokeStyle = "#446"
ctx.lineWidth = 0.2 + 4 * time
// ctx.lineWidth = 1
ctx.stroke();
ctx.restore();
}
m.walk_cycle += m.flipLegs * m.Vx; m.walk_cycle += m.flipLegs * m.Vx;
ctx.save(); ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20) ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20)
@@ -1161,7 +1238,6 @@ const m = {
m.calcLeg(0, 0); m.calcLeg(0, 0);
m.drawLeg("#446"); m.drawLeg("#446");
ctx.rotate(m.angle); ctx.rotate(m.angle);
ctx.beginPath(); ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI); ctx.arc(0, 0, 30, 0, 2 * Math.PI);
@@ -1175,6 +1251,15 @@ const m = {
ctx.lineWidth = 2; ctx.lineWidth = 2;
ctx.stroke(); ctx.stroke();
//fire outline directed opposite player look direction
// ctx.beginPath();
// const radius = 40
// const extend = -50
// ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
// ctx.bezierCurveTo(extend, radius, extend, 0, -100, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
// ctx.bezierCurveTo(extend, 0, extend, -radius, 0, -radius);
// ctx.fillStyle = "rgba(255,0,255,0.3)";
// ctx.fill()
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(13, 0) ctx.moveTo(13, 0)
ctx.lineTo(20, 0) ctx.lineTo(20, 0)
@@ -1183,7 +1268,6 @@ const m = {
ctx.restore(); ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
} }
m.drawLeg = function (stroke) { m.drawLeg = function (stroke) {
// if (simulation.mouseInGame.x > m.pos.x) { // if (simulation.mouseInGame.x > m.pos.x) {
@@ -1242,6 +1326,30 @@ const m = {
} }
m.setFillColors(); m.setFillColors();
m.draw = function () { m.draw = function () {
if (powerUps.boost.endCycle > simulation.cycle) {
//gel that acts as if the wind is blowing it when player moves
ctx.save();
ctx.translate(m.pos.x, m.pos.y);
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
ctx.beginPath();
const radius = 40
const mag = 10 * Vector.magnitude(m.velocitySmooth) + radius
ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
// const time = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
ctx.fillStyle = `hsla(184,100%,70%,${0.1 + 1.5 * time})`
ctx.fill()
ctx.strokeStyle = "#035"//"hsl(184,100%,70%)"
ctx.lineWidth = 0.2 + 3 * time
ctx.stroke();
ctx.restore();
}
ctx.fillStyle = m.fillColor; ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx; m.walk_cycle += m.flipLegs * m.Vx;
ctx.save(); ctx.save();
@@ -1254,8 +1362,8 @@ const m = {
ctx.rotate(m.angle); ctx.rotate(m.angle);
ctx.beginPath(); ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI); ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.strokeStyle = "rgba(0,255,255,0.22)"; ctx.strokeStyle = "rgba(0,255,255,0.25)";
ctx.lineWidth = 12; ctx.lineWidth = 15;
ctx.stroke(); ctx.stroke();
ctx.fillStyle = 'hsl(184,100%,85%)' //m.fillColor; //"#9ff" //m.bodyGradient ctx.fillStyle = 'hsl(184,100%,85%)' //m.fillColor; //"#9ff" //m.bodyGradient
ctx.fill(); ctx.fill();
@@ -1264,10 +1372,9 @@ const m = {
ctx.arc(17, 0, 5.5, 0, 2 * Math.PI); ctx.arc(17, 0, 5.5, 0, 2 * Math.PI);
ctx.fillStyle = "#357" ctx.fillStyle = "#357"
ctx.fill(); ctx.fill();
ctx.restore(); ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
} }
m.drawLeg = function (stroke) { m.drawLeg = function (stroke) {
// if (simulation.mouseInGame.x > m.pos.x) { // if (simulation.mouseInGame.x > m.pos.x) {
@@ -1466,6 +1573,26 @@ const m = {
m.bodyGradient = grd m.bodyGradient = grd
m.draw = function () { m.draw = function () {
if (powerUps.boost.endCycle > simulation.cycle) {
//gel that acts as if the wind is blowing it when player moves
ctx.save();
ctx.translate(m.pos.x, m.pos.y);
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
ctx.beginPath();
const radius = 40
const mag = 12 * Vector.magnitude(m.velocitySmooth) + radius
ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
// const time = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
ctx.fillStyle = `hsla(${simulation.cycle},100%,70%,${0.1 + 2 * time})`
ctx.fill()
ctx.restore();
}
ctx.fillStyle = m.fillColor; ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx; m.walk_cycle += m.flipLegs * m.Vx;
ctx.save(); ctx.save();
@@ -1486,7 +1613,6 @@ const m = {
// ctx.stroke(); // ctx.stroke();
ctx.restore(); ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
} }
m.drawLeg = function (stroke) { m.drawLeg = function (stroke) {
// if (simulation.mouseInGame.x > m.pos.x) { // if (simulation.mouseInGame.x > m.pos.x) {
@@ -1571,11 +1697,31 @@ const m = {
ctx.stroke(); ctx.stroke();
ctx.restore(); ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
if (powerUps.boost.endCycle > simulation.cycle) {
//gel that acts as if the wind is blowing it when player moves
ctx.save();
ctx.translate(m.pos.x, m.pos.y);
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
ctx.beginPath();
const radius = 39
const mag = 6 * Vector.magnitude(m.velocitySmooth) + radius
ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
// ctx.fillStyle = `hsla(${simulation.cycle * 0.5},100%,70%,0.4)`
// ctx.fill()
ctx.strokeStyle = "#345"
// const time = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
ctx.lineWidth = 0.2 + 4 * time
ctx.stroke();
ctx.restore();
}
//zoom camera in and out //zoom camera in and out
// console.log(simulation.zoomScale)
simulation.setZoom(1800 + 400 * Math.sin(m.cycle * 0.01)) simulation.setZoom(1800 + 400 * Math.sin(m.cycle * 0.01))
} }
}, },
@@ -1611,7 +1757,30 @@ const m = {
// ctx.stroke(); // ctx.stroke();
ctx.restore(); ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
if (powerUps.boost.endCycle > simulation.cycle) {
//gel that acts as if the wind is blowing it when player moves
ctx.save();
ctx.translate(m.pos.x, m.pos.y);
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
ctx.beginPath();
const radius = 39
const mag = 6 * Vector.magnitude(m.velocitySmooth) + radius
ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
// ctx.fillStyle = `hsla(${simulation.cycle * 0.5},100%,70%,0.4)`
// ctx.fill()
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
ctx.strokeStyle = "#345"
ctx.lineWidth = 0.2 + 7 * time
// ctx.lineWidth = (4 + 3 * Math.sin(m.cycle * 0.01 + Math.PI)) * time;
ctx.stroke();
ctx.restore();
}
simulation.setZoom(1800 + 400 * amplitude) simulation.setZoom(1800 + 400 * amplitude)
} }
m.drawLeg = function (stroke) { m.drawLeg = function (stroke) {
@@ -1672,7 +1841,6 @@ const m = {
grd.addColorStop(1, m.fillColor); grd.addColorStop(1, m.fillColor);
// grd.addColorStop(1, m.fillColor); // grd.addColorStop(1, m.fillColor);
m.bodyGradient = grd m.bodyGradient = grd
m.draw = function () { m.draw = function () {
ctx.fillStyle = m.fillColor; ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx; m.walk_cycle += m.flipLegs * m.Vx;
@@ -1748,7 +1916,6 @@ const m = {
}, },
verlet() { verlet() {
m.isAltSkin = true m.isAltSkin = true
m.draw = function () { m.draw = function () {
ctx.fillStyle = m.fillColor; ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx; m.walk_cycle += m.flipLegs * m.Vx;
@@ -1764,7 +1931,6 @@ const m = {
ctx.arc(0, 0, 30, 0, 2 * Math.PI); ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient ctx.fillStyle = m.bodyGradient
ctx.fill(); ctx.fill();
const rate = 0.09 const rate = 0.09
ctx.strokeStyle = "#000"; ctx.strokeStyle = "#000";
ctx.lineWidth = 1; ctx.lineWidth = 1;
@@ -1832,6 +1998,264 @@ const m = {
ctx.restore(); ctx.restore();
} }
}, },
stubs() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20)
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#555");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
m.drawLeg = function (stroke) {
// if (simulation.mouseInGame.x > m.pos.x) {
if (m.angle > -Math.PI / 2 && m.angle < Math.PI / 2) {
m.flipLegs = 1;
} else {
m.flipLegs = -1;
}
ctx.save();
ctx.scale(m.flipLegs, 1); //leg lines
ctx.beginPath();
ctx.moveTo(m.hip.x, m.hip.y);
ctx.lineTo(m.knee.x, m.knee.y);
ctx.lineTo(m.foot.x, m.foot.y + 5);
ctx.strokeStyle = stroke;
ctx.lineWidth = 6;
ctx.stroke();
ctx.restore();
}
},
Sleipnir() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
for (let i = 0; i < 16; i++) {
m.calcLeg(Math.PI * i / 8, -3 * i / 16)
m.drawLeg("#444")
}
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
},
diegesis() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle - (m.fireCDcycle !== Infinity ? m.flipLegs * 0.25 * Math.pow(Math.max(m.fireCDcycle - m.cycle, 0), 0.5) : 0));
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
},
cat() {
m.isAltSkin = true
m.coyoteCycles = 10
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) {
ctx.scale(1, -1);
ctx.rotate(Math.PI);
}
ctx.beginPath();
ctx.moveTo(-30, 0);
ctx.bezierCurveTo(-65, -75,
-5, 150 + (5 * Math.sin(simulation.cycle / 10)),
-70 + (10 * Math.sin(simulation.cycle / 10)), 0 + (10 * Math.sin(simulation.cycle / 10)));
ctx.strokeStyle = "#333";
ctx.lineWidth = 4;
ctx.stroke();
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) {
ctx.scale(1, -1);
ctx.rotate(0 - Math.PI);
}
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) ctx.scale(1, -1);
ctx.beginPath();
ctx.moveTo(5, -30);
ctx.lineTo(20, -40);
ctx.lineTo(20, -20);
ctx.lineWidth = 2;
ctx.fillStyle = "#f3f";
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.stroke();
ctx.moveTo(19, 0);
ctx.arc(15, 0, 4, Math.PI, 2 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(24.3, 6, 5, Math.PI * 2, Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(30, 6);
ctx.lineTo(32, 0);
ctx.lineTo(26, 0);
ctx.lineTo(30, 6);
ctx.fillStyle = "#f3f";
ctx.fill();
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
},
pareidolia() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.7
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) ctx.scale(1, -1); //here is the flip
ctx.stroke();
ctx.beginPath();
ctx.arc(2, -6, 7, 0, 2 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(25, -6, 7, 0.25 * Math.PI, 1.6 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(2, -10, 9, 1.25 * Math.PI, 1.75 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(25, -10, 9, 1.25 * Math.PI, 1.4 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(18, 13, 10, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient;
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(18, 13, 6, 0, 2 * Math.PI);
ctx.fillStyle = "#555";
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(3, -6, 3, 0, 2 * Math.PI);
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(26, -6, 3, 0, 2 * Math.PI);
ctx.fill();
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15;
powerUps.boost.draw()
}
},
flipFlop() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
//draw body
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
//draw eye
ctx.beginPath();
ctx.arc(15, 0, 3.5, 0, 2 * Math.PI);
ctx.fillStyle = m.eyeFillColor;
ctx.fill()
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
},
hexagon() { hexagon() {
m.isAltSkin = true m.isAltSkin = true
@@ -1922,262 +2346,6 @@ const m = {
ctx.restore(); ctx.restore();
} }
}, },
stubs() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20)
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#555");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
m.drawLeg = function (stroke) {
// if (simulation.mouseInGame.x > m.pos.x) {
if (m.angle > -Math.PI / 2 && m.angle < Math.PI / 2) {
m.flipLegs = 1;
} else {
m.flipLegs = -1;
}
ctx.save();
ctx.scale(m.flipLegs, 1); //leg lines
ctx.beginPath();
ctx.moveTo(m.hip.x, m.hip.y);
ctx.lineTo(m.knee.x, m.knee.y);
ctx.lineTo(m.foot.x, m.foot.y + 5);
ctx.strokeStyle = stroke;
ctx.lineWidth = 6;
ctx.stroke();
ctx.restore();
}
},
Sleipnir() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
for (let i = 0; i < 16; i++) {
m.calcLeg(Math.PI * i / 8, -3 * i / 16)
m.drawLeg("#444")
}
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
}
},
diegesis() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle - (m.fireCDcycle !== Infinity ? m.flipLegs * 0.25 * Math.pow(Math.max(m.fireCDcycle - m.cycle, 0), 0.5) : 0));
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
}
},
cat() {
m.isAltSkin = true
m.coyoteCycles = 10
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) {
ctx.scale(1, -1);
ctx.rotate(Math.PI);
}
ctx.beginPath();
ctx.moveTo(-30, 0);
ctx.bezierCurveTo(-65, -75,
-5, 150 + (5 * Math.sin(simulation.cycle / 10)),
-70 + (10 * Math.sin(simulation.cycle / 10)), 0 + (10 * Math.sin(simulation.cycle / 10)));
ctx.strokeStyle = "#333";
ctx.lineWidth = 4;
ctx.stroke();
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) {
ctx.scale(1, -1);
ctx.rotate(0 - Math.PI);
}
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) ctx.scale(1, -1);
ctx.beginPath();
ctx.moveTo(5, -30);
ctx.lineTo(20, -40);
ctx.lineTo(20, -20);
ctx.lineWidth = 2;
ctx.fillStyle = "#f3f";
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.stroke();
ctx.moveTo(19, 0);
ctx.arc(15, 0, 4, Math.PI, 2 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(24.3, 6, 5, Math.PI * 2, Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(30, 6);
ctx.lineTo(32, 0);
ctx.lineTo(26, 0);
ctx.lineTo(30, 6);
ctx.fillStyle = "#f3f";
ctx.fill();
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
}
},
pareidolia() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.7
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
if (!(m.angle > -Math.PI / 2 && m.angle < Math.PI / 2)) ctx.scale(1, -1); //here is the flip
ctx.stroke();
ctx.beginPath();
ctx.arc(2, -6, 7, 0, 2 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(25, -6, 7, 0.25 * Math.PI, 1.6 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(2, -10, 9, 1.25 * Math.PI, 1.75 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(25, -10, 9, 1.25 * Math.PI, 1.4 * Math.PI);
ctx.stroke();
ctx.beginPath();
ctx.arc(18, 13, 10, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient;
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(18, 13, 6, 0, 2 * Math.PI);
ctx.fillStyle = "#555";
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(3, -6, 3, 0, 2 * Math.PI);
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.arc(26, -6, 3, 0, 2 * Math.PI);
ctx.fill();
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15;
}
},
flipFlop() {
m.isAltSkin = true
m.draw = function () {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
//draw body
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
//draw eye
ctx.beginPath();
ctx.arc(15, 0, 3.5, 0, 2 * Math.PI);
ctx.fillStyle = m.eyeFillColor;
ctx.fill()
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
}
}, },
// ********************************************* // *********************************************
// **************** fields ********************* // **************** fields *********************
@@ -2275,6 +2443,7 @@ const m = {
}, },
setMaxEnergy(isMessage = true) { setMaxEnergy(isMessage = true) {
m.maxEnergy = (tech.isMaxEnergyTech ? 0.5 : 1) + tech.bonusEnergy + tech.healMaxEnergyBonus + tech.harmonicEnergy + 3 * tech.isGroundState + 1.5 * (m.fieldMode === 1) + (m.fieldMode === 0 || m.fieldMode === 1) * 0.05 * m.coupling + 0.77 * tech.isStandingWaveExpand m.maxEnergy = (tech.isMaxEnergyTech ? 0.5 : 1) + tech.bonusEnergy + tech.healMaxEnergyBonus + tech.harmonicEnergy + 3 * tech.isGroundState + 1.5 * (m.fieldMode === 1) + (m.fieldMode === 0 || m.fieldMode === 1) * 0.05 * m.coupling + 0.77 * tech.isStandingWaveExpand
if (level.isReducedEnergy) m.maxEnergy *= 0.5
if (isMessage) simulation.inGameConsole(`<span class='color-var'>m</span>.<span class='color-f'>maxEnergy</span> <span class='color-symbol'>=</span> ${(m.maxEnergy.toFixed(2))}`) if (isMessage) simulation.inGameConsole(`<span class='color-var'>m</span>.<span class='color-f'>maxEnergy</span> <span class='color-symbol'>=</span> ${(m.maxEnergy.toFixed(2))}`)
}, },
fieldMeterColor: "#0cf", fieldMeterColor: "#0cf",
@@ -2542,7 +2711,7 @@ const m = {
tech.tokamakHealCount++ tech.tokamakHealCount++
let massScale = Math.min(65 * Math.sqrt(m.maxHealth), 14 * Math.pow(m.holdingTarget.mass, 0.4)) let massScale = Math.min(65 * Math.sqrt(m.maxHealth), 14 * Math.pow(m.holdingTarget.mass, 0.4))
if (powerUps.healGiveMaxEnergy) massScale = powerUps["heal"].size() if (powerUps.healGiveMaxEnergy) massScale = powerUps["heal"].size()
powerUps.spawn(m.pos.x, m.pos.y, "heal", true, null, massScale * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals * (tech.isHalfHeals ? 0.5 : 1))) // spawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) { powerUps.spawn(m.pos.x, m.pos.y, "heal", true, massScale * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals * (tech.isHalfHeals ? 0.5 : 1))) // spawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
} }
} else { //normal throw } else { //normal throw
//bullet-like collisions //bullet-like collisions
@@ -2587,6 +2756,7 @@ const m = {
}); });
m.definePlayerMass() //return to normal player mass m.definePlayerMass() //return to normal player mass
if (tech.isStaticBlock) m.holdingTarget.isStatic = true
if (tech.isAddBlockMass) { if (tech.isAddBlockMass) {
const expand = function (that, massLimit) { const expand = function (that, massLimit) {
if (that.mass < massLimit) { if (that.mass < massLimit) {
@@ -3000,7 +3170,7 @@ const m = {
case 9: //wormhole case 9: //wormhole
return `<span style = 'font-size:89%;'>after eating <strong class='color-block'>blocks</strong> <strong>+${(2 * couple).toFixed(0)}</strong> <strong class='color-f'>energy</strong></span>` return `<span style = 'font-size:89%;'>after eating <strong class='color-block'>blocks</strong> <strong>+${(2 * couple).toFixed(0)}</strong> <strong class='color-f'>energy</strong></span>`
case 10: //grappling hook case 10: //grappling hook
return `${powerUps.orb.ammo(1)} give ${(4 * couple).toFixed(0)}% more ammo` return `<span style="opacity: 1;">${powerUps.orb.ammo(1)}</span> give ${(4 * couple).toFixed(0)}% more ammo`
} }
}, },
couplingChange(change = 0) { couplingChange(change = 0) {

View File

@@ -373,7 +373,7 @@ const powerUps = {
//build level info //build level info
document.getElementById("choose-grid").classList.add('choose-grid-no-images'); document.getElementById("choose-grid").classList.add('choose-grid-no-images');
document.getElementById("choose-grid").classList.remove('choose-grid'); document.getElementById("choose-grid").classList.remove('choose-grid');
document.getElementById("choose-grid").style.gridTemplateColumns = "405px" //adjust this to increase the width of the whole menu, but mostly the center column document.getElementById("choose-grid").style.gridTemplateColumns = "505px" //adjust this to increase the width of the whole menu, but mostly the center column
let text = `<div> let text = `<div>
<div class="grid-container"> <div class="grid-container">
@@ -389,12 +389,12 @@ const powerUps = {
</datalist> </datalist>
</div> </div>
<div class="right-column"> <div class="right-column">
<div class="row" id="constraint-1"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div> <div class="row" id="constraint-1"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> boss on each level</div>
<div class="row" id="constraint-2"><strong>-5</strong> initial <strong>power ups</strong><br><strong>faster</strong> mobs and <strong>more</strong> mobs</div> <div class="row" id="constraint-2"><strong>more</strong> mob per level<br><strong>faster</strong> mobs per level</div>
<div class="row" id="constraint-3"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div> <div class="row" id="constraint-3"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> random <strong class="constraint">constraint</strong> on each level</div>
<div class="row" id="constraint-4"><strong>+1</strong> boss per level<br><strong>-1</strong> ${powerUps.orb.tech()} per boss</div> <div class="row" id="constraint-4"><strong>+1</strong> boss on each level<br>bosses spawn <strong>1</strong> fewer ${powerUps.orb.tech()}</div>
<div class="row" id="constraint-5"><strong>0.87x</strong> <strong class='color-d'>damage</strong> done per level<br><strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level</div> <div class="row" id="constraint-5"><strong>0.87x</strong> <strong class='color-d'>damage</strong>, <strong>1.22x</strong> <strong class='color-defense'>damage taken</strong> per level<br><strong>+1</strong> random <strong class="constraint">constraint</strong> on each level</div>
<div class="row" id="constraint-6"><strong>3x</strong> chance for <strong>shielded</strong> mobs<br><strong>-3</strong> initial power ups</div> <div class="row" id="constraint-6"><strong>0.5x</strong> initial <strong class='color-d'>damage</strong><br><strong>2x</strong> initial <strong class='color-defense'>damage taken</strong></div>
</div> </div>
<div class="far-right-column"> <div class="far-right-column">
<div id = "constraint-1-record">${localSettings.difficultyCompleted[1] ? "⚆" : " "}</div> <div id = "constraint-1-record">${localSettings.difficultyCompleted[1] ? "⚆" : " "}</div>
@@ -434,7 +434,7 @@ const powerUps = {
} }
}); });
let setConstraintText = function (isReset = true) { let setDifficultyText = function (isReset = true) {
for (let i = 1; i < 7; i++) { for (let i = 1; i < 7; i++) {
const id = document.getElementById("constraint-" + i) const id = document.getElementById("constraint-" + i)
if (simulation.difficultyMode < i) { if (simulation.difficultyMode < i) {
@@ -451,17 +451,19 @@ const powerUps = {
if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
} }
} }
setConstraintText(false) setDifficultyText(false)
document.getElementById("difficulty-slider").value = simulation.difficultyMode document.getElementById("difficulty-slider").value = simulation.difficultyMode
document.getElementById("difficulty-slider").addEventListener("input", () => { document.getElementById("difficulty-slider").addEventListener("input", () => {
simulation.difficultyMode = document.getElementById("difficulty-slider").value simulation.difficultyMode = document.getElementById("difficulty-slider").value
setConstraintText() setDifficultyText()
level.setConstraints()
}); });
for (let i = 1; i < 7; i++) { for (let i = 1; i < 7; i++) {
document.getElementById("constraint-" + i).addEventListener("click", () => { document.getElementById("constraint-" + i).addEventListener("click", () => {
simulation.difficultyMode = i simulation.difficultyMode = i
document.getElementById("difficulty-slider").value = simulation.difficultyMode document.getElementById("difficulty-slider").value = simulation.difficultyMode
setConstraintText() setDifficultyText()
level.setConstraints()
}); });
} }
}, },
@@ -503,17 +505,38 @@ const powerUps = {
damage: null, //set by "tech: band gap" damage: null, //set by "tech: band gap"
effect() { effect() {
powerUps.animatePowerUpGrab('rgba(255, 0, 0, 0.5)') powerUps.animatePowerUpGrab('rgba(255, 0, 0, 0.5)')
powerUps.boost.endCycle = m.cycle + Math.floor(Math.max(0, powerUps.boost.endCycle - m.cycle) * 0.6) + powerUps.boost.duration //duration+seconds plus 2/3 of current time left powerUps.boost.endCycle = simulation.cycle + Math.floor(Math.max(0, powerUps.boost.endCycle - simulation.cycle) * 0.6) + powerUps.boost.duration //duration+seconds plus 2/3 of current time left
}, },
draw() { draw() {
// console.log(this.endCycle) // console.log(this.endCycle)
if (powerUps.boost.endCycle > m.cycle) { // if (powerUps.boost.endCycle > m.cycle) {
ctx.strokeStyle = "rgba(255,0,0,0.8)" //m.fieldMeterColor; //"rgba(255,255,0,0.2)" //ctx.strokeStyle = `rgba(0,0,255,${0.5+0.5*Math.random()})` // ctx.strokeStyle = "rgba(255,0,0,0.8)" //m.fieldMeterColor; //"rgba(255,255,0,0.2)" //ctx.strokeStyle = `rgba(0,0,255,${0.5+0.5*Math.random()})`
// ctx.beginPath();
// const arc = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration
// ctx.arc(m.pos.x, m.pos.y, 28, m.angle - Math.PI * arc, m.angle + Math.PI * arc); //- Math.PI / 2
// ctx.lineWidth = 4
// ctx.stroke();
// }
if (powerUps.boost.endCycle > simulation.cycle) {
//gel that acts as if the wind is blowing it when player moves
ctx.save();
ctx.translate(m.pos.x, m.pos.y);
m.velocitySmooth = Vector.add(Vector.mult(m.velocitySmooth, 0.8), Vector.mult(player.velocity, 0.2))
ctx.rotate(Math.atan2(m.velocitySmooth.y, m.velocitySmooth.x))
ctx.beginPath(); ctx.beginPath();
const arc = (powerUps.boost.endCycle - m.cycle) / powerUps.boost.duration const radius = 40
ctx.arc(m.pos.x, m.pos.y, 28, m.angle - Math.PI * arc, m.angle + Math.PI * arc); //- Math.PI / 2 const mag = 8 * Vector.magnitude(m.velocitySmooth) + radius
ctx.lineWidth = 4 ctx.arc(0, 0, radius, -Math.PI / 2, Math.PI / 2);
ctx.bezierCurveTo(-radius, radius, -radius, 0, -mag, 0); // bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)
ctx.bezierCurveTo(-radius, 0, -radius, -radius, 0, -radius);
const time = Math.min(0.5, (powerUps.boost.endCycle - simulation.cycle) / powerUps.boost.duration)
ctx.fillStyle = `rgba(255,0,200,${time})`
ctx.fill()
ctx.strokeStyle = "#f09"
ctx.lineWidth = 0.3 + 4 * time
ctx.stroke(); ctx.stroke();
ctx.restore();
} }
}, },
}, },
@@ -533,7 +556,7 @@ const powerUps = {
if (amount !== 0) powerUps.research.count += amount if (amount !== 0) powerUps.research.count += amount
if (tech.isRerollBots && !this.isMakingBots) { if (tech.isRerollBots && !this.isMakingBots) {
let cycle = () => { let cycle = () => {
const cost = 2 + Math.floor(0.2 * b.totalBots()) const cost = 2 + Math.floor(0.25 * b.totalBots())
if (m.alive && powerUps.research.count >= cost) { if (m.alive && powerUps.research.count >= cost) {
requestAnimationFrame(cycle); requestAnimationFrame(cycle);
this.isMakingBots = true this.isMakingBots = true
@@ -647,7 +670,7 @@ const powerUps = {
// }); // });
} else if (overHeal > 0.13) { //if leftover heals spawn a new spammer heal power up } else if (overHeal > 0.13) { //if leftover heals spawn a new spammer heal power up
requestAnimationFrame(() => { requestAnimationFrame(() => {
powerUps.directSpawn(this.position.x, this.position.y, "heal", true, null, Math.min(1, overHeal) * 40 * (simulation.healScale ** 0.25))// directSpawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) { powerUps.directSpawn(this.position.x, this.position.y, "heal", true, Math.min(1, overHeal) * 40 * (simulation.healScale ** 0.25))// directSpawn(x, y, name, moving = true, mode = null, size = powerUps[name].size()) {
}); });
} }
if (tech.isHealBrake) { if (tech.isHealBrake) {
@@ -699,9 +722,9 @@ const powerUps = {
} }
}, },
spawn(x, y, size) { //used to spawn a heal with a specific size / heal amount, not normally used spawn(x, y, size) { //used to spawn a heal with a specific size / heal amount, not normally used
powerUps.directSpawn(x, y, "heal", false, null, size) powerUps.directSpawn(x, y, "heal", false, size)
if (Math.random() < tech.duplicationChance()) { if (!level.isNextLevelPowerUps && Math.random() < tech.duplicationChance()) {
powerUps.directSpawn(x, y, "heal", false, null, size) powerUps.directSpawn(x, y, "heal", false, size)
powerUp[powerUp.length - 1].isDuplicated = true powerUp[powerUp.length - 1].isDuplicated = true
} }
} }
@@ -717,22 +740,22 @@ const powerUps = {
if (b.inventory.length > 0) { if (b.inventory.length > 0) {
powerUps.animatePowerUpGrab('rgba(68, 102, 119,0.25)') powerUps.animatePowerUpGrab('rgba(68, 102, 119,0.25)')
if (tech.isAmmoForGun && b.activeGun !== null) { //give extra ammo to one gun only with tech logistics if (tech.isAmmoForGun && b.activeGun !== null) { //give extra ammo to one gun only with tech logistics
const target = b.guns[b.activeGun] const name = b.guns[b.activeGun]
if (target.ammo !== Infinity) { if (name.ammo !== Infinity) {
if (tech.ammoCap) { if (tech.ammoCap) {
target.ammo = Math.ceil(2 * target.ammoPack * tech.ammoCap * couplingExtraAmmo) name.ammo = Math.ceil(2 * name.ammoPack * tech.ammoCap * couplingExtraAmmo)
} else { } else {
target.ammo += Math.ceil(2 * (Math.random() + Math.random()) * target.ammoPack * couplingExtraAmmo) name.ammo += Math.ceil(2 * (Math.random() + Math.random()) * name.ammoPack * couplingExtraAmmo)
} }
} }
} else { //give ammo to all guns in inventory } else { //give ammo to all guns in inventory
for (let i = 0, len = b.inventory.length; i < len; i++) { for (let i = 0, len = b.inventory.length; i < len; i++) {
const target = b.guns[b.inventory[i]] const name = b.guns[b.inventory[i]]
if (target.ammo !== Infinity) { if (name.ammo !== Infinity) {
if (tech.ammoCap) { if (tech.ammoCap) {
target.ammo = Math.ceil(target.ammoPack * tech.ammoCap * couplingExtraAmmo) name.ammo = Math.ceil(name.ammoPack * tech.ammoCap * couplingExtraAmmo)
} else { //default ammo behavior } else { //default ammo behavior
target.ammo += Math.ceil((Math.random() + Math.random()) * target.ammoPack * couplingExtraAmmo) name.ammo += Math.ceil((Math.random() + Math.random()) * name.ammoPack * couplingExtraAmmo)
} }
} }
} }
@@ -1034,13 +1057,13 @@ const powerUps = {
} }
// console.log(options.length) // console.log(options.length)
if (options.length > 0 || !tech.isSuperDeterminism) { if (options.length > 0 || !tech.isSuperDeterminism) {
let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8) let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8) - level.fewerChoices
if (tech.isCancelTech && tech.cancelTechCount === 1) { if (tech.isCancelTech && tech.cancelTechCount === 1) {
totalChoices *= 3 totalChoices *= 3
tech.cancelTechCount++ tech.cancelTechCount++
} }
if (tech.isDeterminism) totalChoices = 1 if (tech.isDeterminism) totalChoices = 1
totalChoices = Math.min(options.length, totalChoices) totalChoices = Math.min(totalChoices, options.length)
function removeOption(index) { function removeOption(index) {
for (let i = 0; i < options.length; i++) { for (let i = 0; i < options.length; i++) {
if (options[i] === index) { if (options[i] === index) {
@@ -1101,13 +1124,13 @@ const powerUps = {
for (let i = 1; i < m.fieldUpgrades.length; i++) { //skip field emitter for (let i = 1; i < m.fieldUpgrades.length; i++) { //skip field emitter
if (i !== m.fieldMode) options.push(i); if (i !== m.fieldMode) options.push(i);
} }
let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8) let totalChoices = 2 + tech.extraChoices + 3 * (m.fieldMode === 8) - level.fewerChoices
if (tech.isCancelTech && tech.cancelTechCount === 1) { if (tech.isCancelTech && tech.cancelTechCount === 1) {
totalChoices *= 3 totalChoices *= 3
tech.cancelTechCount++ tech.cancelTechCount++
} }
if (tech.isDeterminism) totalChoices = 1 if (tech.isDeterminism) totalChoices = 1
totalChoices = Math.min(options.length, totalChoices) totalChoices = Math.max(1, Math.min(totalChoices, options.length))
function removeOption(index) { function removeOption(index) {
for (let i = 0; i < options.length; i++) { for (let i = 0; i < options.length; i++) {
if (options[i] === index) { if (options[i] === index) {
@@ -1181,13 +1204,13 @@ const powerUps = {
} }
} }
//set total choices //set total choices
let totalChoices = 3 + tech.extraChoices + 3 * (m.fieldMode === 8) let totalChoices = 3 + tech.extraChoices + 3 * (m.fieldMode === 8) - level.fewerChoices
if (tech.isCancelTech && tech.cancelTechCount === 1) { if (tech.isCancelTech && tech.cancelTechCount === 1) {
totalChoices *= 3 totalChoices *= 3
tech.cancelTechCount++ tech.cancelTechCount++
} }
if (tech.isDeterminism) totalChoices = 1 if (tech.isDeterminism) totalChoices = 1
totalChoices = Math.min(options.length, totalChoices) totalChoices = Math.max(1, Math.min(totalChoices, options.length))
if (optionLengthNoDuplicates < totalChoices + 1) { //if not enough options for all the choices if (optionLengthNoDuplicates < totalChoices + 1) { //if not enough options for all the choices
totalChoices = optionLengthNoDuplicates totalChoices = optionLengthNoDuplicates
@@ -1220,11 +1243,11 @@ const powerUps = {
const choose = options[Math.floor(Math.seededRandom(0, options.length))] //pick an element from the array of options const choose = options[Math.floor(Math.seededRandom(0, options.length))] //pick an element from the array of options
if (tech.isBanish) { if (tech.isBanish) {
tech.tech[choose].isBanished = true tech.tech[choose].isBanished = true
if (i === 0) simulation.inGameConsole(`options.length = ${optionLengthNoDuplicates} <em class='color-text'>//tech removed from pool by decoherence</em>`) if (i === 0) simulation.inGameConsole(`options.length = ${optionLengthNoDuplicates} <em class='color-text'>//removed from pool by decoherence</em>`)
} }
removeOption(choose) //move from future options pool to avoid repeats on this selection removeOption(choose) //move from future options pool to avoid repeats on this selection
tech.tech[choose].isRecentlyShown = true //this flag prevents this option from being shown the next time you pick up a tech power up tech.tech[choose].isRecentlyShown = true //this flag prevents this option from being shown the next time you pick up a tech power up
if (Math.random() < tech.junkChance) { // choose is set to a random JUNK tech if (Math.random() < tech.junkChance + level.junkAdded) { // choose is set to a random JUNK tech
const list = [] const list = []
for (let i = 0; i < tech.tech.length; i++) { for (let i = 0; i < tech.tech.length; i++) {
if (tech.tech[i].isJunk) list.push(i) if (tech.tech[i].isJunk) list.push(i)
@@ -1433,6 +1456,7 @@ const powerUps = {
b.mine(who.position, { x: 0, y: 0 }, 0) b.mine(who.position, { x: 0, y: 0 }, 0)
} }
} }
if (level.isNoDamage) level.noDamageCycle = m.cycle
}, },
spawnRandomPowerUp(x, y) { //mostly used after mob dies, doesn't always return a power up spawnRandomPowerUp(x, y) { //mostly used after mob dies, doesn't always return a power up
if (!tech.isEnergyHealth && (Math.random() * Math.random() - 0.3 > Math.sqrt(m.health)) || Math.random() < 0.04) { //spawn heal chance is higher at low health if (!tech.isEnergyHealth && (Math.random() * Math.random() - 0.3 > Math.sqrt(m.health)) || Math.random() < 0.04) { //spawn heal chance is higher at low health
@@ -1447,10 +1471,6 @@ const powerUps = {
powerUps.spawn(x, y, "gun"); powerUps.spawn(x, y, "gun");
return; return;
} }
// if (Math.random() < 0.005 * (10 - level.levelsCleared)) { //a new tech has a low chance that decreases in later levels
// powerUps.spawn(x, y, "tech");
// return;
// }
if (Math.random() < 0.0016) { if (Math.random() < 0.0016) {
powerUps.spawn(x, y, "field"); powerUps.spawn(x, y, "field");
return; return;
@@ -1459,35 +1479,28 @@ const powerUps = {
powerUps.spawn(x, y, "coupling"); powerUps.spawn(x, y, "coupling");
return; return;
} }
if (tech.isBoostPowerUps && Math.random() < 0.14) { if (Math.random() < 0.02 || (tech.isBoostPowerUps && Math.random() < 0.14)) {
powerUps.spawn(x, y, "boost"); powerUps.spawn(x, y, "boost");
return; return;
} }
// if (Math.random() < 0.01) {
// powerUps.spawn(x, y, "research");
// return;
// }
}, },
randomPowerUpCounter: 0, randomPowerUpCounter: 0,
isFieldSpawned: false, //makes it so a field spawns once but not more times isFieldSpawned: false, //makes it so a field spawns once but not more times
spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades
if (level.levels[level.onLevel] !== "final") { if (level.levels[level.onLevel] !== "final") {
// if (level.levelsCleared === 1) powerUps.spawn(x, y, "field")
// if (m.fieldMode === 0 && !m.coupling) {
if (!powerUps.isFieldSpawned) { if (!powerUps.isFieldSpawned) {
powerUps.isFieldSpawned = true powerUps.isFieldSpawned = true
powerUps.spawn(x, y, "field") powerUps.spawn(x, y, "field")
} else { } else {
powerUps.randomPowerUpCounter++; powerUpChance()
powerUpChance(Math.max(level.levelsCleared, 10) * 0.1)
} }
if (!(simulation.difficultyMode > 2 && level.levelsCleared > 1)) { if (simulation.difficultyMode < 4) {//don't spawn second power up on difficulties with a second boss
powerUps.randomPowerUpCounter += 0.6; powerUpChance()
powerUpChance(Math.max(level.levelsCleared, 6) * 0.1)
} }
function powerUpChance(chanceToFail) { function powerUpChance() {
if (Math.random() * chanceToFail < powerUps.randomPowerUpCounter) { powerUps.randomPowerUpCounter++
powerUps.randomPowerUpCounter = 0; if (powerUps.randomPowerUpCounter > Math.max(level.levelsCleared, 9) * 0.1 * Math.random()) {
powerUps.randomPowerUpCounter = 0; //reset odds
if (Math.random() < 0.97) { if (Math.random() < 0.97) {
powerUps.spawn(x, y, "tech") powerUps.spawn(x, y, "tech")
} else { } else {
@@ -1528,14 +1541,14 @@ const powerUps = {
}, },
addResearchToLevel() { //add a random power up to a location that has a mob, mostly used to give each level a research addResearchToLevel() { //add a random power up to a location that has a mob, mostly used to give each level a research
// if (simulation.difficultyMode < 4 && mob.length) { //don't spawn on higher difficulty settings // if (simulation.difficultyMode < 4 && mob.length) { //don't spawn on higher difficulty settings
if (level.levelsCleared < 13 - simulation.difficultyMode * 2 && mob.length) { //don't spawn late game if ((level.levelsCleared < 17 - simulation.difficultyMode * 3) && mob.length) { //don't spawn late game
const index = Math.floor(Math.random() * mob.length) const index = Math.floor(Math.random() * mob.length)
powerUps.spawn(mob[index].position.x, mob[index].position.y, "research"); powerUps.spawn(mob[index].position.x, mob[index].position.y, "research");
} }
}, },
spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun spawnStartingPowerUps(x, y) { //used for map specific power ups, mostly to give player a starting gun
if (level.levelsCleared < 4) { //runs on first 4 levels on all difficulties if (level.levelsCleared < 4) { //runs on first 4 levels on all difficulties
if (level.levelsCleared > 1) powerUps.spawn(x, y, "tech") if (level.levelsCleared > 1 && simulation.difficultyMode < 6) powerUps.spawn(x, y, "tech")
if (b.inventory.length === 0) { if (b.inventory.length === 0) {
powerUps.spawn(x, y, "gun", false); //first gun powerUps.spawn(x, y, "gun", false); //first gun
} else if (tech.totalCount === 0) { //first tech } else if (tech.totalCount === 0) { //first tech
@@ -1574,7 +1587,6 @@ const powerUps = {
for (let i = 0; i < tech.tech[choose].count; i++) { for (let i = 0; i < tech.tech[choose].count; i++) {
powerUps.directSpawn(m.pos.x, m.pos.y, "tech"); powerUps.directSpawn(m.pos.x, m.pos.y, "tech");
// powerUp[powerUp.length - 1].isDuplicated = true
} }
// remove a random tech from the list of tech you have // remove a random tech from the list of tech you have
tech.removeCount += tech.tech[choose].count tech.removeCount += tech.tech[choose].count
@@ -1593,7 +1605,6 @@ const powerUps = {
for (let i = 0; i < tech.tech[choose].count; i++) { for (let i = 0; i < tech.tech[choose].count; i++) {
powerUps.directSpawn(m.pos.x, m.pos.y, "tech"); powerUps.directSpawn(m.pos.x, m.pos.y, "tech");
// powerUp[powerUp.length - 1].isDuplicated = true
} }
// remove a random tech from the list of tech you have // remove a random tech from the list of tech you have
tech.tech[choose].remove(); tech.tech[choose].remove();
@@ -1675,7 +1686,28 @@ const powerUps = {
powerUp.splice(index, 1); powerUp.splice(index, 1);
} }
}, },
directSpawn(x, y, target, moving = true, mode = null, size = powerUps[target].size(), isDuplicated = false) { spawn(x, y, name, moving = true, size = powerUps[name].size()) {
if (
(!tech.isSuperDeterminism || (name !== 'research')) &&
!(tech.isEnergyNoAmmo && name === 'ammo')
) {
if (tech.isBoostReplaceAmmo && name === 'ammo') {
name = 'boost'
size = powerUps[name].size()
}
powerUps.directSpawn(x, y, name, moving, size)
if (!level.isNextLevelPowerUps && Math.random() < tech.duplicationChance()) {
powerUps.directSpawn(x, y, name, moving, size, true)
powerUp[powerUp.length - 1].isDuplicated = true
if (tech.isDupEnergy) m.energy *= 2
}
}
},
directSpawn(x, y, name, moving = true, size = powerUps[name].size(), isDuplicated = false) {
if (level.isNextLevelPowerUps) {
powerUps.powerUpStorage.push({ name: name, size: size })
return
}
let index = powerUp.length; let index = powerUp.length;
let properties = { let properties = {
density: 0.001, density: 0.001,
@@ -1686,9 +1718,9 @@ const powerUps = {
category: cat.powerUp, category: cat.powerUp,
mask: cat.map | cat.powerUp mask: cat.map | cat.powerUp
}, },
color: powerUps[target].color, color: powerUps[name].color,
effect: powerUps[target].effect, effect: powerUps[name].effect,
name: powerUps[target].name, name: powerUps[name].name,
size: size size: size
} }
let polygonSides let polygonSides
@@ -1700,26 +1732,8 @@ const powerUps = {
polygonSides = 12 polygonSides = 12
} }
powerUp[index] = Matter.Bodies.polygon(x, y, polygonSides, size, properties); powerUp[index] = Matter.Bodies.polygon(x, y, polygonSides, size, properties);
if (mode) powerUp[index].mode = mode
if (moving) Matter.Body.setVelocity(powerUp[index], { x: (Math.random() - 0.5) * 15, y: Math.random() * -9 - 3 }); if (moving) Matter.Body.setVelocity(powerUp[index], { x: (Math.random() - 0.5) * 15, y: Math.random() * -9 - 3 });
Composite.add(engine.world, powerUp[index]); Composite.add(engine.world, powerUp[index]);
}, },
spawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) { powerUpStorage: [],//used when power ups are sent to the next level (for the constraint, level.isNextLevelPowerUps)
if (
(!tech.isSuperDeterminism || (target !== 'research')) &&
!(tech.isEnergyNoAmmo && target === 'ammo')
) {
if (tech.isBoostReplaceAmmo && target === 'ammo') {
target = 'boost'
size = powerUps[target].size()
}
powerUps.directSpawn(x, y, target, moving, mode, size)
if (Math.random() < tech.duplicationChance()) {
powerUps.directSpawn(x, y, target, moving, mode, size, true)
powerUp[powerUp.length - 1].isDuplicated = true
// if (tech.isPowerUpsVanish) powerUp[powerUp.length - 1].endCycle = simulation.cycle + 300
if (tech.isDupEnergy) m.energy *= 2
}
}
},
}; };

View File

@@ -419,15 +419,6 @@ const simulation = {
simulation.boldActiveGunHUD(); simulation.boldActiveGunHUD();
}, },
updateTechHUD() { updateTechHUD() {
// tech.tech.sort((a, b) => {
// console.log(a.cycle, b.cycle)
// if (a.cycle === undefined && b.cycle !== undefined) return -1;
// if (a.cycle !== undefined && b.cycle === undefined) return 1;
// if (a.cycle === undefined && b.cycle === undefined) return 0;
// if (a.cycle !== b.cycle) return a.cycle - b.cycle;
// });
let text = "" let text = ""
for (let i = 0, len = tech.tech.length; i < len; i++) { //add tech for (let i = 0, len = tech.tech.length; i < len; i++) { //add tech
if (tech.tech[i].isLost) { if (tech.tech[i].isLost) {
@@ -436,21 +427,55 @@ const simulation = {
} else if (tech.tech[i].count > 0 && !tech.tech[i].isInstant) { } else if (tech.tech[i].count > 0 && !tech.tech[i].isInstant) {
if (text) text += "<br>" //add a new line, but not on the first line if (text) text += "<br>" //add a new line, but not on the first line
text += tech.tech[i].name text += tech.tech[i].name
// if (tech.tech[i].nameInfo) {
// text += tech.tech[i].nameInfo
// tech.tech[i].addNameInfo();
// }
if (tech.tech[i].count > 1) text += ` (${tech.tech[i].count}x)` if (tech.tech[i].count > 1) text += ` (${tech.tech[i].count}x)`
} }
} }
document.getElementById("tech").innerHTML = text document.getElementById("right-HUD").innerHTML = text
// let text = ""
// if (simulation.difficultyMode > 2 && level.constraintDescription1) {
// text += `<span class='constraint'>${level.constraintDescription1}</span>`
// // text += `${level.constraintDescription1}`
// }
// if (simulation.difficultyMode > 4 && level.constraintDescription2) {
// text += `<br><span class='constraint'>${level.constraintDescription2}</span>`
// }
// for (let i = 0, len = tech.tech.length; i < len; i++) { //add tech
// if (tech.tech[i].isLost) {
// if (text) text += "<br>" //add a new line, but not on the first line
// text += `<span style="text-decoration: line-through;">${tech.tech[i].name}</span>`
// } else if (tech.tech[i].count > 0 && !tech.tech[i].isInstant) {
// if (text) text += "<br>" //add a new line, but not on the first line
// text += tech.tech[i].name
// if (tech.tech[i].count > 1) text += ` (${tech.tech[i].count}x)`
// }
// }
// document.getElementById("right-HUD").innerHTML = text
// let constraints = ""
// if (simulation.difficultyMode > 2 && level.constraintDescription1) {
// constraints += `<span class='constraint' style="opacity: 0.35;">${level.constraintDescription1}</span>`
// // text += `${level.constraintDescription1}`
// }
// if (simulation.difficultyMode > 4 && level.constraintDescription2) {
// constraints += `<br><span class='constraint' style="opacity: 0.35;">${level.constraintDescription2}</span>`
// }
// let text = ""
// for (let i = 0, len = tech.tech.length; i < len; i++) { //add tech
// if (tech.tech[i].isLost) {
// if (text) text += "<br>" //add a new line, but not on the first line
// text += `<span style="text-decoration: line-through;">${tech.tech[i].name}</span>`
// } else if (tech.tech[i].count > 0 && !tech.tech[i].isInstant) {
// if (text) text += "<br>" //add a new line, but not on the first line
// text += tech.tech[i].name
// if (tech.tech[i].count > 1) text += ` (${tech.tech[i].count}x)`
// }
// }
// document.getElementById("right-HUD").innerHTML = constraints + `<div class="right-HUD-tech">` + text + `</div>`
}, },
lastLogTime: 0, lastLogTime: 0,
isTextLogOpen: true, isTextLogOpen: true,
// <!-- <path d="M832.41,106.64 V323.55 H651.57 V256.64 c0-82.5,67.5-150,150-150 Z" fill="#789" stroke="none" />
// <path d="M827,112 h30 a140,140,0,0,1,140,140 v68 h-167 z" fill="#7ce" stroke="none" /> -->
// SVGleftMouse: '<svg viewBox="750 0 200 765" class="mouse-icon" width="40px" height = "60px" stroke-linecap="round" stroke-linejoin="round" stroke-width="25px" stroke="#000" fill="none"> <path fill="#fff" stroke="none" d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" /> <path d="M832.41,106.64 V323.55 H651.57 V256.64 c0-82.5,67.5-150,150-150 Z" fill="#149" stroke="none" /> <path fill="none" d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" /> <path d="M657 317 h 340 h-170 v-207" /> <ellipse fill="#fff" cx="827.57" cy="218.64" rx="29" ry="68" /> </svg>',
// SVGrightMouse: '<svg viewBox="750 0 200 765" class="mouse-icon" width="40px" height = "60px" stroke-linecap="round" stroke-linejoin="round" stroke-width="25px" stroke="#000" fill="none"> <path fill="#fff" stroke="none" d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" /> <path d="M827,112 h30 a140,140,0,0,1,140,140 v68 h-167 z" fill="#0cf" stroke="none" /> <path fill="none" d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" /> <path d="M657 317 h 340 h-170 v-207" /> <ellipse fill="#fff" cx="827.57" cy="218.64" rx="29" ry="68" /> </svg>',
inGameConsole(text, time = 240) { inGameConsole(text, time = 240) {
if (!localSettings.isHideHUD && simulation.isTextLogOpen && !build.isExperimentSelection) { if (!localSettings.isHideHUD && simulation.isTextLogOpen && !build.isExperimentSelection) {
if (simulation.lastLogTime > m.cycle) { //if there is an older message if (simulation.lastLogTime > m.cycle) { //if there is an older message
@@ -757,11 +782,11 @@ const simulation = {
document.getElementById("health").style.display = "inline" document.getElementById("health").style.display = "inline"
document.getElementById("health-bg").style.display = "inline"; document.getElementById("health-bg").style.display = "inline";
if (!localSettings.isHideHUD) { if (!localSettings.isHideHUD) {
document.getElementById("tech").style.display = "inline" document.getElementById("right-HUD").style.display = "inline"
document.getElementById("defense-bar").style.display = "inline" document.getElementById("defense-bar").style.display = "inline"
document.getElementById("damage-bar").style.display = "inline" document.getElementById("damage-bar").style.display = "inline"
} else { } else {
document.getElementById("tech").style.display = "none" document.getElementById("right-HUD").style.display = "none"
document.getElementById("defense-bar").style.display = "none" document.getElementById("defense-bar").style.display = "none"
document.getElementById("damage-bar").style.display = "none" document.getElementById("damage-bar").style.display = "none"
} }
@@ -787,10 +812,11 @@ const simulation = {
} else { } else {
Composite.add(engine.world, [player]) Composite.add(engine.world, [player])
} }
shuffle(level.constraint)
level.populateLevels() level.populateLevels()
input.endKeySensing(); input.endKeySensing();
simulation.ephemera = [] simulation.ephemera = []
powerUps.powerUpStorage = []
tech.setupAllTech(); //sets tech to default values tech.setupAllTech(); //sets tech to default values
b.resetAllGuns(); b.resetAllGuns();
tech.duplication = 0; tech.duplication = 0;
@@ -843,6 +869,7 @@ const simulation = {
level.onLevel = 0; level.onLevel = 0;
level.levelsCleared = 0; level.levelsCleared = 0;
level.updateDifficulty() level.updateDifficulty()
// level.setConstraints()
simulation.clearNow = true; simulation.clearNow = true;
document.getElementById("text-log").style.display = "none" document.getElementById("text-log").style.display = "none"
@@ -948,7 +975,7 @@ const simulation = {
}, },
}) })
const before = { x: player.position.x, y: player.position.y, } const before = { x: player.position.x, y: player.position.y, }
let posXClamped = Math.min(Math.max(level.fallModeBounds.left, player.position.x), level.fallModeBounds.right) const posXClamped = Math.min(Math.max(level.fallModeBounds.left, player.position.x), level.fallModeBounds.right)
Matter.Body.setPosition(player, { x: posXClamped, y: level.enter.y - 4000 }); Matter.Body.setPosition(player, { x: posXClamped, y: level.enter.y - 4000 });
// translate camera smoothly to preserve illusion to endless fall // translate camera smoothly to preserve illusion to endless fall
@@ -1042,7 +1069,6 @@ const simulation = {
}, },
}) })
} }
if (tech.isZeno) { if (tech.isZeno) {
if (tech.isEnergyHealth) { if (tech.isEnergyHealth) {
m.energy *= 0.95 m.energy *= 0.95
@@ -1054,28 +1080,41 @@ const simulation = {
} }
if (tech.cyclicImmunity && m.immuneCycle < m.cycle + tech.cyclicImmunity) m.immuneCycle = m.cycle + tech.cyclicImmunity; //player is immune to damage for 60 cycles if (tech.cyclicImmunity && m.immuneCycle < m.cycle + tech.cyclicImmunity) m.immuneCycle = m.cycle + tech.cyclicImmunity; //player is immune to damage for 60 cycles
fallCheck = function (who, save = false) {
let i = who.length;
let i = body.length;
while (i--) { while (i--) {
if (who[i].position.y > simulation.fallHeight) { if (body[i].position.y > simulation.fallHeight) {
if (save) { Matter.Composite.remove(engine.world, body[i]);
Matter.Body.setVelocity(who[i], { x: 0, y: 0 }); body.splice(i, 1);
Matter.Body.setPosition(who[i], { }
}
i = powerUp.length
while (i--) {
if (powerUp[i].position.y > simulation.fallHeight) {
Matter.Body.setVelocity(powerUp[i], { x: 0, y: 0 });
if (level.fallMode === "position") {
const posXClamped = Math.min(Math.max(level.fallModeBounds.left, powerUp[i].position.x), level.fallModeBounds.right)
Matter.Body.setPosition(powerUp[i], { x: posXClamped, y: level.enter.y - 3000 });
} else {
Matter.Body.setPosition(powerUp[i], {
x: level.exit.x + 30 * (Math.random() - 0.5), x: level.exit.x + 30 * (Math.random() - 0.5),
y: level.exit.y + 30 * (Math.random() - 0.5) y: level.exit.y + 30 * (Math.random() - 0.5)
}); });
} else {
Matter.Composite.remove(engine.world, who[i]);
who.splice(i, 1);
} }
} }
} }
}; i = mob.length;
fallCheck(body);
fallCheck(powerUp, true);
let i = mob.length;
while (i--) { while (i--) {
if (mob[i].position.y > simulation.fallHeight) mob[i].death(); if (mob[i].position.y > simulation.fallHeight) {
if (mob[i].isBoss && level.fallMode === "position") {
Matter.Body.setVelocity(mob[i], { x: 0, y: 0 });
const posXClamped = Math.min(Math.max(level.fallModeBounds.left, mob[i].position.x), level.fallModeBounds.right)
Matter.Body.setPosition(mob[i], { x: posXClamped, y: level.enter.y - 3000 });
} else {
mob[i].death();
}
}
} }
} }

View File

@@ -114,7 +114,7 @@ const spawn = {
} }
}, },
secondaryBossChance(x, y) { secondaryBossChance(x, y) {
if (simulation.difficultyMode > 2 && level.levelsCleared > 2) { if (simulation.difficultyMode > 3 && level.levelsCleared > 1) {
spawn.randomLevelBoss(x, y); spawn.randomLevelBoss(x, y);
powerUps.directSpawn(x - 30, y, "ammo"); powerUps.directSpawn(x - 30, y, "ammo");
powerUps.directSpawn(x + 30, y, "ammo"); powerUps.directSpawn(x + 30, y, "ammo");
@@ -1014,7 +1014,7 @@ const spawn = {
return return
} }
} }
if (simulation.testing || simulation.difficultyMode > 4) { if (simulation.testing || simulation.difficultyMode > 5) {
unlockExit() unlockExit()
setTimeout(function () { setTimeout(function () {
simulation.inGameConsole(`level.levels.length <span class='color-symbol'>=</span> <strong>Infinite</strong>`); simulation.inGameConsole(`level.levels.length <span class='color-symbol'>=</span> <strong>Infinite</strong>`);
@@ -2347,7 +2347,7 @@ const spawn = {
ctx.fill(); ctx.fill();
} }
} }
if (simulation.difficultyMode === 6) spawn.shield(me, x, y); if (level.isMobShields) spawn.shield(me, x, y);
}, },
// timeBoss(x, y, radius = 25) { // timeBoss(x, y, radius = 25) {
// mobs.spawn(x, y, 12, radius, "#000"); // mobs.spawn(x, y, 12, radius, "#000");
@@ -7726,7 +7726,7 @@ const spawn = {
}; };
}, },
//chance = Math.min(0.02 + simulation.difficulty * 0.005, 0.2) + tech.duplicationChance() //chance = Math.min(0.02 + simulation.difficulty * 0.005, 0.2) + tech.duplicationChance()
shield(target, x, y, chance = (simulation.difficultyMode === 6 ? 3 : 1) * Math.min(0.02 + simulation.difficulty * 0.005, 0.2)) { shield(target, x, y, chance = (level.isMobShields ? 3.25 : 1) * Math.min(0.02 + simulation.difficulty * 0.005, 0.2)) {
if (this.allowShields && Math.random() < chance) { if (this.allowShields && Math.random() < chance) {
mobs.spawn(x, y, 9, target.radius + 30, "rgba(220,220,255,0.9)"); mobs.spawn(x, y, 9, target.radius + 30, "rgba(220,220,255,0.9)");
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
@@ -8086,7 +8086,7 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (m.pos.x > breakingPoint) { if (m.pos.x > breakingPoint || simulation.isCheating) {
this.freeOfWires = true; this.freeOfWires = true;
this.fill = "#000" this.fill = "#000"
this.force.x += -0.003; this.force.x += -0.003;
@@ -8158,7 +8158,7 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (m.pos.x > breakingPoint) { if (m.pos.x > breakingPoint || simulation.isCheating) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x -= 0.0004; this.force.x -= 0.0004;
this.fill = "#222"; this.fill = "#222";
@@ -8210,7 +8210,7 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (m.pos.x > breakingPoint) { if (m.pos.x > breakingPoint || simulation.isCheating) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x += -0.0003; this.force.x += -0.0003;
this.fill = "#333"; this.fill = "#333";
@@ -8261,7 +8261,7 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (m.pos.x > breakingPoint) { if (m.pos.x > breakingPoint || simulation.isCheating) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x += -0.0006; this.force.x += -0.0006;
this.fill = "#111"; this.fill = "#111";
@@ -8312,7 +8312,7 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (m.pos.x > breakingPoint) { if (m.pos.x > breakingPoint || simulation.isCheating) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x += -0.0005; this.force.x += -0.0005;
this.fill = "#222"; this.fill = "#222";

View File

@@ -188,13 +188,13 @@ const tech = {
console.log(introArray[wordNumber]) console.log(introArray[wordNumber])
if (introArray[wordNumber]) { if (introArray[wordNumber]) {
if (answer && answer.toLowerCase() === introArray[wordNumber].toLowerCase().replace(/[^a-zA-Z]/g, '')) { if (answer && answer.toLowerCase() === introArray[wordNumber].toLowerCase().replace(/[^a-zA-Z]/g, '')) {
powerUps.spawnDelay("research", 5) powerUps.spawnDelay("research", 4)
simulation.inGameConsole(`correct!`, 360) simulation.inGameConsole(`correct!`, 360)
} else { } else {
simulation.inGameConsole(`<strong>${answer}</strong> is wrong, it was <strong>${introArray[wordNumber]}</strong>`, 360) simulation.inGameConsole(`<strong>${answer}</strong> is wrong, it was <strong>${introArray[wordNumber]}</strong>`, 360)
} }
let text = `"` let text = `"`
for (let i = 0; i < wordLimit; i++) { for (let i = 0; i < wordLimit + 3; i++) {
if (i === wordNumber) { if (i === wordNumber) {
text += `<strong>${introArray[i]}</strong> ` text += `<strong>${introArray[i]}</strong> `
} else { } else {
@@ -204,7 +204,7 @@ const tech = {
simulation.inGameConsole(text + `..."`, 360) simulation.inGameConsole(text + `..."`, 360)
} else { } else {
simulation.inGameConsole(`hmmm I'm not sure the answer, so I'll say it's correct!`, 360) simulation.inGameConsole(`hmmm I'm not sure the answer, so I'll say it's correct!`, 360)
powerUps.spawnDelay("research", 5) powerUps.spawnDelay("research", 3)
} }
} }
}, 1000); // Check every 1 second }, 1000); // Check every 1 second
@@ -271,9 +271,10 @@ const tech = {
damage: 1, //used for tech changes to player damage that don't have complex conditions damage: 1, //used for tech changes to player damage that don't have complex conditions
damageFromTech() { damageFromTech() {
let dmg = tech.damage * m.fieldDamage let dmg = tech.damage * m.fieldDamage
if (level.isNoDamage && (m.cycle - 180 < level.noDamageCycle)) dmg *= 0.1
if (tech.isMaxHealthDamage && m.health === m.maxHealth) dmg *= 1.5 if (tech.isMaxHealthDamage && m.health === m.maxHealth) dmg *= 1.5
if (tech.isNoDefenseDamage && m.defense() === 1) dmg *= 2 if (tech.noDefenseSettingDamage && m.defense() === 1) dmg *= 2
if (tech.isImmunityDamage && m.immuneCycle > m.cycle) dmg *= 4 if (tech.isImmunityDamage && m.immuneCycle > m.cycle) dmg *= 3
if (tech.isPowerUpDamage) dmg *= 1 + 0.07 * powerUp.length if (tech.isPowerUpDamage) dmg *= 1 + 0.07 * powerUp.length
if (tech.isDamageCooldown) dmg *= m.lastKillCycle + tech.isDamageCooldownTime > m.cycle ? 0.4 : 4 if (tech.isDamageCooldown) dmg *= m.lastKillCycle + tech.isDamageCooldownTime > m.cycle ? 0.4 : 4
if (tech.isDamageAfterKillNoRegen && m.lastKillCycle + 300 > m.cycle) dmg *= 2 if (tech.isDamageAfterKillNoRegen && m.lastKillCycle + 300 > m.cycle) dmg *= 2
@@ -281,7 +282,7 @@ const tech = {
if (tech.isNoGroundDamage) dmg *= m.onGround ? 0.9 : 2 if (tech.isNoGroundDamage) dmg *= m.onGround ? 0.9 : 2
if (tech.isDilate) dmg *= 1.9 + 1.1 * Math.sin(m.cycle * 0.01) if (tech.isDilate) dmg *= 1.9 + 1.1 * Math.sin(m.cycle * 0.01)
if (tech.isGunChoice && tech.buffedGun === b.inventoryGun) dmg *= 1 + 0.3 * b.inventory.length if (tech.isGunChoice && tech.buffedGun === b.inventoryGun) dmg *= 1 + 0.3 * b.inventory.length
if (powerUps.boost.endCycle > m.cycle) dmg *= 1 + powerUps.boost.damage if (powerUps.boost.endCycle > simulation.cycle) dmg *= 1 + powerUps.boost.damage
if (m.coupling && (m.fieldMode === 0 || m.fieldMode === 5)) dmg *= 1 + 0.015 * m.coupling if (m.coupling && (m.fieldMode === 0 || m.fieldMode === 5)) dmg *= 1 + 0.015 * m.coupling
if (tech.isVerlet) dmg *= 3 if (tech.isVerlet) dmg *= 3
if (tech.isTechDebt) dmg *= tech.totalCount > 20 ? Math.pow(0.85, tech.totalCount - 20) : 4 - 0.15 * tech.totalCount if (tech.isTechDebt) dmg *= tech.totalCount > 20 ? Math.pow(0.85, tech.totalCount - 20) : 4 - 0.15 * tech.totalCount
@@ -297,16 +298,17 @@ const tech = {
if (tech.energyDamage) dmg *= 1 + m.energy * 0.23 * tech.energyDamage; if (tech.energyDamage) dmg *= 1 + m.energy * 0.23 * tech.energyDamage;
if (tech.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.01 if (tech.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.01
if (tech.isNoFireDamage && m.cycle > m.fireCDcycle + 120) dmg *= 2 if (tech.isNoFireDamage && m.cycle > m.fireCDcycle + 120) dmg *= 2
if (tech.isSpeedDamage) dmg *= 1 + Math.min(1, (tech.speedAdded + player.speed) * 0.0193) if (tech.isSpeedDamage) dmg *= 1 + Math.min(2, ((tech.speedAdded + player.speed) * 0.033))//1 + Math.min(1, (tech.speedAdded + player.speed) * 0.0193)
if (tech.isAxion && tech.isHarmDarkMatter) dmg *= ((tech.isMoveDarkMatter || tech.isNotDarkMatter) ? 3.2 : 2) if (tech.isAxion && tech.isHarmDarkMatter) dmg *= ((tech.isMoveDarkMatter || tech.isNotDarkMatter) ? 3.2 : 2)
if (tech.isHarmDamage && m.lastHarmCycle + 480 > m.cycle) dmg *= 3; if (tech.isHarmDamage && m.lastHarmCycle + 480 > m.cycle) dmg *= 3;
if (tech.lastHitDamage && m.lastHit) dmg *= 1 + tech.lastHitDamage * m.lastHit if (tech.lastHitDamage && m.lastHit) dmg *= 1 + tech.lastHitDamage * m.lastHit
// if (tech.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, 1 - (tech.isEnergyHealth ? m.energy : m.health)) // if (tech.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, 1 - (tech.isEnergyHealth ? m.energy : m.health))
if (tech.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, (tech.isEnergyHealth ? m.maxEnergy - m.energy : m.maxHealth - m.health)) if (tech.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, (tech.isEnergyHealth ? m.maxEnergy - m.energy : m.maxHealth - m.health))
if (tech.isJunkDNA) dmg *= 1 + 2 * tech.junkChance if (tech.isJunkDNA) dmg *= 1 + 2 * (tech.junkChance + level.junkAdded)
return dmg return dmg
}, },
duplicationChance() { duplicationChance() {
if (level.isNoDuplicate) return 0
return Math.min(1, Math.max(0, (tech.isPowerUpsVanish ? 0.13 : 0) + (tech.isStimulatedEmission ? 0.2 : 0) + tech.duplication + tech.duplicateChance + 0.05 * tech.isExtraGunField + m.duplicateChance + tech.fieldDuplicate + 0.08 * tech.isDuplicateMobs + 0.03 * tech.isMassProduction + 0.04 * tech.isHealAttract + tech.cloakDuplication + (tech.isAnthropicTech && tech.isDeathAvoidedThisLevel ? 0.6 : 0) + 0.06 * tech.isDupEnergy)) return Math.min(1, Math.max(0, (tech.isPowerUpsVanish ? 0.13 : 0) + (tech.isStimulatedEmission ? 0.2 : 0) + tech.duplication + tech.duplicateChance + 0.05 * tech.isExtraGunField + m.duplicateChance + tech.fieldDuplicate + 0.08 * tech.isDuplicateMobs + 0.03 * tech.isMassProduction + 0.04 * tech.isHealAttract + tech.cloakDuplication + (tech.isAnthropicTech && tech.isDeathAvoidedThisLevel ? 0.6 : 0) + 0.06 * tech.isDupEnergy))
}, },
setTechFrequency(name, frequency) { setTechFrequency(name, frequency) {
@@ -1162,67 +1164,6 @@ const tech = {
tech.restDamage = 1; tech.restDamage = 1;
} }
}, },
{
name: "Newtons 1st law",
descriptionFunction() {
return `<strong class='color-defense'>damage taken</strong> is proportional to your <strong class="color-speed">speed</strong><br>up to <strong>0.2x</strong> <strong class='color-defense'>damage taken</strong> at <strong>55</strong> <strong class="color-speed">speed</strong> <em style ="float: right;">(${(1 - Math.min((tech.speedAdded + player.speed) * 0.0193, 0.8)).toFixed(2)}x)</em>`
},
description: "",
maxCount: 1,
count: 0,
frequency: 1,
frequencyDefault: 1,
allowed() {
return true
},
requires: "",
effect() {
tech.isSpeedHarm = true //max at speed = 40
},
remove() {
tech.isSpeedHarm = false
}
},
{
name: "Newtons 2nd law",
descriptionFunction() {
return `<strong class='color-d'>damage</strong> is proportional to your <strong class="color-speed">speed</strong><br>up to <strong>2x</strong> <strong class='color-d'>damage</strong> at <strong>55</strong> <strong class="color-speed">speed</strong> <em style ="float: right;">(${(1 + Math.min(1, ((tech.speedAdded + player.speed) * 0.0193))).toFixed(2)}x)</em>`
},
maxCount: 1,
count: 0,
frequency: 1,
frequencyDefault: 1,
allowed() {
return true
},
requires: "",
effect() {
tech.isSpeedDamage = true //max at speed = 40
},
remove() {
tech.isSpeedDamage = false
}
},
{
name: "modified Newtonian dynamics",
descriptionFunction() {
return `your <strong class="color-speed">speed</strong> counts as <strong>+20</strong> higher<br><em>(for Newton's 1st and 2nd laws)</em>`
},
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.isSpeedDamage || tech.isSpeedHarm
},
requires: "Newtons 1st or 2nd law",
effect() {
tech.speedAdded = 20
},
remove() {
tech.speedAdded = 0
}
},
{ {
name: "kinetic bombardment", name: "kinetic bombardment",
description: "far away mobs take more <strong class='color-d'>damage</strong><br>up to <strong>1.3x</strong> <strong class='color-d'>damage</strong> at <strong>3000</strong> displacement", description: "far away mobs take more <strong class='color-d'>damage</strong><br>up to <strong>1.3x</strong> <strong class='color-d'>damage</strong> at <strong>3000</strong> displacement",
@@ -1501,7 +1442,7 @@ const tech = {
{ {
name: "exciton", name: "exciton",
descriptionFunction() { descriptionFunction() {
return `<span style = 'font-size:94%;'>after mobs <strong>die</strong> they have a <strong>14%</strong> chance to<br>spawn ${powerUps.orb.boost(1)} that give <strong>${(1 + powerUps.boost.damage).toFixed(2)}x</strong> <strong class='color-d'>damage</strong> for <strong>${(powerUps.boost.duration / 60).toFixed(0)}</strong> seconds</span>` return `<span style = 'font-size:94%;'>after mobs <strong>die</strong> they have a <strong>+14%</strong> chance to<br>spawn ${powerUps.orb.boost(1)} that give <strong>${(1 + powerUps.boost.damage).toFixed(2)}x</strong> <strong class='color-d'>damage</strong> for <strong>${(powerUps.boost.duration / 60).toFixed(0)}</strong> seconds</span>`
}, },
maxCount: 1, maxCount: 1,
count: 0, count: 0,
@@ -1823,7 +1764,7 @@ const tech = {
{ {
name: "sound-bot upgrade", name: "sound-bot upgrade",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Robot' class="link">sound-bot upgrade</a>`, link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Robot' class="link">sound-bot upgrade</a>`,
description: "<strong>convert</strong> your <strong class='color-bot'>bots</strong> to <strong class='color-bot'>sound-bots</strong><br><strong>2x</strong> wave <em>fire rate</em>, <strong class='color-d'>damage</strong>, and duration", description: "<strong>convert</strong> your <strong class='color-bot'>bots</strong> to <strong class='color-bot'>sound-bots</strong><br><strong>6x</strong> wave <strong class='color-d'>damage</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
frequency: 3, frequency: 3,
@@ -2139,7 +2080,7 @@ const tech = {
name: "bot fabrication", name: "bot fabrication",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Robot' class="link">bot fabrication</a>`, link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Robot' class="link">bot fabrication</a>`,
descriptionFunction() { descriptionFunction() {
return `after you collect ${powerUps.orb.research(2 + Math.floor(0.1666 * b.totalBots()))}use them<br>to construct a random <strong class='color-bot'>bot</strong> <em style ="float: right;">(+1 cost every 5 bots)</em>` return `after you collect ${powerUps.orb.research(2 + Math.floor(0.25 * b.totalBots()))}use them<br>to construct a random <strong class='color-bot'>bot</strong> <em style ="float: right;">(+1 cost every 4 bots)</em>`
}, },
// description: `if you collect ${powerUps.orb.research(2)}use them to build a<br>random <strong class='color-bot'>bot</strong> <em>(+1 cost every 5 bots)</em>`, // description: `if you collect ${powerUps.orb.research(2)}use them to build a<br>random <strong class='color-bot'>bot</strong> <em>(+1 cost every 5 bots)</em>`,
maxCount: 1, maxCount: 1,
@@ -2657,7 +2598,9 @@ const tech = {
}, },
{ {
name: "ablative drones", name: "ablative drones",
description: "after losing <strong class='color-h'>health</strong> there is a chance<br>to rebuild your broken parts as <strong>drones</strong>", descriptionFunction() {
return `after losing ${tech.isEnergyHealth ? "<strong class='color-f'>energy</strong>" : "<strong class='color-h'>health</strong>"} there is a chance<br>to rebuild your broken parts as <strong>drones</strong>`
},
maxCount: 1, maxCount: 1,
count: 0, count: 0,
frequency: 1, frequency: 1,
@@ -2715,7 +2658,7 @@ const tech = {
}, },
{ {
name: "Pauli exclusion", name: "Pauli exclusion",
description: `for <strong>8</strong> seconds after mob <strong>collisions</strong><br>become <strong class="color-invulnerable">invulnerable</strong> and <em style="opacity: 0.3;">inhibit <strong class='color-f'>energy</strong> regen</em>`, description: `for <strong>7</strong> seconds after mob <strong>collisions</strong><br>become <strong class="color-invulnerable">invulnerable</strong> and <em style="opacity: 0.3;">inhibit <strong class='color-f'>energy</strong> regen</em>`,
maxCount: 9, maxCount: 9,
count: 0, count: 0,
frequency: 1, frequency: 1,
@@ -2770,7 +2713,7 @@ const tech = {
}, },
{ {
name: "abelian group", name: "abelian group",
description: `<strong>4x</strong> <strong class='color-d'>damage</strong> while <strong class="color-invulnerable">invulnerable</strong>`, description: `<strong>3x</strong> <strong class='color-d'>damage</strong> while <strong class="color-invulnerable">invulnerable</strong>`,
maxCount: 1, maxCount: 1,
count: 0, count: 0,
frequency: 2, frequency: 2,
@@ -3115,10 +3058,10 @@ const tech = {
}, },
requires: "", requires: "",
effect() { effect() {
tech.isNoDefenseDamage = true; tech.noDefenseSettingDamage = true;
}, },
remove() { remove() {
tech.isNoDefenseDamage = false; tech.noDefenseSettingDamage = false;
} }
}, },
{ {
@@ -4009,7 +3952,7 @@ const tech = {
{ {
name: "junk DNA", name: "junk DNA",
descriptionFunction() { descriptionFunction() {
return `increase <strong class='color-d'>damage</strong> by twice the<br><strong class='color-junk'>JUNK</strong> chance <em style ="float: right;">(${(1 + 2 * tech.junkChance).toFixed(2)}x)</em>` return `increase <strong class='color-d'>damage</strong> by twice the<br><strong class='color-junk'>JUNK</strong> chance <em style ="float: right;">(${(1 + 2 * (tech.junkChance + level.junkAdded)).toFixed(2)}x)</em>`
}, },
maxCount: 1, maxCount: 1,
count: 0, count: 0,
@@ -7930,8 +7873,8 @@ const tech = {
requires: "negative mass", requires: "negative mass",
effect() { effect() {
tech.isNeutronium = true tech.isNeutronium = true
tech.baseFx *= 0.8 tech.baseFx *= 0.86
tech.baseJumpForce *= 0.8 tech.baseJumpForce *= 0.87
m.setMovement() m.setMovement()
}, },
//also removed in m.setHoldDefaults() if player switches into a bad field //also removed in m.setHoldDefaults() if player switches into a bad field
@@ -8002,6 +7945,68 @@ const tech = {
remove() { remove() {
tech.isFlyFaster = false; tech.isFlyFaster = false;
} }
}, {
name: "Newtons 1st law",
descriptionFunction() {
return `<strong class='color-defense'>damage taken</strong> reduces as your <strong class="color-speed">speed</strong> increases<br>up to <strong>0.05x</strong> <strong class='color-defense'>damage taken</strong> at <strong>60</strong> <strong class="color-speed">speed</strong> <em style ="float: right;">(${(1 - Math.min((tech.speedAdded + player.speed) * 0.01583, 0.95)).toFixed(2)}x)</em>`
},
isFieldTech: true,
maxCount: 1,
count: 0,
frequency: 1,
frequencyDefault: 1,
allowed() {
return m.fieldMode === 3 || m.fieldMode === 10
},
requires: "negative mass, grappling hook",
effect() {
tech.isSpeedHarm = true //max at speed = 40
},
remove() {
tech.isSpeedHarm = false
}
},
{
name: "Newtons 2nd law",
descriptionFunction() {
return `<strong class='color-d'>damage</strong> increases proportional to your <strong class="color-speed">speed</strong><br>up to <strong>3x</strong> <strong class='color-d'>damage</strong> at <strong>60</strong> <strong class="color-speed">speed</strong> <em style ="float: right;">(${(1 + Math.min(2, ((tech.speedAdded + player.speed) * 0.033))).toFixed(2)}x)</em>`
},
isFieldTech: true,
maxCount: 1,
count: 0,
frequency: 1,
frequencyDefault: 1,
allowed() {
return m.fieldMode === 3 || m.fieldMode === 10
},
requires: "negative mass, grappling hook",
effect() {
tech.isSpeedDamage = true //max at speed = 40
},
remove() {
tech.isSpeedDamage = false
}
},
{
name: "modified Newtonian dynamics",
descriptionFunction() {
return `your <strong class="color-speed">speed</strong> counts as <strong>+20</strong> higher<br><em>(for Newton's 1st and 2nd laws)</em>`
},
isFieldTech: true,
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.isSpeedDamage || tech.isSpeedHarm
},
requires: "Newtons 1st or 2nd law",
effect() {
tech.speedAdded = 20
},
remove() {
tech.speedAdded = 0
}
}, },
{ {
name: "additive manufacturing", name: "additive manufacturing",
@@ -8235,7 +8240,7 @@ const tech = {
frequency: 2, frequency: 2,
frequencyDefault: 2, frequencyDefault: 2,
allowed() { allowed() {
return (m.fieldMode === 10 || m.fieldMode === 5 || m.fieldMode === 8) //1 standing wave 2 perfect diamagnetism 3 negative mass 4 molecular assembler 5 plasma torch 6 time dilation 7 metamaterial cloaking 8 pilot wave 9 wormhole 10 grappling hook return (m.fieldMode === 10 || m.fieldMode === 5 || m.fieldMode === 8)
}, },
requires: "plasma torch, grappling hook, pilot wave", requires: "plasma torch, grappling hook, pilot wave",
effect() { effect() {
@@ -9413,7 +9418,7 @@ const tech = {
effect() { effect() {
// tech.damage *= 1.33 // tech.damage *= 1.33
setInterval(() => { setInterval(() => {
if (powerUps.boost.endCycle < m.cycle && !simulation.paused && m.alive) { if (powerUps.boost.endCycle < simulation.cycle && !simulation.paused && m.alive) {
for (let i = 0; i < mob.length; i++) { for (let i = 0; i < mob.length; i++) {
if (mob[i].distanceToPlayer2() < 400000) { //650 if (mob[i].distanceToPlayer2() < 400000) { //650
canvas.requestPointerLock(); canvas.requestPointerLock();
@@ -9596,12 +9601,6 @@ const tech = {
mob[i].death(); mob[i].death();
} }
} }
// for (let i = powerUp.length - 1; i > -1; i--) {
// if (powerUp[i].name !== "ammo") {
// Matter.Composite.remove(engine.world, powerUp[i]);
// powerUp.splice(i, 1);
// }
// }
}, },
remove() { } remove() { }
}, },
@@ -10098,12 +10097,31 @@ const tech = {
}, },
requires: "not pilot wave, tokamak, wormhole", requires: "not pilot wave, tokamak, wormhole",
effect() { effect() {
m.throwBlock = m.throwSelf
}, },
remove() { remove() {
m.throwBlock = m.throwBlockDefault m.throwBlock = m.throwBlockDefault
} }
}, },
{
name: "stationary",
description: "thrown <strong class='color-block'>blocks</strong> can't move,<br>but somehow they still have momentum...",
maxCount: 1,
count: 0,
frequency: 0,
// isInstant: true,
isJunk: true,
allowed() {
return m.fieldMode !== 8 && m.fieldMode !== 9 && !tech.isTokamak
},
requires: "not pilot wave, tokamak, wormhole",
effect() {
tech.isStaticBlock = true
},
remove() {
tech.isStaticBlock = false
}
},
{ {
name: "spinor", name: "spinor",
description: "the direction you aim is determined by your position", description: "the direction you aim is determined by your position",
@@ -10724,7 +10742,7 @@ const tech = {
}, },
{ {
name: "expert system", name: "expert system",
description: "spawn <strong class='color-junk'>JUNK</strong><br><strong>+50%</strong> <strong class='color-junk'>JUNK</strong> chance", description: `spawn ${powerUps.orb.tech()}<br><strong>+50%</strong> <strong class='color-junk'>JUNK</strong> chance`,
maxCount: 9, maxCount: 9,
count: 0, count: 0,
frequency: 0, frequency: 0,
@@ -11430,7 +11448,7 @@ const tech = {
}, },
{ {
name: "wikipedia", name: "wikipedia",
description: `After you get ${powerUps.orb.tech()} you have 7 seconds to study for a quiz. If you ace the quiz you get ${powerUps.orb.research(5)}`, description: `After you get ${powerUps.orb.tech()} you have 7 seconds to study for a quiz. If you ace the quiz you get ${powerUps.orb.research(4)}`,
maxCount: 1, maxCount: 1,
count: 0, count: 0,
frequency: 0, frequency: 0,
@@ -12053,8 +12071,9 @@ const tech = {
isImmunityDamage: null, isImmunityDamage: null,
isMobDeathImmunity: null, isMobDeathImmunity: null,
isMaxHealthDefense: null, isMaxHealthDefense: null,
isNoDefenseDamage: null, noDefenseSettingDamage: null,
isMaxHealthDamage: null, isMaxHealthDamage: null,
isEjectOld: null, isEjectOld: null,
isWiki: null, isWiki: null,
isStaticBlock: null,
} }

View File

@@ -694,22 +694,44 @@ summary {
border-radius: 5px; border-radius: 5px;
} }
#tech { #right-HUD {
position: absolute; position: absolute;
top: 15px; top: 15px;
right: 15px; right: 15px;
z-index: 2; z-index: 2;
font-size: 20px; font-size: 20px;
color: #222;
text-align: right; text-align: right;
opacity: 0.35;
line-height: 120%; line-height: 120%;
background-color: rgba(255, 255, 255, 0.4);
user-select: none; user-select: none;
pointer-events: none; pointer-events: none;
/*border: 2px solid rgba(0, 0, 0, 0.4);*/
color: #222;
padding: 0px 5px 0px 5px; padding: 0px 5px 0px 5px;
border-radius: 5px; border-radius: 5px;
/*border: 2px solid rgba(0, 0, 0, 0.4);*/ opacity: 0.35;
background-color: rgba(255, 255, 255, 0.4);
}
#right-HUD-constraint {
position: absolute;
top: 12px;
right: 15px;
z-index: 2;
font-size: 20px;
text-align: right;
line-height: 120%;
user-select: none;
pointer-events: none;
padding: 5px 10px 5px 10px;
border-radius: 8px;
color: #624;
opacity: 0.35;
background-color: rgba(255, 215, 241, 0.4);
/* color: rgb(141, 23, 88);
opacity: 0.35;
background-color: rgba(141, 23, 88, 0.1); */
/* font-weight: 400; */
transition: all 0.5s linear;
} }
#text-log { #text-log {
@@ -727,6 +749,12 @@ summary {
user-select: none; user-select: none;
} }
.constraint {
color: rgb(141, 23, 88);
/* font-weight: 100; */
/* text-decoration: underline; */
}
.color-text { .color-text {
color: #000; color: #000;
} }

162
todo.txt
View File

@@ -1,55 +1,137 @@
******************************************************** NEXT PATCH ************************************************** ******************************************************** NEXT PATCH **************************************************
JUNK: wikipedia - After you get a new tech you have 7 seconds to study before a quiz, 4 research if you aces the quiz. difficulty
this code for this works 80% of the time every time difficulty level 6 adds flat damage and damage taken
bonus tech no longer spawns on level 2 and 3 on difficulty level 6
at the end of subway you get 1 tech, but not on difficulty level 6
difficulty level 3 and 5 add a random constraint that changes each level
constraints are effects that only last until the level ends
50% JUNK chance
4x shielded mob chance
power ups are sent to next level
+33% chance for mobs to respawn
-1 choice
2x ammo costs
duplication is set to zero
50% max energy
50% max health
bots follow slow
full damage taken after boss dies
0.1x damage after a power up
mob death heals mobs
mobs heal for your lost health
periodically spawn WIMPs
renamed propagator->Verlet integration it's now a skin tech exciton damage boost power up has a chance to spawn without the tech (~3%/mob)
1.6->3x damage damage boost has a unique gel/hair aura for each skin
slightly increased the time skip amount damage boost timer no longer ticks with time dilation field
on some skins the feet will hang lower while player is in the air JUNK tech: stationary - thrown blocks can't move, but they still have momentum
on some skins the upper legs are skinnier added a classic n-gon link for the previous patch in settings
mouse over on orbs for tech, field, and gun has a tooltip with text but images are disabled to save space
added keyword CSS style for "bot" on levels where you can fall endlessly, power ups will also fall endlessly
added an aura around powerUpBoss so you can kinda see it inside walls they no longer teleport to the exit, sorry
quenching just gives max health from over healing instead of damaging you first Newton's 1st and 2nd laws are field tech, and they give twice the effect
depolarization does 0.5->0.4x damage when on cooldown abelian group 4->3x damage while invulnerable
many-worlds spawns a tech and also 3 coupling at the start of each new level bot fabrication price increases after 5->4 bots
dynamic equilibrium does 1.15x more damage and only stacks to 9->3 wikipedia 4->3 research per correct quiz
orbital bots collide with a 1.2x larger range upgraded sound bots fire fewer waves but do more damage per wave
Zectron no longer drains energy when balls hit you, but the balls still stop not much changed except improved performance, I think
supply chain just gives a gun and a flat 10 ammo incendiary ammunition drones explode when they run out of durability not on the first hit
this allows better synergy with other drone tech
polyurethane foam will only trigger up to 55 total foam per harpoon grappling hook retract momentum no longer scales with distance
to prevent a huge number of foam bubbles causing lag this should give you more control
no cap for super balls for now pressing the 3rd button in factory will remove blocks resting on the second block
fixed bug with planned obsolescence + instant tech preventing an endless toggle
fixed bug with ice crystal nucleation
applied science gives each gunTech with a short delay
this helps with sorting and maybe other rare bugs
fixed bug with delivery drones and path integration
you can no longer deflect snakeBoss, but it moves a bit slower
bug fixes
fleas no longer die early after hitting a high health target only once
something with super ball density calculations for tech rebound
grabbing a big block can make grappling hook go flying
added 3 potential fixes, but the bug is too rare know if it's fixed
******************************************************** BUGS ******************************************************** ******************************************************** BUGS ********************************************************
figure out why seeded random isn't making runs the same:
shuffle is being used for a wide variety of things that don't need a seeded random
make two shuffle functions?
check which of these is working
level order
is flipped
constraint order
mob type order
boss order
gun, field, tech options
make field options offered precalculated so it doesn't depend on player choices?
generate all constraints at the start of the game
doesn't seem to be determined by the seed...
display future constraints in pause menu?
at start of level game go stuck in pause state
no crash or bug report
occur level 8
after 2 levels of sending power ups to next level
auto drones grabbed a power up and game froze while in power up mode
running code to exit pause kinda worked
ants marching outline on splash screen doesn't sync right on safari ants marching outline on splash screen doesn't sync right on safari
player can become crouched while not touching the ground if they exit the ground while crouched player can become crouched while not touching the ground if they exit the ground while crouched
*********************************************************** TODO ***************************************************** *********************************************************** TODO *****************************************************
each difficulty setting adds a chance for a random effect
make some effects only possible on certain levels, or with certain bosses?
not implemented random constraint ideas________________________
if player takes too long on a level
spawn mobs at the end of player's history
give a warning before they spawn
black holes, sneakers, bullets
mob death spawns something
bullets
bosses heals nearby mobs
ammo power ups give 0.7x ammo
2x energy costs
0.5x energy regen from all sources
2x research costs
mobs slowly regen health
exit door takes 10x time to open,
and while door is opening (ghosters, suckers) attack?
can't pause while choosing tech, gun, field similar to eternalism
can't have more then 15 bullets
bots do 0.5x damage
remove 2 random tech and return them next level
too niche
player damage is 0.25x while player is invulnerable
all hazards: lasers and slime do 3x damage
player lasers and radiation do 0.5x damage
explosions do 0.5x damage
freeze effects last 0.25x time
tech: - randomize constraints somehow
in pause interface or power up selection menu?
each time you research the current constraints also randomize?
only allowed if difficulty is high enough
tech: - when you get a bot, get a second bot
tech: - boost power ups also give 0.1x damage taken
tech: - tech have +3 choices to eject your tech tech: - tech have +3 choices to eject your tech
<eject> tech name <eject> tech name
no description? no description?
copy negative-player as a boss? or a JUNK tech?
code is in community map (not sure which)
harpoon tech: - after firing 4 harpoons your next harpoon has 4x damage harpoon tech: - after firing 4 harpoons your next harpoon has 4x damage
need to track number fired need to track number fired
JUNK tech - similar to cosmogonic myth, open and close tabs tech: - after killing a Boss
after you learn a new tech open it's wiki and spawn a few research? heal to full
open the wiki for each tech you have, gain 3x damage for the rest of the level
tabs close after 1 minute, and you have to learn something and answer a prompt to get a reward
tech: clicking on this tech in the pause menu will teleport you to the next level
tech: - instead of reeling in grappling hook teleport to the hook after releasing field button tech: - instead of reeling in grappling hook teleport to the hook after releasing field button
this might need another buff? this might need another buff?
@@ -57,6 +139,11 @@ tech: - instead of reeling in grappling hook teleport to the hook after releas
new level - rework testChamber new level - rework testChamber
skin with wheel instead of legs
Boss (or mob) that quickly moves towards player, but they moves perpendicularly to player, like dodging
could respond to when player presses fire key or to when it takes damage
new snakeBoss type that eats mobs new snakeBoss type that eats mobs
each time it eats: each time it eats:
heal? heal?
@@ -80,13 +167,6 @@ Boss mob - records the position of mobs every few cycles
gives mobs short snake tails, like snakeBoss gives mobs short snake tails, like snakeBoss
brings 1 mob back to life every few seconds brings 1 mob back to life every few seconds
merge multiple power ups of the same type if nearby
5-10 ammo, research, coupling can merge to form a slightly larger power up version
check for merger possibility every 60 seconds?
adjust mass spawns to just spawn larger power ups versions and change?
spawnDelay
tech: atomic pile - lose 1 health if you are above the maximum energy tech: atomic pile - lose 1 health if you are above the maximum energy
generate energy for each nearby mob? generate energy for each nearby mob?
do damage? do damage?
@@ -160,9 +240,6 @@ after picking up research gain ____
tech: Energy generation increases with you velocity tech: Energy generation increases with you velocity
Newtons' 3rd law? Newtons' 3rd law?
after clicking on a new tech (or getting it in any way) animate adding the tech to your collection
fade in on right side text list?
tech - getting caught in an explosion gives you _____ tech - getting caught in an explosion gives you _____
damage for 10 seconds? damage for 10 seconds?
heals heals
@@ -1310,6 +1387,9 @@ possible names for tech
Coalescence - things merging together like clouds. maybe mergin power ups? Coalescence - things merging together like clouds. maybe mergin power ups?
trihydrogen cation - common molecule in space, dark matter tech? trihydrogen cation - common molecule in space, dark matter tech?
superradiance - laser tech superradiance - laser tech
cryocoolers - freezing effects
metaphysics - maybe this changes something deep and universal about physics? not sure
cork - used as a heat shield for rockets
******************************************************* DESIGN ****************************************************** ******************************************************* DESIGN ******************************************************