diff --git a/img/Abelian group.webp b/img/Abelian group.webp new file mode 100644 index 0000000..916f955 Binary files /dev/null and b/img/Abelian group.webp differ diff --git a/img/anyon.webp b/img/anyon.webp new file mode 100644 index 0000000..3f88a63 Binary files /dev/null and b/img/anyon.webp differ diff --git a/img/entropic gravity.webp b/img/entropic gravity.webp new file mode 100644 index 0000000..339af23 Binary files /dev/null and b/img/entropic gravity.webp differ diff --git a/img/fermion.webp b/img/fermion.webp new file mode 100644 index 0000000..0de0dab Binary files /dev/null and b/img/fermion.webp differ diff --git a/img/modified Newtonian dynamics.webp b/img/modified Newtonian dynamics.webp new file mode 100644 index 0000000..53a447a Binary files /dev/null and b/img/modified Newtonian dynamics.webp differ diff --git a/img/spin–statistics theorem.webp b/img/spin-statistics theorem.webp similarity index 100% rename from img/spin–statistics theorem.webp rename to img/spin-statistics theorem.webp diff --git a/js/bullet.js b/js/bullet.js index 40bcd84..9b564b1 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -3331,7 +3331,7 @@ const b = { //remove the body and spawn a new drone Composite.remove(engine.world, found) body.splice(body.indexOf(found), 1) - b.delayDrones(found.position, 0.7 * Math.sqrt(found.mass)) + b.delayDrones(found.position, Math.sqrt(found.mass)) //draw a line from the drone to the body on the canvas ctx.beginPath(); ctx.moveTo(this.position.x, this.position.y); @@ -3350,9 +3350,7 @@ const b = { ctx.beginPath(); let vertices = found.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); - } + 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 = 2; ctx.strokeStyle = `rgba(0,0,0,${this.count / 60})` @@ -3573,7 +3571,7 @@ const b = { //remove the body and spawn a new drone Composite.remove(engine.world, found) body.splice(body.indexOf(found), 1) - b.delayDrones(found.position, 0.35 * Math.sqrt(found.mass)) + b.delayDrones(found.position, 0.5 * Math.sqrt(found.mass)) //draw a line from the drone to the body on the canvas ctx.beginPath(); ctx.moveTo(this.position.x, this.position.y); @@ -3772,6 +3770,11 @@ const b = { }); }, superBall(where, velocity, radius) { + let gravity = 0.001 + if (tech.superBallDelay) { + velocity = Vector.mult(velocity, 1.4) + gravity *= 6 + } let dir = m.angle const me = bullet.length; bullet[me] = Bodies.polygon(where.x, where.y, 12, radius, b.fireAttributes(dir, false)); @@ -3787,7 +3790,7 @@ const b = { bullet[me].frictionStatic = 0; if (tech.isSuperHarm) { bullet[me].collidePlayerDo = function () { - this.force.y += this.mass * 0.001; + this.force.y += this.mass * gravity;; if (Matter.Query.collides(this, [player]).length) { this.endCycle = 0 m.energy -= 0.04 @@ -3811,7 +3814,7 @@ const b = { bullet[me].portFrequency = 25 + Math.floor(10 * Math.random()) bullet[me].nextPortCycle = simulation.cycle + bullet[me].portFrequency bullet[me].do = function () { - this.force.y += this.mass * 0.001; + this.force.y += this.mass * gravity; if (this.nextPortCycle < simulation.cycle) { //teleport around if you have tech.isBulletTeleport this.nextPortCycle = simulation.cycle + this.portFrequency const range = 33 * Math.sqrt(radius) * Math.random() @@ -3821,7 +3824,7 @@ const b = { }; } else { bullet[me].do = function () { - this.force.y += this.mass * 0.001; + this.force.y += this.mass * gravity; }; } bullet[me].beforeDmg = function (who) { @@ -3843,7 +3846,6 @@ const b = { Matter.Body.setDensity(bullet[me], bullet[me].calcDensity() * 1.33);//33% more density and damage 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 - let count = 5 const wait = () => { count-- @@ -3857,7 +3859,6 @@ const b = { }); } requestAnimationFrame(wait); - simulation.drawList.push({ //add dmg to draw queue x: this.position.x, y: this.position.y, @@ -6426,10 +6427,7 @@ const b = { have: false, // num: 5, do() { }, - foamBall() { - - - }, + foamBall() { }, fireOne() { m.fireCDcycle = m.cycle + Math.floor((m.crouch ? 27 : 19) * b.fireCDscale); // cool down const speed = m.crouch ? 43 : 36 @@ -6446,21 +6444,33 @@ const b = { const SPREAD = m.crouch ? 0.08 : 0.13 const num = 3 + Math.floor(tech.extraSuperBalls * Math.random()) const speed = m.crouch ? 43 : 36 - let dir = m.angle - SPREAD * (num - 1) / 2; - for (let i = 0; i < num; i++) { - b.superBall({ - x: m.pos.x + 30 * Math.cos(dir), - y: m.pos.y + 30 * Math.sin(dir) - }, { - x: speed * Math.cos(dir), - y: speed * Math.sin(dir) - }, 11 * tech.bulletSize) - dir += SPREAD; + if (tech.isBulletTeleport) { + for (let i = 0; i < num; i++) { + b.superBall({ + x: m.pos.x + 30 * Math.cos(m.angle), + y: m.pos.y + 30 * Math.sin(m.angle) + }, { + x: speed * Math.cos(m.angle), + y: speed * Math.sin(m.angle) + }, 11 * tech.bulletSize) + } + } else { + let dir = m.angle - SPREAD * (num - 1) / 2; + for (let i = 0; i < num; i++) { + b.superBall({ + x: m.pos.x + 30 * Math.cos(dir), + y: m.pos.y + 30 * Math.sin(dir) + }, { + x: speed * Math.cos(dir), + y: speed * Math.sin(dir) + }, 11 * tech.bulletSize) + dir += SPREAD; + } } }, fireQueue() { m.fireCDcycle = m.cycle + Math.floor((m.crouch ? 23 : 15) * b.fireCDscale); // cool down - const num = 1 + 3 + Math.floor(tech.extraSuperBalls * Math.random()) //1 extra + const num = 2 + 3 + Math.floor(tech.extraSuperBalls * Math.random()) //2 extra const speed = m.crouch ? 43 : 36 const delay = Math.floor((m.crouch ? 18 : 12) * b.fireCDscale) @@ -6479,8 +6489,6 @@ const b = { } let count = 0 requestAnimationFrame(cycle); - - }, chooseFireMethod() { //set in simulation.startGame if (tech.oneSuperBall) { @@ -7789,7 +7797,7 @@ const b = { lensDamageOn: 0, //set in tech lens() { this.stuckOn(); - this.angle += 0.02 + this.angle += 0.03 if (this.isInsideArc(m.angle)) { this.lensDamage = this.lensDamageOn ctx.lineWidth = 6 + this.lensDamageOn diff --git a/js/level.js b/js/level.js index 5af63e4..f5cfa4f 100644 --- a/js/level.js +++ b/js/level.js @@ -25,6 +25,7 @@ const level = { // powerUps.research.changeRerolls(99999) // m.immuneCycle = Infinity //you can't take damage // tech.tech[297].frequency = 100 + // tech.addJunkTechToPool(0.5) // m.couplingChange(10) // m.setField("plasma torch") //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 // m.energy = 0 @@ -33,23 +34,23 @@ const level = { // m.energy = 0 // simulation.molecularMode = 2 // m.damage(0.1); - // b.giveGuns("drones") //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("wave") //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.guns[8].ammo = 100000000 // requestAnimationFrame(() => { tech.giveTech("optical amplifier") }); // for (let i = 0; i < 1; ++i) tech.giveTech("combinatorial optimization") - // tech.giveTech("Pareto efficiency") - // for (let i = 0; i < 1; ++i) tech.giveTech("collider") - // for (let i = 0; i < 1; ++i) tech.giveTech("anthropic principle") - // for (let i = 0; i < 1; ++i) tech.giveTech("bubble fusion") + // tech.giveTech("Newtons 2nd law") + // for (let i = 0; i < 1; ++i) tech.giveTech("lens") + // for (let i = 0; i < 1; ++i) tech.giveTech("modified Newtonian dynamics") + // for (let i = 0; i < 1; ++i) tech.giveTech("Newtons 1st law") + // for (let i = 0; i < 1; ++i) tech.giveTech("entropic gravity") // requestAnimationFrame(() => { for (let i = 0; i < 10; i++) b.orbitBot(m.pos, false) }); // requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("ersatz bots") }); // for (let i = 0; i < 1; i++) tech.giveTech("tungsten carbide") // m.lastKillCycle = m.cycle - // for (let i = 0; i < 1; ++i) tech.giveTech("Lorentz transformation") - // for (let i = 0; i < 1; ++i) tech.giveTech("unified field theory") + // for (let i = 0; i < 1; ++i) tech.giveTech("anyon") // for (let i = 0; i < 3; i++) powerUps.directSpawn(450, -50, "tech"); // for (let i = 0; i < 10; i++) powerUps.directSpawn(1750, -500, "research"); // for (let i = 0; i < 100; i++) powerUps.directSpawn(1750, -500, "coupling"); @@ -59,9 +60,8 @@ const level = { // for (let i = 0; i < 1; ++i) spawn.laserLayer(1400, -500) // Matter.Body.setPosition(player, { x: -200, y: -3330 }); // for (let i = 0; i < 4; ++i) spawn.laserLayer(1300, -500 + 100 * Math.random()) - // for (let i = 0; i < 1; ++i) spawn.stinger(1900, -500) // for (let i = 0; i < 1; ++i) spawn.powerUpBossBaby(1900, -500) - // spawn.beetleBoss(1900, -500, 25) + // spawn.sneakBoss(1900, -500) // spawn.zombie(-3000, -500 + 300 * Math.random(), 30, 5, "white") // zombie(x, y, radius, sides, color) // for (let i = 0; i < 5; ++i) spawn.starter(1000 + 1000 * Math.random(), -500 + 300 * Math.random()) // tech.addJunkTechToPool(2) @@ -71,7 +71,7 @@ const level = { level[simulation.isTraining ? "walk" : "initial"]() //normal starting level ************************************************** - // for (let i = 0; i < 2; i++) spawn.ghoster(1300, -500) //ghosters need to spawn after the map loads + // for (let i = 0; i < 2; i++) spawn.ghoster(level.exit.x, level.exit.y) //ghosters need to spawn after the map loads // spawn.bodyRect(2425, -120, 200, 200); // console.log(body[body.length - 1].mass) // simulation.isAutoZoom = false; //look in close @@ -79,7 +79,7 @@ const level = { // simulation.setZoom(); // tech.addJunkTechToPool(0.7) - // for (let i = 0; i < 2; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "tech"); + // 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 < 2; ++i) powerUps.directSpawn(m.pos.x + 450, m.pos.y + 50 * Math.random(), "boost"); // for (let i = 0; i < 100; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "ammo"); // for (let i = 0; i < 2; i++) powerUps.spawn(player.position.x + Math.random() * 50, player.position.y - Math.random() * 50, "field", false); @@ -148,6 +148,7 @@ const level = { }, newLevelOrPhase() { //runs on each new level but also on final boss phases //used for generalist and pigeonhole principle + tech.cancelTechCount = 0 tech.buffedGun++ if (tech.buffedGun > b.inventory.length - 1) tech.buffedGun = 0; if (tech.isGunCycle && b.activeGun !== null && b.inventory.length) { @@ -170,7 +171,7 @@ const level = { } 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 - if (b.activeGun !== null && b.activeGun !== undefined && b.guns[b.activeGun].name !== "laser") { + 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); @@ -793,7 +794,7 @@ const level = { return who }, - boost(x, y, height = 1000, angle = Math.PI / 2) { //height is how high the player will be flung above y + boost(x, y, speed = 1000, angle = Math.PI / 2) { //height is how high the player will be flung above y if (angle !== Math.PI / 2) { //angle !== 3 * Math.PI / 2 angle *= -1 who = map[map.length] = Matter.Bodies.fromVertices(x + 50, y + 35, Vertices.fromPath("80 40 -80 40 -50 -40 50 -40"), { @@ -801,14 +802,13 @@ const level = { category: cat.body, mask: cat.player | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet //cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet }, - yVelocity: 1.21 * Math.sqrt(Math.abs(height)), query() { // check for collisions const rayVector = Vector.add(this.position, Vector.rotate({ x: 100, y: 0 }, angle)) query = (who) => { const list = Matter.Query.ray(who, this.position, rayVector, 100) if (list.length > 0) { - Matter.Body.setVelocity(list[0].bodyA, Vector.rotate({ x: this.yVelocity, y: 0 }, angle)); + Matter.Body.setVelocity(list[0].bodyA, Vector.rotate({ x: 1.21 * Math.sqrt(Math.abs(speed)), y: 0 }, angle)); } } query(body) @@ -818,37 +818,17 @@ const level = { //player collision const list = Matter.Query.ray([player], this.position, rayVector, 100) if (list.length > 0) { - Matter.Body.setVelocity(player, Vector.rotate({ x: this.yVelocity, y: 0 }, angle)); + Matter.Body.setVelocity(player, Vector.rotate({ x: 1.21 * Math.sqrt(Math.abs(speed)), y: 0 }, angle)); m.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts m.hardLandCD = 0 // disable hard landing } - - // if (Matter.Query.region([player], this.boostBounds).length > 0 && !input.down) { - // m.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts - // m.hardLandCD = 0 // disable hard landing - // if (player.velocity.y > 26) { - // Matter.Body.setVelocity(player, { - // x: player.velocity.x, - // y: -15 //gentle bounce if coming down super fast - // }); - // } else { - // Matter.Body.setVelocity(player, { - // x: player.velocity.x + (Math.random() - 0.5) * 2.5, - // y: this.yVelocity //give a upwards velocity that will put the player that the height desired - // }); - // } - // } - //draw const v1 = this.vertices[0] const v2 = this.vertices[1] let unit = Vector.rotate({ x: 60, y: 0 }, angle) let v3 = Vector.add(v2, unit) let v4 = Vector.add(v1, unit) - // ctx.beginPath(); - // ctx.strokeStyle = "#000"; - // ctx.stroke() ctx.beginPath(); ctx.moveTo(v1.x, v1.y) ctx.lineTo(v2.x, v2.y) @@ -856,9 +836,6 @@ const level = { ctx.lineTo(v4.x, v4.y) ctx.fillStyle = "rgba(200,0,255,0.05)"; ctx.fill() - // ctx.strokeStyle = "#000"; - // ctx.stroke() - unit = Vector.rotate({ x: 20, y: 0 }, angle) v3 = Vector.add(v2, unit) v4 = Vector.add(v1, unit) @@ -872,7 +849,6 @@ const level = { }, }); Matter.Body.rotate(who, angle + Math.PI / 2); - return who } else { who = map[map.length] = Matter.Bodies.fromVertices(x + 50, y + 35, Vertices.fromPath("120 40 -120 40 -50 -40 50 -40"), { @@ -890,7 +866,6 @@ const level = { y: y } }, - yVelocity: -1.21 * Math.sqrt(Math.abs(height)), query() { // check for collisions query = (who) => { @@ -898,7 +873,7 @@ const level = { list = Matter.Query.region(who, this.boostBounds) Matter.Body.setVelocity(list[0], { x: list[0].velocity.x + (Math.random() - 0.5) * 2.5, //add a bit of horizontal drift to reduce endless bounces - y: this.yVelocity //give a upwards velocity + y: -1.21 * Math.sqrt(Math.abs(speed)) //give a upwards velocity }); } } @@ -918,7 +893,7 @@ const level = { } else { Matter.Body.setVelocity(player, { x: player.velocity.x + (Math.random() - 0.5) * 2.5, - y: this.yVelocity //give a upwards velocity that will put the player that the height desired + y: -1.21 * Math.sqrt(Math.abs(speed)) //give an upwards velocity that will put the player that the height desired }); } } @@ -928,8 +903,6 @@ const level = { ctx.fillRect(this.boostBounds.min.x, this.boostBounds.min.y - 10, 100, 30); ctx.fillStyle = "rgba(200,0,255,0.05)"; ctx.fillRect(this.boostBounds.min.x, this.boostBounds.min.y - 50, 100, 70); - // ctx.fillStyle = "rgba(200,0,255,0.02)"; - // ctx.fillRect(x, y - 120, 100, 120); }, }); return who @@ -4259,12 +4232,12 @@ const level = { const isFlipped = (simulation.isHorizontalFlipped && Math.random() < 0.33) ? true : false if (isFlipped) { level.setPosToSpawn(9150 + 50, -2230 - 25); - level.exit.x = -100 - 50; + level.exit.x = 400 - 50; level.exit.y = -50 + 25; leftRoomColor = "#cff" rightRoomColor = "rgba(0,0,0,0.13)" } else { - level.setPosToSpawn(-100, -50); + level.setPosToSpawn(400, -50); level.exit.x = 9150; level.exit.y = -2230; } @@ -4272,9 +4245,10 @@ const level = { spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20); //bump for level entrance level.fallMode = "position"; //must set level.fallModeBounds in this mode to prevent player getting stuck left or right level.fallModeBounds = { left: level.enter.x, right: level.exit.x } //used with level.fallMode = "position"; + if (isFlipped) level.fallModeBounds = { left: level.exit.x, right: level.enter.x } //used with level.fallMode = "position"; simulation.fallHeight = 5000 //level.enter.y - 4000 spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20); //bump for level exit - level.defaultZoom = 2500 + level.defaultZoom = 2300 simulation.zoomTransition(level.defaultZoom) document.body.style.backgroundColor = "#cdd9df"; powerUps.spawnStartingPowerUps(6300, 1025) @@ -4284,6 +4258,10 @@ const level = { const boost3 = level.boost(9700, -730, 1050, 1.95) const boost4 = level.boost(4300, -720, 1500, 1.25) const boost5 = level.boost(3000, -1215, 3000, 1.25) + const boost6 = level.boost(8251, -619, 1200, 2.7) + const boost7 = level.boost(7750, -1540, 1050, 1.2) + // const boost6 = level.boost(8235, -619, 3500, 2.9) + const train1 = level.transport(3650, 100, 415, 500, 8); //x,y,width.height,VxGoal,force const train2 = level.transport(1250, 100, 415, 500, -8); //x,y,width.height,VxGoal,force const train3 = level.transport(4050, 100, 415, 500, 8); //x,y,width.height,VxGoal,force @@ -4310,6 +4288,8 @@ const level = { boost3.query(); boost4.query(); boost5.query(); + boost6.query(); + boost7.query(); //trains oscillate back and forth and act like they are bouncing off each other if (train1.position.x < 2850) { train1.changeDirection(true) //go right @@ -4344,7 +4324,7 @@ const level = { ctx.fillStyle = "#cff" if (isFlipped) { - ctx.fillRect(-350, -300, 525, 325); //entrance typically + ctx.fillRect(150, -300, 525, 325); //entrance typically } else { ctx.fillRect(8925, -2575, 525, 400) //exit typically } @@ -4357,10 +4337,11 @@ const level = { ctx.fillRect(8300, -1950, 1550, 1275); ctx.fillRect(5400, 875, 1800, 650); ctx.fillRect(2950, -2200, 875, 1050); + ctx.fillRect(5900, -1025, 800, 450); if (isFlipped) { ctx.fillRect(8925, -2575, 575, 400) //exit typically } else { - ctx.fillRect(-350, -300, 525, 325); //entrance typically + ctx.fillRect(150, -300, 525, 325); //entrance typically } ctx.fillStyle = "rgba(0,0,0,0.5)" @@ -4383,10 +4364,10 @@ const level = { // spawn.mapVertex(6300, 900, `${-a} ${-a + c} ${-a + c} ${-a} ${a - c} ${-a} ${a} ${-a + c} ${a} ${a - c} ${a - c} ${a} ${-a + c} ${a} ${-a} ${a - c}`); //square with edges cut off spawn.mapVertex(400, 900, `${-a} ${-a + c} ${-a + c} ${-a} ${a - c} ${-a} ${a} ${-a + c} ${a} ${a - c} ${a - c} ${a} ${-a + c} ${a} ${-a} ${a - c}`); //square with edges cut off //lower 1st zone entrance /exit - spawn.mapRect(-400, -350, 575, 75); - spawn.mapRect(-400, -300, 75, 375); - spawn.mapRect(100, -325, 75, 175); - spawn.mapRect(100, -10, 75, 50); + spawn.mapRect(100, -350, 575, 75); + spawn.mapRect(100, -300, 75, 375); + spawn.mapRect(600, -325, 75, 175); + spawn.mapRect(600, -10, 75, 50); //2nd zone upper hollow square @@ -4421,24 +4402,28 @@ const level = { //lower 3rd zone spawn.mapVertex(6300, 450, `${-a} ${-a + c} ${-a + c} ${-a} ${a - c} ${-a} ${a} ${-a + c} ${a} ${0} ${-a} ${0}`); //square with edges cut off --- hollow top - spawn.mapVertex(6550, 1650, `${-a} ${600} ${a + 500} ${600} ${a + 500} ${a - c} ${a - c + 500} ${a} ${-a + c} ${a} ${-a} ${a - c}`); //square with edges cut off --- hollow bottom spawn.mapVertex(6300, 1200, "-400 -40 -350 -90 350 -90 400 -40 400 40 350 90 -350 90 -400 40"); + spawn.mapVertex(6450, 1650, `${-a} ${600} ${a + 700} ${600} ${a + 700} ${a - c} ${a - c + 700} ${a} ${-a + c} ${a} ${-a} ${a - c}`); //square with edges cut off --- hollow bottom //upper 3rd zone a = 400 //side length c = 50 //corner offset - spawn.mapVertex(6300, -800, `${-a} ${-a + c} ${-a + c} ${-a} ${a - c} ${-a} ${a} ${-a + c} ${a} ${a - c} ${a - c} ${a} ${-a + c} ${a} ${-a} ${a - c}`); //square with edges cut off + // spawn.mapVertex(6300, -800, `${-a} ${-a + c} ${-a + c} ${-a} ${a - c} ${-a} ${a} ${-a + c} ${a} ${a - c} ${a - c} ${a} ${-a + c} ${a} ${-a} ${a - c}`); //square with edges cut off + spawn.mapVertex(6300, -1100, `${-a} ${-a + c} ${-a + c} ${-a} ${a - c} ${-a} ${a} ${-a + c} ${a} ${-200} ${-a} ${-200}`); //square with edges cut off + spawn.mapVertex(6300, -500, `${-a} ${200} ${a} ${200} ${a} ${a - c} ${a - c} ${a} ${-a + c} ${a} ${-a} ${a - c}`); //square with edges cut off spawn.mapVertex(5800, -1425, "-300 -40 -250 -90 250 -90 300 -40 300 40 250 90 -250 90 -300 40"); spawn.mapVertex(5485, -1850, "-400 -40 -350 -90 350 -90 400 -40 400 40 350 90 -350 90 -400 40"); - spawn.mapVertex(7365, -1850, "-650 -40 -600 -90 600 -90 650 -40 650 40 600 90 -600 90 -650 40"); //long + spawn.mapVertex(7115, -1850, "-400 -40 -350 -90 350 -90 400 -40 400 40 350 90 -350 90 -400 40"); //long spawn.mapVertex(6300, -2175, "-300 -40 -250 -90 250 -90 300 -40 300 40 250 90 -250 90 -300 40"); //highest spawn.mapVertex(4450, -1850, "-200 -40 -150 -90 150 -90 200 -40 200 40 150 90 -150 90 -200 40"); - spawn.mapVertex(5500, -300, "-200 -60 -170 -90 170 -90 200 -60 200 60 170 90 -170 90 -200 60"); - spawn.mapVertex(4600, -590, "-500 -90 170 -90 200 -60 200 60 170 90 -500 90"); + // spawn.mapVertex(5300, -300, "-300 -60 -270 -90 270 -90 300 -60 300 60 270 90 -270 90 -300 60"); + spawn.mapVertex(5300, -300, "-300 -40 -250 -90 250 -90 300 -40 300 40 250 90 -250 90 -300 40"); + spawn.mapVertex(4500, -590, "-300 -90 250 -90 300 -40 300 40 250 90 -300 90"); + // spawn.mapVertex(4600, -590, "-500 -90 170 -90 200 -60 200 60 170 90 -500 90"); //no debris on this level, so spawn some heals and ammo powerUps.chooseRandomPowerUp(6275, 1425); - powerUps.chooseRandomPowerUp(3350, -1250); + powerUps.chooseRandomPowerUp(6300, -650); powerUps.chooseRandomPowerUp(9550, -750); //random blocks @@ -4463,7 +4448,6 @@ const level = { spawn.randomMob(4675, -850, 0.1); spawn.randomMob(4450, -2050, 0.1); spawn.randomMob(4050, -2325, 0.1); - spawn.randomMob(2850, -2325, 0.1); spawn.randomMob(3350, -1325, 0.2); spawn.randomMob(5300, -2050, 0.2); spawn.randomMob(5675, -2050, 0.2); @@ -12121,12 +12105,6 @@ const level = { return bound.has(player.bounds.min) || bound.has(player.bounds.max); } - function addWIMP(x, y) { - spawn.WIMP(x, y); - const me = mob[mob.length - 1]; - me.isWIMP = true; - } - function relocateWIMPs(x, y) { for (const i of mob) { if (i.isWIMP) { @@ -12665,10 +12643,11 @@ const level = { Promise.resolve().then(() => { // Clear all WIMPS and their research for (let i = 0; i < mob.length; i++) { - while (mob[i] && !mob[i].isMACHO) { - mob[i].replace(i); + if (mob[i] && !mob[i].isMACHO) { + mob[i].isWIMP = true; } } + relocateWIMPs(0, -10030); for (let i = 0; i < powerUp.length; i++) { while (powerUp[i] && powerUp[i].name === "research") { Matter.Composite.remove(engine.world, powerUp[i]); @@ -12884,7 +12863,7 @@ const level = { return this.rings.length; }, get cap() { - return (this.ringNumber + 1) * 90 + 240; + return this.ringNumber * 90 + 180; }, get capped() { return templePlayer.room2.spawnInitiatorCycles > this.cap; @@ -12919,8 +12898,8 @@ const level = { y: -300 }), simulation.cycle - 5); } - if (!this.capped && cycle >= this.cap - 200) { - const multCoeff = (cycle - this.cap + 200) * 0.4 + if (!this.capped && cycle >= this.cap - 180) { + const multCoeff = (cycle - this.cap + 180) * 0.4 ctx.translate((Math.random() - 0.5) * multCoeff, (Math.random() - 0.5) * multCoeff); } ctx.shadowBlur = 20; @@ -12930,12 +12909,12 @@ const level = { DrawTools.arcOut(this.pos.x, this.pos.y, 100, 0, Math.PI * 2); if (templePlayer.room2.cycles <= 100) { for (let i = 0; i < this.ringNumber; i++) { - if (cycle < i * 90 + 90) break; + if (cycle < i * 90) break; const ring = this.rings[i]; ctx.shadowColor = `rgb(${ring.colour.join(",")})`; - const opacity = this.capped ? 1 - 0.01 * templePlayer.room2.cycles : (cycle / 180 - i / 2 - 0.5); + const opacity = this.capped ? 1 - 0.01 * templePlayer.room2.cycles : (cycle / 180 - i / 2); ctx.strokeStyle = `rgba(${ring.colour.join(",")}, ${Math.min(opacity, 1)})`; - const radius = (this.capped ? 1 + 0.07 * templePlayer.room2.cycles : Math.sin(Math.min(cycle - i * 90 - 90, 45) / 90 * Math.PI)) * ring.radius; + const radius = (this.capped ? 1 + 0.07 * templePlayer.room2.cycles : Math.sin(Math.min(cycle - i * 90, 45) / 90 * Math.PI)) * ring.radius; DrawTools.arcOut(this.pos.x, this.pos.y, radius, 0, Math.PI * 2); } } @@ -13083,14 +13062,15 @@ const level = { room0() { if (templePlayer.startAnim <= 0) return; templePlayer.startAnim++; - if (templePlayer.startAnim == 120) { + if (templePlayer.startAnim == 60) { makeLore("Not so fast."); } - if (templePlayer.startAnim < 360) { + if (templePlayer.startAnim < 180) { trapPlayer(1000, templePlayer.initialTrapY); } else { level.exit.x = 4500; level.exit.y = -2030; + relocateWIMPs(level.exit.x, level.exit.y); relocateTo(50, -2050); simulation.fallHeight = -1000; // simulation.setZoom(1800); @@ -13101,49 +13081,31 @@ const level = { } }, room1() { - if (templePlayer.room1ToRoom2Anim <= 0) return; - if (templePlayer.room1ToRoom2Anim === 1) { + const frame = templePlayer.room1ToRoom2Anim; + if (frame <= 0) return; + if (frame === 1) { level.exit.x = -50; level.exit.y = -10030; makeLore("Pathetic."); } - if (templePlayer.room1ToRoom2Anim === 121) { - makeLore("You will never succeed."); - } - if (templePlayer.room1ToRoom2Anim >= 360 && templePlayer.room1ToRoom2Anim <= 720) { - const factor = 200 - 200 * Math.cos((templePlayer.room1ToRoom2Anim / 120 - 3) * Math.PI); + if (frame >= 1 && frame <= 360) { + const factor = 100 - 100 * Math.cos((frame / 90) * Math.PI); ctx.translate(factor, factor); Promise.resolve().then(() => { ctx.save(); ctx.globalCompositeOperation = "color-burn"; - ctx.fillStyle = DrawTools.randomColours; + ctx.fillStyle = DrawTools.randomColours((frame) * (360 - frame) / 32400); DrawTools.updateRandomColours(5); ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.restore(); }); } - if (templePlayer.room1ToRoom2Anim === 720) { + if (frame === 180) { makeLore("You are trying too hard."); relocateTo(0, -7050); simulation.fallHeight = -6000; templePlayer.stage = 2; - } - if (templePlayer.room1ToRoom2Anim === 960) { - makeLore("I have mastered the understandings of the universe."); - } - if (templePlayer.room1ToRoom2Anim === 1200) { - // Congrats, you discovered the actual words by looking at the source code. Are you happy now? - const x = ( - ["a speck of dust", "an insignificant hindrance", "a tiny obstacle"] - )[Math.floor(Math.random() * 3)].split(""); - for (let i = 0; i < x.length / 1.6; i++) { - const randomIndex = Math.floor(Math.random() * x.length); - if (x[randomIndex] !== " ") { - x[randomIndex] = String.fromCharCode(Math.floor(Math.random() * 50) + 192); - } - }; - makeLore(`You are no more than ${x.join("")} to me.`); - relocateWIMPs(0, -10030); + relocateWIMPs(level.exit.x, level.exit.y - 3000); } templePlayer.room1ToRoom2Anim++; }, @@ -13154,23 +13116,10 @@ const level = { level.exit.y = -13130; makeLore("Do not try me."); } + if (templePlayer.room2ToRoom3Anim >= 1 && templePlayer.room2ToRoom3Anim <= 180) { + canvas.style.filter = `sepia(${templePlayer.room2ToRoom3Anim / 180}) invert(${templePlayer.room2ToRoom3Anim / 180})`; + } if (templePlayer.room2ToRoom3Anim === 180) { - makeLore("I have absolute power over you."); - canvas.style.filter = "hue-rotate(90deg)"; - } - if (templePlayer.room2ToRoom3Anim === 360) { - makeLore("You will not succeed..."); - canvas.style.filter = "invert(0.2)"; - } - if (templePlayer.room2ToRoom3Anim === 420) { - makeLore("