new level corridor
  new level element fizzler - it removes blocks
interferometer has wider platforms, a few helpful blocks, and fewer mobs
level constraints are announced in console

foam gun no longer pushes the player back when firing
wave gun buffs
  1.2x base damage
  1.1x base ammo
  0.1->0.13x speed in map
  0.25->0.30x speed in blocks
  tech: phase velocity 1.4->1.5x damage
pigeonhole principle gives 1.3->1.4 damage per gun
  you can no longer switch guns, your gun cycles each level
quenching 0.4->0.5x overheal converts into max health
tungsten carbide no longer has reduced coyote cycles
control theory 1.5->2x damage at max health
stability 0.3->0.2 damage taken at max health
overcharge +88->100 max energy, 4->5% JUNK
zoospore vector 10->13% chance for spores on mob death
replication 15->10% JUNK
interest 6->5% of your power ups spawn each level

updated "about" details menu
  moved classic n-gon to here from settings
  added links to community content in "about"
    Are there more links I should add?
  added an n-gon SVG head image

bugs
  fixed outline on splash screen doesn't sync right on safari browser
  fixed possible lock out on training levels: "hold", "throw", "throwAt"
    from losing block behind a door
  shortcut sort buttons in experiment mode properly order tech without clicking sort
  fixed/increased the horizontal velocity contribution for some guns
    this makes bullets shot on moving platforms more realistic
    nail gun, super balls, foam, harpoon
This commit is contained in:
landgreen
2024-12-24 11:22:57 -08:00
parent 1966173f88
commit 2daeae1ff4
12 changed files with 643 additions and 603 deletions

View File

@@ -10,7 +10,7 @@ const level = {
levelsCleared: 0,
isFlipped: false,
uniqueLevels: ["initial", "reservoir", "factory", "interferometer", "reactor", "subway", "final"], //see level.populateLevels: (initial, ... , (reservoir, factory, or interferometer), reactor, ... , subway, final) added later
playableLevels: ["labs", "rooftops", "skyscrapers", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber", "pavilion", "lock", "towers", "flocculation", "gravitron", "substructure"],
playableLevels: ["labs", "rooftops", "skyscrapers", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber", "pavilion", "lock", "towers", "flocculation", "gravitron", "substructure", "corridor"],
communityLevels: ["gauntlet", "stronghold", "basement", "crossfire", "vats", "run", "ngon", "house", "perplex", "coliseum", "tunnel", "islands", "temple", "dripp", "biohazard", "stereoMadness", "yingYang", "staircase", "fortress", "commandeer", "clock", "buttonbutton", "downpour", "superNgonBros", "underpass", "cantilever", "tlinat", "ruins", "ace", "crimsonTowers", "LaunchSite", "shipwreck", "unchartedCave", "dojo", "arena", "soft", "flappyGon", "rings", "trial"],
trainingLevels: ["walk", "crouch", "jump", "hold", "throw", "throwAt", "deflect", "heal", "fire", "nailGun", "shotGun", "superBall", "matterWave", "missile", "stack", "mine", "grenades", "harpoon"],
levels: [],
@@ -23,7 +23,7 @@ const level = {
// level.levelsCleared = 10
// level.updateDifficulty()
// tech.giveTech("performance")
// m.maxHealth = m.health = 1//00000000
// m.maxHealth = m.health = 100000000
// m.maxEnergy = m.energy = 10000000
// tech.isRerollDamage = true
// powerUps.research.changeRerolls(99999)
@@ -48,24 +48,24 @@ const level = {
// requestAnimationFrame(() => { tech.giveTech("non-renewables") });
// tech.giveTech("dark matter")
// tech.addJunkTechToPool(0.5)
// for (let i = 0; i < 1; ++i) tech.giveTech("nail-bot")
// for (let i = 0; i < 1; ++i) tech.giveTech("quantum immortality")
// for (let i = 0; i < 1; ++i) tech.giveTech("pigeonhole principle")
// for (let i = 0; i < 1; ++i) tech.giveTech("generalist")
// m.skin.egg();
// for (let i = 0; i < 1; ++i) tech.giveTech("many-worlds")
// requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("quasiparticles") });
// requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("field coupling") });
// requestAnimationFrame(() => { for (let i = 0; i < 1; i++) tech.giveTech("interest") });
// for (let i = 0; i < 1; i++) tech.giveTech("interest")
// m.lastKillCycle = m.cycle
// for (let i = 0; i < 1; i++) powerUps.directSpawn(450, -50, "warp");
// for (let i = 0; i < 7; i++) powerUps.directSpawn(m.pos.x + 200, m.pos.y - 250, "research", false);
// spawn.bodyRect(575, -700, 150, 150); //block mob line of site on testing
// level.cocoon();
// level.corridor();
level[simulation.isTraining ? "walk" : "initial"]() //normal starting level **************************************************
// for (let i = 0; i < 1; ++i) spawn.shieldingBoss(1900, -500)
// for (let i = 0; i < 1; ++i) spawn.powerUpBossBaby(1900, -500)
// for (let i = 0; i < 1; i++) spawn.mantisBoss(1900, -500)
// for (let i = 0; i < 1; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "entanglement");
@@ -168,14 +168,14 @@ const level = {
tech.tokamakHealCount = 0
tech.buffedGun++
if (tech.buffedGun > b.inventory.length - 1) tech.buffedGun = 0;
if (tech.isGunCycle && (b.activeGun !== null && b.activeGun !== undefined) && b.inventory.length) {
if ((tech.isGunCycle || tech.isGunChoice) && (b.activeGun !== null && b.activeGun !== undefined) && b.inventory.length) {
b.inventoryGun = tech.buffedGun;
simulation.switchGun();
}
if (tech.isGunChoice && Number.isInteger(tech.buffedGun) && b.inventory.length) {
var gun = b.guns[b.inventory[tech.buffedGun]].name
simulation.inGameConsole(`pigeonhole principle: <strong>${(1.3 * Math.max(0, b.inventory.length)).toFixed(2)}x</strong> <strong class='color-d'>damage</strong> for <strong class="highlight">${gun}</strong>`, 600);
}
// if (tech.isGunChoice && Number.isInteger(tech.buffedGun) && b.inventory.length) {
// var gun = b.guns[b.inventory[tech.buffedGun]].name
// simulation.inGameConsole(`pigeonhole principle: <strong>${(1 + 0.4 * Math.max(0, b.inventory.length)).toFixed(2)}x</strong> <strong class='color-d'>damage</strong> for <strong class="highlight">${gun}</strong>`, 600);
// }
if (tech.isSwitchReality && level.levelsCleared !== 0) {
simulation.inGameConsole(`simulation.amplitude <span class='color-symbol'>=</span> ${Math.random()}`);
m.switchWorlds("many-worlds")
@@ -187,7 +187,12 @@ const level = {
for (let i = 0; i < len; i++) powerUps.spawn(player.position.x + 90 * (Math.random() - 0.5), player.position.y + 90 * (Math.random() - 0.5), "heal", false);
}
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
let rate = tech.interestRate
if (level.onLevel < level.levels.length - 1) {//make sure it's not on the lore level which has an undefined name
const levelName = level.levels[level.onLevel]
if (levelName === "final" || levelName === "subway") rate *= 1 / 3
}
let ammoSum = 0
for (let i = 0; i < b.inventory.length; i++) {
@@ -315,10 +320,13 @@ const level = {
}
//update HUD with constraints
let text = `${level.constraintDescription1}`
if (level.constraintDescription1) simulation.inGameConsole(`<span style="color:#624;background-color: rgba(255, 215, 241, 0.4);">constraint</span>: ${level.constraintDescription1}`)
if (simulation.difficultyMode > 6 && level.constraintDescription2) {
text += `<br>${level.constraintDescription2}`
if (level.constraintDescription2) simulation.inGameConsole(`<span style="color:#624;background-color: rgba(255, 215, 241, 0.4);">constraint</span>: ${level.constraintDescription2}`)
}
document.getElementById("right-HUD-constraint").innerHTML = text
if (level.constraintDescription1) {
if (level.constraintDescription2) {
document.getElementById("right-HUD").style.top = "80px";
@@ -2290,6 +2298,55 @@ const level = {
},
}
},
fizzler(p1, p2) {
return {
isOn: true,
position: p1,
look: p2,
color: color,
query() {
if (!m.isTimeDilated) {
// let best = { x: null, y: null, dist2: Infinity, who: null, v1: null, v2: null }
// best = vertexCollision(this.position, this.look, [body]);
const hits = Matter.Query.ray(body, this.position, this.look, 25)
for (let i = hits.length - 1; i > -1; i--) {
// console.log(what)
const what = hits[i].bodyA
simulation.drawList.push({ x: what.position.x, y: what.position.y, radius: 11, color: "rgba(0,160,255,0.7)", time: 10 });
if (what === m.holdingTarget) m.drop()
for (let i = 0; i < body.length; i++) {
if (body[i] === what) {
body.splice(i, 1);
break
}
}
Matter.Composite.remove(engine.world, what);
}
//draw
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
ctx.lineTo(this.look.x, this.look.y);
// ctx.strokeStyle = "rgba(50,200,255,0.3)";
// ctx.lineWidth = 2 + 5 * Math.random()
// ctx.stroke();
ctx.strokeStyle = "rgba(50,160,255,0.17)";
ctx.lineWidth = 35 + 25 * Math.random() * Math.random();
ctx.stroke();
//draw random dots in the path
if (Math.random() < 0.05) {
const r = Math.random();
const where = {
x: this.position.x + r * (this.look.x - this.position.x) + 60 * (Math.random() - 0.5),
y: this.position.y + r * (this.look.y - this.position.y) + 60 * (Math.random() - 0.5)
};
simulation.drawList.push({ x: where.x, y: where.y, radius: 6, color: "rgba(0,160,255,0.7)", time: 5 });
}
}
},
}
},
isHazardRise: false,
hazard(x, y, width, height, damage = 0.002) {
return {
@@ -2474,6 +2531,19 @@ const level = {
ctx.lineDashOffset = (-simulation.cycle * this.VxGoal) % 80;
ctx.stroke();
ctx.setLineDash([0, 0]);
},
drawFast() {
ctx.beginPath();
const v = this.vertices;
ctx.moveTo(v[0].x + 2, v[0].y);
// for (let i = 1; i < v.length; ++i) ctx.lineTo(v[i].x, v[i].y);
ctx.lineTo(v[1].x - 2, v[1].y);
ctx.strokeStyle = "#000"
ctx.lineWidth = 4;
ctx.setLineDash([60, 60]);
ctx.lineDashOffset = (-simulation.cycle * this.VxGoal) % 120;
ctx.stroke();
ctx.setLineDash([0, 0]);
}
});
Matter.Body.setStatic(rect, true); //make static
@@ -5410,7 +5480,7 @@ const level = {
if (badBlocks[j] === body[i]) index = i
}
//remove block
console.log(index, j)
// console.log(index, j)
if (index) {
Matter.Composite.remove(engine.world, badBlocks[j]);
body.splice(index, 1);
@@ -7199,7 +7269,7 @@ const level = {
let buildMapOutline = function () {
//boxes center on zero,zero with deep walls to hide background
spawn.mapRect(2000, -2000, 2000, 4000); //right map wall
spawn.mapRect(2025, -2000, 1975, 4000); //right map wall
spawn.mapRect(-4000, -2000, 2000, 4000); //left map wall
spawn.mapRect(-4000, -5000, 8000, 3000); //map ceiling
spawn.mapRect(-4000, 2000, 8000, 3000); //floor
@@ -7233,7 +7303,7 @@ const level = {
balance.push(level.rotor(-750, 1755, 400, 25, 0.01, Math.PI / 2, 0.5))
balance.push(level.rotor(-275, 1675, 550, 32, 0.01, 0, 0.5))
lasers.push(level.laser({ x: -1625, y: -850 }, { x: 1980, y: -850 })) ////x, y, width, height, damage = 0.002)
lasers.push(level.laser({ x: 1610, y: -850 }, { x: -1625, y: -850 })) ////x, y, width, height, damage = 0.002)
// spawn.mapRect(1980, -862, 25, 25); //laser entrance
// balance.push(level.rotor(1000, -910, 550, 32, 0.01, 0, 0.5))
@@ -7263,9 +7333,9 @@ const level = {
spawn.mapRect(1925, 800, 200, 200);
spawn.mapRect(1925, 1300, 200, 200);
spawn.mapRect(1400, 1650, 200, 25);
spawn.mapRect(1400, 1125, 200, 25);
spawn.mapRect(1400, 600, 200, 25);
spawn.mapRect(1250, 1650, 500, 25);
spawn.mapRect(1300, 1125, 400, 25);
spawn.mapRect(1350, 600, 300, 25);
spawn.mapRect(1400, 75, 200, 25);
spawn.mapRect(650, 1287, 475, 50);
@@ -7273,9 +7343,9 @@ const level = {
spawn.mapRect(650, 150, 500, 225);
spawn.mapRect(350, 1300, 800, 375);
spawn.mapRect(350, 950, 150, 400);
spawn.mapRect(175, 950, 325, 100);
spawn.mapRect(150, 525, 350, 200);
spawn.mapRect(150, 75, 350, 200);
spawn.mapRect(-25, 950, 525, 100);
spawn.mapRect(-75, 525, 575, 200);
spawn.mapRect(-75, 75, 575, 200);
spawn.mapRect(475, 1987, 550, 50);
//ceiling zone
@@ -7315,7 +7385,7 @@ const level = {
balance.push(level.rotor(-750, -1755 - 25, 400, 25, 0.01, Math.PI / 2, 0.5))
balance.push(level.rotor(-250, -1675 - 32, 500, 32, 0.01, 0, 0.5))
lasers.push(level.laser({ x: -1625, y: 850 }, { x: 1980, y: 850 })) ////x, y, width, height, damage = 0.002)
lasers.push(level.laser({ x: 1610, y: 850 }, { x: -1625, y: 850 })) ////x, y, width, height, damage = 0.002)
// spawn.mapRect(1980, 862 - 25, 25, 25); //laser entrance
// balance.push(level.rotor(1000, 910 - 32, 550, 32, 0.01, 0, 0.5))
@@ -7340,9 +7410,9 @@ const level = {
spawn.mapRect(1925, -800 - 200, 200, 200);
spawn.mapRect(1925, -1300 - 200, 200, 200);
spawn.mapRect(1400, -1650 - 25, 200, 25);
spawn.mapRect(1400, -1125 - 25, 200, 25);
spawn.mapRect(1400, -600 - 25, 200, 25);
spawn.mapRect(1250, -1650 - 25, 500, 25);
spawn.mapRect(1300, -1125 - 25, 400, 25);
spawn.mapRect(1350, -600 - 25, 300, 25);
spawn.mapRect(1400, -75 - 25, 200, 25);
spawn.mapRect(650, -1287 - 50, 475, 50);
@@ -7350,11 +7420,10 @@ const level = {
spawn.mapRect(650, -150 - 225, 500, 225);
spawn.mapRect(350, -1300 - 375, 800, 375);
spawn.mapRect(350, -950 - 400, 150, 400);
spawn.mapRect(175, -950 - 100, 325, 100);
spawn.mapRect(150, -525 - 200, 350, 200);
spawn.mapRect(150, -75 - 200, 350, 200);
spawn.mapRect(-25, -950 - 100, 525, 100);
spawn.mapRect(-75, -525 - 200, 575, 200);
spawn.mapRect(-75, -75 - 200, 575, 200);
spawn.mapRect(475, -1987 - 50, 550, 50);
//ceiling zone
spawn.mapRect(1200, 1575, 400, 25);
spawn.mapRect(-75, 1700, 1075, 25);
@@ -7463,16 +7532,16 @@ const level = {
//spawn second wave of flipped mobs only once
spawn.randomMob(-1500, -1425, 0);
spawn.randomMob(-950, -1425, 0);
spawn.randomMob(-800, -1475, 0.1);
spawn.randomMob(-425, -1425, 0.1);
spawn.randomMob(850, -1750, 0.2);
spawn.randomMob(325, -850, 0.2);
spawn.randomMob(400, -400, 0.3);
spawn.randomMob(825, -475, 0.3);
spawn.randomMob(875, -1050, 0.4);
spawn.randomMob(1425, 1425, 0.5);
spawn.randomMob(675, 1450, 0.7);
spawn.randomMob(225, 1475, 0.9);
spawn.randomMob(-800, -1475, 0);
spawn.randomMob(-425, -1425, 0);
spawn.randomMob(850, -1750, 0.1);
spawn.randomMob(325, -850, 0.1);
spawn.randomMob(400, -400, 0.2);
spawn.randomMob(825, -475, 0.2);
spawn.randomMob(875, -1050, 0.3);
spawn.randomMob(1425, 1425, 0.4);
spawn.randomMob(675, 1450, 0.5);
spawn.randomMob(225, 1475, 0.6);
spawn.randomMob(-275, 1425, 1);
spawn.randomMob(-800, 1375, 1);
@@ -7551,7 +7620,7 @@ const level = {
ctx.fillRect(-1075, -2025, 450, 725);
ctx.fillRect(-575, -2025, 450, 725);
ctx.fillRect(175, -250 - 725, 325, 725);
ctx.fillRect(-25, -250 - 725, 525, 725);
ctx.fillRect(650, -350 - 975, 475, 975);
ctx.fillRect(375, -1650 - 400, 750, 400);
//ceiling
@@ -7569,7 +7638,7 @@ const level = {
ctx.fillRect(-1075, 1300, 450, 725);
ctx.fillRect(-575, 1300, 450, 725);
ctx.fillRect(175, 250, 325, 725);
ctx.fillRect(-25, 250, 525, 725);
ctx.fillRect(650, 350, 475, 975);
ctx.fillRect(375, 1650, 750, 400);
//ceiling
@@ -7581,6 +7650,9 @@ const level = {
ctx.fillRect(-1625, -2025, 475, 450);
}
};
spawn.bodyRect(1325, -1775, 175, 175);
spawn.bodyRect(-375, -1725, 100, 75, 0.5);
spawn.bodyRect(-900, -1625, 125, 200, 0.5);
spawn.bodyRect(-1662, 1325, 25, 175);
spawn.bodyRect(-1662, 1825, 25, 175);
@@ -7601,24 +7673,24 @@ const level = {
spawn.randomMob(-1350, -1750, 0);
spawn.randomMob(-875, -1575, 0);
spawn.randomMob(500, -1875, 0);
spawn.randomMob(350, 825, 0.1);
spawn.randomMob(375, 400, 0.1);
spawn.randomMob(1500, -25, 0.2);
spawn.randomMob(650, -1950, 0.3);
spawn.randomMob(775, 700, 0.3);
spawn.randomMob(275, -50, 0.4);
spawn.randomMob(75, -1750, 0.5);
spawn.randomMob(1750, -1425, 0.5);
spawn.randomMob(950, 50, 0.6);
spawn.randomMob(-1375, 175, 0.6);
spawn.randomMob(-350, 175, 0.7);
spawn.randomMob(725, 1175, 0.7);
spawn.randomMob(-850, -1950, 0.8);
spawn.randomMob(-1400, -1725, 0.9);
spawn.randomMob(1400, -1700, 0.9);
spawn.randomMob(-800, 200, 0.9);
spawn.randomMob(1475, 1550, 1);
spawn.randomMob(1475, 500, 1);
spawn.randomMob(350, 825, 0);
spawn.randomMob(375, 400, 0);
spawn.randomMob(1500, -25, 0.1);
spawn.randomMob(650, -1950, 0.2);
spawn.randomMob(775, 700, 0.2);
spawn.randomMob(275, -50, 0.3);
spawn.randomMob(75, -1750, 0.3);
spawn.randomMob(1750, -1425, 0.4);
spawn.randomMob(950, 50, 0.4);
spawn.randomMob(-1375, 175, 0.4);
spawn.randomMob(-350, 175, 0.5);
spawn.randomMob(725, 1175, 0.5);
spawn.randomMob(-850, -1950, 0.6);
spawn.randomMob(-1400, -1725, 0.7);
spawn.randomMob(1400, -1700, 0.7);
spawn.randomMob(-800, 200, 0.7);
spawn.randomMob(1475, 1550, 0.8);
spawn.randomMob(1475, 500, 0.8);
powerUps.spawnStartingPowerUps(-875, -1925);
spawn.randomLevelBoss(-875, -200);
@@ -8155,45 +8227,256 @@ const level = {
powerUps.directSpawn(2100, 925, "heal");
powerUps.directSpawn(625, -100, "heal");
},
cocoon() {
corridor() {
// simulation.fallHeight = 4000
level.announceMobTypes()
level.setPosToSpawn(-3800, 950);
level.exit.x = 3750
level.exit.y = -625
level.defaultZoom = 2000
level.defaultZoom = 2400
simulation.zoomTransition(level.defaultZoom)
document.body.style.backgroundColor = "#d0d5d5";
color.map = "#444"
// level.isHorizontalFlipped = true
if (level.isHorizontalFlipped) {
level.setPosToSpawn(14075, -625);
level.exit.x = -350
level.exit.y = 505
spawn.bodyRect(13525, -675, 50, 100);
var color1 = "rgba(0,20,60,0.09)"
var color2 = "rgba(0,255,255,0.1)"
} else {
level.setPosToSpawn(-350, 475);
level.exit.x = 14025
level.exit.y = -600
spawn.bodyRect(-225, 475, 50, 50);
var color1 = "rgba(0,255,255,0.1)"
var color2 = "rgba(0,20,60,0.09)"
}
spawn.mapRect(14015, -585, 120, 75); //exit/entrance platform
const buttonLeft = level.button(-4100, 991)
const buttonRight = level.button(4050, 991)
buttonLeft.isUp = true
// const buttonCamera = level.button(940, -1545)
// buttonRight.isUp = false
const boosts = []
boosts.push(level.boost(-3650, 990, 2700, 1.45))
boosts.push(level.boost(3325, 990, 1600, 1.4))
boosts.push(level.boost(7960, -1110, 1650, 2.3))
boosts.push(level.boost(13345, -460, 2070, 2.35))
const fizzlers = []
fizzlers.push(level.fizzler({ x: -135, y: 265 }, { x: -135, y: 535 }))
fizzlers.push(level.fizzler({ x: -3850, y: 650 }, { x: -3850, y: 1025 }))
fizzlers.push(level.fizzler({ x: 3875, y: 675 }, { x: 3875, y: 1025 }))
fizzlers.push(level.fizzler({ x: 13425, y: -1275 }, { x: 13425, y: -550 }))
const movers = []
const baseMoverSpeed = 15
movers.push(level.mover(-3550, 995, 6875, 150, -baseMoverSpeed))
movers.push(level.mover(225, -1190, 2450, 50, -baseMoverSpeed))
movers.push(level.mover(-3000, -1190, 3000, 50, baseMoverSpeed))
movers.push(level.mover(4000, -2025, 2000, 150, -23))
movers.push(level.mover(8000, -1125, 2000, 150, -23))
movers.push(level.mover(3775, -425, 1650, 150, 20))
movers.push(level.mover(5425, -425, 1925, 150, 40))
movers.push(level.mover(7350, -425, 6000, 150, 60))
function setMoverDirection(index, VxGoal, force) {
movers[index].VxGoal = VxGoal
movers[index].force = force
}
level.custom = () => {
// buttonCamera.query()
// if (!buttonCamera.isUp) {
// simulation.setCameraPosition(100, -1000, 0.29)
// //block spawner
// spawn.mapRect(0, -2375, 200, 100);
// if (!(simulation.cycle % 10) && !m.isTimeDilated && body.length < 200) {
// const where = { x: 112, y: -3800 }
// // simulation.drawList.push({ x: where.x + 100 * (Math.random() - 0.5), y: where.y + 100 * (Math.random() - 0.5), radius: 11, color: "rgba(0,160,255,0.5)", time: 10 });
// let makeBlock = function (where, size) {
// const sides = Math.floor(4 + 6 * Math.random() * Math.random())
// body[body.length] = Matter.Bodies.polygon(where.x, where.y, sides, size, {
// friction: 0.05,
// frictionAir: 0.001,
// collisionFilter: {
// category: cat.body,
// mask: cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
// },
// classType: "body",
// density: 0.001,
// });
// const who = body[body.length - 1]
// Composite.add(engine.world, who); //add to world
// }
// makeBlock({ x: where.x, y: where.y }, Math.floor(20 + 35 * Math.random() * Math.random()))
// }
// }
ctx.fillStyle = "#c8cccc"//background color is "#d0d5d5"
ctx.fillRect(-2150, 675, 500, 400);
ctx.fillRect(-1050, 675, 500, 400);
ctx.fillRect(750, 675, 500, 400);
ctx.fillRect(1850, 675, 500, 400);
ctx.fillRect(-2250, -2425, 700, 1325);
ctx.fillRect(-1150, -2400, 700, 1300);
ctx.fillRect(650, -2375, 700, 1325);
ctx.fillRect(1750, -2375, 700, 1350);
ctx.fillRect(8000, -2425, 2000, 2225);
ctx.fillRect(4000, -2375, 2000, 2100);
ctx.fillRect(11125, -2425, 1000, 2150)
level.exit.drawAndCheck();
level.enter.draw();
if (buttonRight.isUp) {
buttonRight.query();
if (!buttonRight.isUp) {
requestAnimationFrame(() => buttonLeft.isUp = true);
setMoverDirection(0, -baseMoverSpeed, -0.0005)
const list = Matter.Query.region(body, buttonLeft) //are any blocks colliding with this
if (list.length > 0) Matter.Body.setVelocity(list[0], { x: baseMoverSpeed, y: -20 });
}
} else if (buttonLeft.isUp) {
buttonLeft.query();
if (!buttonLeft.isUp) {
requestAnimationFrame(() => buttonRight.isUp = true);
setMoverDirection(0, 20, 0.0005)
const list = Matter.Query.region(body, buttonRight) //are any blocks colliding with this
if (list.length > 0) Matter.Body.setVelocity(list[0], { x: -15, y: -20 });
}
}
buttonRight.draw();
buttonLeft.draw();
for (let i = 0; i < movers.length; i++) movers[i].push();
for (let i = 0; i < boosts.length; i++) boosts[i].query();
};
level.customTopLayer = () => {
ctx.fillStyle = "rgba(0,255,255,0.1)" //"#d4f4f4" //exit
ctx.fillRect(3535, -1050, 500, 475);
for (let i = 0; i < fizzlers.length; i++) fizzlers[i].query();
ctx.fillStyle = color1 //exit
ctx.fillRect(13400, -1325, 1000, 825);
//shadows
ctx.fillStyle = "rgba(0,20,60,0.09)"
// ctx.fillRect(-4025, -1050, 1750, 2275);
ctx.fillStyle = color2
ctx.fillRect(-500, 225, 494, 350);
ctx.fillStyle = "rgba(0,5,10,0.06)"
ctx.beginPath();
ctx.moveTo(0, -1180)
ctx.lineTo(225, -1180)
ctx.lineTo(3220, 669)
ctx.lineTo(3180, 1010)
ctx.lineTo(-2960, 1010)
ctx.lineTo(-2995, 674)
ctx.fill()
ctx.beginPath();
//right button room
ctx.beginPath();
ctx.moveTo(3780, 720)
ctx.lineTo(4325, 720)
ctx.lineTo(4325, 1010)
ctx.lineTo(3810, 1010)
ctx.fill()
//left button room
ctx.beginPath();
ctx.moveTo(-3755, 675)
ctx.lineTo(-3785, 1010)
ctx.lineTo(-4250, 1010)
ctx.lineTo(-4250, 675)
ctx.fill()
ctx.fillStyle = "rgba(68, 68, 68,0.9)"
ctx.fillRect(-50, -4300, 325, 1950);
for (let i = 0; i < movers.length; i++) movers[i].draw();
};
//boxes center on zero,zero with deep walls to hide background
spawn.mapRect(4000, -2000, 2000, 4000); //right map wall
spawn.mapRect(-6000, -2000, 2000, 4000); //left map wall
spawn.mapRect(-6000, -4000, 12000, 3000); //map ceiling
spawn.mapRect(-6000, 1000, 12000, 3000); //floor
spawn.mapRect(-6000, -4300, 6020, 1950);
spawn.mapRect(205, -4300, 15120, 1950);
spawn.mapVertex(-250, 602.5, "-200 0 235 0 400 50 400 150 -200 150");
spawn.mapVertex(-3675, -2275, "0 0 500 0 0 500");
spawn.mapVertex(13275, -2275, "0 0 -500 0 0 500");
spawn.mapRect(-525, -1175, 525, 1450);
spawn.mapRect(225, -1175, 3000, 1850);
spawn.mapRect(-3000, -1175, 2525, 1850);
spawn.mapRect(-4350, -2500, 600, 3175);
spawn.mapRect(-6000, -2350, 1775, 3350);
spawn.mapVertex(-1900, 675, "-350 0 -250 100 250 100 350 0");
spawn.mapVertex(-800, 675, "-350 0 -250 100 250 100 350 0");
spawn.mapVertex(1000, 675, "-350 0 -250 100 250 100 350 0");
spawn.mapVertex(2100, 675, "-350 0 -250 100 250 100 350 0");
spawn.mapVertex(-1900, -1450, "-400 -40 -350 -90 350 -90 400 -40 400 40 350 90 -350 90 -400 40");
spawn.mapVertex(-800, -1450, "-400 -40 -350 -90 350 -90 400 -40 400 40 350 90 -350 90 -400 40");
spawn.mapVertex(1000, -1450, "-400 -40 -350 -90 350 -90 400 -40 400 40 350 90 -350 90 -400 40");
spawn.mapVertex(2100, -1450, "-400 -40 -350 -90 350 -90 400 -40 400 40 350 90 -350 90 -400 40");
spawn.mapVertex(-1900, -2350, "-450 0 -350 100 350 100 450 0");
spawn.mapVertex(-800, -2350, "-450 0 -350 100 350 100 450 0");
spawn.mapVertex(1000, -2350, "-450 0 -350 100 350 100 450 0");
spawn.mapVertex(2100, -2350, "-450 0 -350 100 350 100 450 0");
spawn.mapRect(-1500, 840, 300, 20);
spawn.mapRect(1400, 840, 300, 20);
//ramp to catch blocks
spawn.mapVertex(3001, -1260, "0 0 400 -200 550 -200 550 75 0 75");
spawn.mapVertex(4100, -1100, "-625 0 -600 -60 600 -60 625 0 600 60 -600 60");
spawn.mapVertex(5550, -750, "-625 0 -600 -60 600 -60 625 0 600 60 -600 60");
spawn.mapVertex(11625, -900, "-525 0 -500 -50 500 -50 525 0 500 50 -500 50");
//base for mover
spawn.mapVertex(5000, -1935, "-1050 0 -1000 -90 1000 -90 1050 0 1000 90 -1000 90");
spawn.mapVertex(9000, -1035, "-1050 0 -1000 -90 1000 -90 1050 0 1000 90 -1000 90");
spawn.mapVertex(5000, -2370, "-1200 0 -1000 100 1000 100 1200 0");
spawn.mapVertex(9000, -2310, "-1200 0 -1000 100 1000 100 1200 0");
spawn.mapVertex(11625, -2310, "-600 0 -500 100 500 100 600 0");
spawn.mapRect(3775, -400, 675, 1125);
spawn.mapRect(4300, -400, 11025, 4400);
//exit
spawn.mapRect(13400, -575, 1925, 300);
spawn.mapRect(14275, -2375, 1050, 2050);
spawn.mapRect(13400, -2375, 900, 1125);
// spawn.randomMob(2825, 75, 0.9);
// spawn.randomLevelBoss(2400, 600);
// spawn.secondaryBossChance(800, -300)
// powerUps.spawnStartingPowerUps(600, 375);
// powerUps.addResearchToLevel() //needs to run after mobs are spawned
//blocks on movers
spawn.bodyRect(-200, 950, 50, 50);
spawn.bodyRect(-1100, 925, 65, 75);
spawn.bodyRect(-2275, 975, 70, 25);
spawn.bodyRect(-3325, 925, 75, 75);
spawn.bodyRect(-2950, -1225, 90, 25);
spawn.bodyRect(-1425, -1275, 45, 75);
spawn.bodyRect(600, -1275, 70, 75);
spawn.bodyRect(1900, -1225, 90, 50);
spawn.bodyRect(4250, -2100, 115, 50);
spawn.bodyRect(2175, 900, 100, 65);
spawn.bodyRect(4075, -450, 75, 20);
spawn.bodyRect(8350, -1175, 90, 50);
spawn.bodyRect(6525, -525, 70, 100);
spawn.bodyRect(12025, -475, 130, 50);
spawn.bodyRect(625, 950, 55, 45);
spawn.bodyRect(6250, -450, 55, 25);
spawn.bodyRect(3950, -475, 46, 53);
//other blocks
spawn.bodyRect(3525, -1300, 100, 125, 0.6);
spawn.bodyRect(11550, -1150, 100, 200, 0.4);
spawn.randomMob(-1775, -1650, 0);
spawn.randomMob(950, -1775, 0);
spawn.randomMob(1550, 775, 0);
spawn.randomMob(4500, -1250, 0);
spawn.randomMob(11400, -1300, 0);
spawn.randomMob(-800, -1675, 0);
spawn.randomMob(-1325, 775, 0.1);
spawn.randomMob(2050, -1625, 0.1);
spawn.randomMob(3100, -1475, 0.2);
spawn.randomMob(5400, -900, 0.2);
spawn.randomMob(11950, -1025, 0.3);
spawn.randomMob(-925, -1700, 0.3);
spawn.randomMob(2025, -1725, 0.4);
spawn.randomMob(1575, 775, 0.4);
spawn.randomMob(-1350, 775, 0.6);
spawn.randomMob(11925, -1275, 0.6);
spawn.randomMob(4325, -1425, 0.6);
spawn.randomMob(5425, -950, 0.6);
spawn.randomMob(3575, 375, 0.6);
spawn.randomGroup(5300, -1400, 1.3);
spawn.randomLevelBoss(2025, -1825);
spawn.secondaryBossChance(-1900, -1800);
powerUps.spawnStartingPowerUps(11750, -1000);
powerUps.addResearchToLevel() //needs to run after mobs are spawned
},
lock() {
level.announceMobTypes()
@@ -8930,9 +9213,9 @@ const level = {
simulation.zoomTransition(level.defaultZoom)
powerUps.spawnStartingPowerUps(4900, -500); //1 per level
spawn.debris(1000, 20, 1800, 3); //16 debris per level //but less here because a few mobs die from laser
spawn.debris(4830, -1330, 850, 3); //16 debris per level
spawn.debris(3035, -3900, 1500, 3); //16 debris per level
spawn.debris(1000, 20, 1800, 6); //16 debris per level
// spawn.debris(4830, -1330, 850, 3); //16 debris per level
// spawn.debris(3035, -3900, 1500, 3); //16 debris per level
document.body.style.backgroundColor = "#dbdcde";
@@ -8998,6 +9281,11 @@ const level = {
spawn.mapRect(4100, -3450, 100, 850); //left top shelf
spawn.mapRect(4600, -3450, 100, 1850);
//steps up and down
spawn.mapVertex(4525, 250, "-650 0 -625 -20 625 -20 650 0");
spawn.mapVertex(4525, 237, "-550 0 -525 -20 525 -20 550 0");
// spawn.mapVertex(4525, 225, "-400 0 -375 -20 375 -20 400 0");
spawn.randomSmallMob(4400, -3500);
spawn.randomSmallMob(4800, -800);
spawn.randomMob(800, -2600);
@@ -36987,6 +37275,19 @@ const level = {
level.enter.draw();
level.exit.drawAndCheck();
//check if blocks are in the exit zone and destroy them
for (let i = 0; i < body.length; i++) {
if (body[i].position.x > 1675) {
Matter.Composite.remove(engine.world, body[i]);
body.splice(i, 1);
break
}
}
//if no blocks left make a new one
if (body.length < 2) { //< 2 because the door is a body
spawn.bodyRect(1025, -550, 50, 50);
}
};
level.customTopLayer = () => {
buttonDoor.query();
@@ -37076,6 +37377,18 @@ const level = {
//exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -400, 400, 400)
//check if blocks are in the exit zone and destroy them
for (let i = 0; i < body.length; i++) {
if (body[i].position.x > 1675 && body[i].position.y > -350) {
Matter.Composite.remove(engine.world, body[i]);
body.splice(i, 1);
break
}
}
//if no blocks left make a new one
if (body.length < 2) { //< 2 because the door is a body
spawn.bodyRect(1025, -550, 50, 50);
}
};
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall
@@ -37136,6 +37449,19 @@ const level = {
//exit room glow
ctx.fillStyle = "rgba(0,255,255,0.05)"
ctx.fillRect(1600, -400, 400, 400)
//check if blocks are in the exit zone and destroy them
for (let i = 0; i < body.length; i++) {
if (body[i].position.x > 1675 && body[i].position.y > -350) {
Matter.Composite.remove(engine.world, body[i]);
body.splice(i, 1);
break
}
}
//if no blocks left make a new one
if (body.length < 2) { //< 2 because the door is a body
spawn.bodyRect(1025, -550, 50, 50);
}
};
spawn.mapRect(-2750, -2800, 2600, 4600); //left wall