map: factory
  this is completely unbalanced, so let me know if what rough edges need to be sanded
  found on seed 47086 level 6

tech: ternary - +40 damage if any gun has ammo divisible by 3

level element: transport - horizontal moving platforms
level element: mover - stationary platform that pushes the player horizontally
  to see examples of transport and mover look in level.testing()
This commit is contained in:
landgreen
2023-03-04 09:37:11 -08:00
parent f9849d4222
commit d00a94a22b
10 changed files with 487 additions and 269 deletions

BIN
img/ternary.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -84,6 +84,7 @@
<datalist id="ban-suggest"> <datalist id="ban-suggest">
<option value="testChamber"> <option value="testChamber">
<option value="lock"> <option value="lock">
<option value="factory">
<option value="sewers"> <option value="sewers">
<option value="satellite"> <option value="satellite">
<option value="aerie"> <option value="aerie">

View File

@@ -3751,7 +3751,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);
Matter.Body.setDensity(bullet[me], 0.0008 + 0.0005 * tech.isSuperHarm); Matter.Body.setDensity(bullet[me], 0.0008 + 0.0006 * tech.isSuperHarm);
bullet[me].endCycle = simulation.cycle + Math.floor(300 + 90 * Math.random()); bullet[me].endCycle = simulation.cycle + Math.floor(300 + 90 * Math.random());
bullet[me].minDmgSpeed = 0; bullet[me].minDmgSpeed = 0;
bullet[me].restitution = 1; bullet[me].restitution = 1;

View File

@@ -9,7 +9,7 @@ const level = {
levelsCleared: 0, levelsCleared: 0,
// playableLevels: ["pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion"], // playableLevels: ["pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion", "pavilion"],
//see level.populateLevels: (intro, ... , reservoir, reactor, ... , gauntlet, final) added later //see level.populateLevels: (intro, ... , reservoir, reactor, ... , gauntlet, final) added later
playableLevels: ["labs", "rooftops", "skyscrapers", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber", "pavilion", "lock"], playableLevels: ["labs", "rooftops", "skyscrapers", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber", "pavilion", "lock", "factory"],
communityLevels: ["stronghold", "basement", "crossfire", "vats", "run", "n-gon", "house", "perplex", "coliseum", "tunnel", "islands", "temple", "dripp", "biohazard", "stereoMadness", "yingYang", "staircase", "fortress"], communityLevels: ["stronghold", "basement", "crossfire", "vats", "run", "n-gon", "house", "perplex", "coliseum", "tunnel", "islands", "temple", "dripp", "biohazard", "stereoMadness", "yingYang", "staircase", "fortress"],
trainingLevels: ["walk", "crouch", "jump", "hold", "throw", "throwAt", "deflect", "heal", "fire", "nailGun", "shotGun", "superBall", "matterWave", "missile", "stack", "mine", "grenades", "harpoon"], trainingLevels: ["walk", "crouch", "jump", "hold", "throw", "throwAt", "deflect", "heal", "fire", "nailGun", "shotGun", "superBall", "matterWave", "missile", "stack", "mine", "grenades", "harpoon"],
levels: [], levels: [],
@@ -30,11 +30,11 @@ const level = {
// m.setField("metamaterial cloaking") //molecular assembler standing wave time dilation perfect diamagnetism metamaterial cloaking wormhole negative mass pilot wave plasma torch // m.setField("metamaterial cloaking") //molecular assembler standing wave time dilation perfect diamagnetism metamaterial cloaking wormhole negative mass pilot wave plasma torch
// 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("nail gun") //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("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.guns[8].ammo = 10000 // b.guns[8].ammo = 10000
// tech.giveTech("aperture") // tech.giveTech("inductive charging")
// tech.giveTech("rebound") // tech.giveTech("laser-bot")
// for (let i = 0; i < 1; ++i) tech.giveTech("mass-energy equivalence") // for (let i = 0; i < 1; ++i) tech.giveTech("mass-energy equivalence")
// for (let i = 0; i < 1; ++i) tech.giveTech("Zectron") // for (let i = 0; i < 1; ++i) tech.giveTech("Zectron")
// for (let i = 0; i < 1; i++) tech.giveTech("CPT symmetry") // for (let i = 0; i < 1; i++) tech.giveTech("CPT symmetry")
@@ -43,6 +43,7 @@ const level = {
// for (let i = 0; i < 10; i++) powerUps.directSpawn(1750, -500, "boost"); // for (let i = 0; i < 10; i++) powerUps.directSpawn(1750, -500, "boost");
// for (let i = 0; i < 10; i++) powerUps.directSpawn(1750, -500, "coupling"); // for (let i = 0; i < 10; i++) powerUps.directSpawn(1750, -500, "coupling");
// level.factory(); // level.factory();
// level.testing();
// spawn.nodeGroup(1200, 0, "starter") // spawn.nodeGroup(1200, 0, "starter")
// spawn.mantisBoss(1900, -500) // spawn.mantisBoss(1900, -500)
// spawn.sneakBoss(1900, -500) // spawn.sneakBoss(1900, -500)
@@ -1593,7 +1594,7 @@ const level = {
} }
const stoppingFriction = 0.5 const stoppingFriction = 0.5
Matter.Body.setVelocity(who, { x: this.VxGoal * (1 - stoppingFriction) + who.velocity.x * stoppingFriction, y: who.velocity.y }); Matter.Body.setVelocity(who, { x: this.VxGoal * (1 - stoppingFriction) + who.velocity.x * stoppingFriction, y: who.velocity.y });
Matter.Body.setAngularVelocity(who, who.angularVelocity * 0.8) Matter.Body.setAngularVelocity(who, who.angularVelocity * 0.9)
} }
} }
const blocks = Matter.Query.collides(this, body) const blocks = Matter.Query.collides(this, body)
@@ -1602,6 +1603,14 @@ const level = {
pushBlock(blocks[i].bodyB) pushBlock(blocks[i].bodyB)
} }
const mobTargets = Matter.Query.collides(this, mob)
for (let i = 0; i < mobTargets.length; i++) {
pushBlock(mobTargets[i].bodyA)
pushBlock(mobTargets[i].bodyB)
}
let pushPowerUp = (who) => { let pushPowerUp = (who) => {
if (!who.isMover) { if (!who.isMover) {
if ((this.VxGoal > 0 && who.velocity.x < this.VxGoal) || (this.VxGoal < 0 && who.velocity.x > this.VxGoal)) { if ((this.VxGoal > 0 && who.velocity.x < this.VxGoal) || (this.VxGoal < 0 && who.velocity.x > this.VxGoal)) {
@@ -1635,6 +1644,79 @@ const level = {
Matter.Body.setStatic(rect, true); //make static Matter.Body.setStatic(rect, true); //make static
return rect return rect
}, },
transport(x, y, width, height, VxGoal = -6, force = VxGoal > 0 ? 0.0005 : -0.0005) {
//horizontal moving platform
//VxGoal below 3 don't move well, maybe try adjusting the force
x = x + width / 2
y = y + height / 2
const rect = body[body.length] = Bodies.rectangle(x, y, width, height, {
collisionFilter: {
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
},
isNoSetCollision: true,
inertia: Infinity, //prevents rotation
isNotHoldable: true,
friction: 0,
frictionStatic: 0,
restitution: 0,
isClosing: false,
isMover: true,
VxGoal: VxGoal,
force: force,
changeDirection(isRight) {
if (isRight) {
this.VxGoal = Math.abs(this.VxGoal)
this.force = Math.abs(this.force)
if (Matter.Query.collides(this, [jumpSensor]).length) player.force.x += 12 * Math.abs(this.VxGoal) * this.force * player.mass
} else {
this.VxGoal = -Math.abs(this.VxGoal)
this.force = -Math.abs(this.force)
if (Matter.Query.collides(this, [jumpSensor]).length) player.force.x += 12 * Math.abs(this.VxGoal) * this.force * player.mass
}
},
move() {
if (!m.isBodiesAsleep) {
Matter.Body.setPosition(this, { x: this.position.x + this.VxGoal, y: this.position.y }); //horizontal movement
const touchingPlayer = Matter.Query.collides(this, [jumpSensor])
if (touchingPlayer.length) {
m.moverX = this.VxGoal
if ((this.VxGoal > 0 && player.velocity.x < this.VxGoal) || (this.VxGoal < 0 && player.velocity.x > this.VxGoal)) {
player.force.x += this.force * player.mass
}
m.Vx = player.velocity.x - this.VxGoal
}
let pushBlock = (who) => {
if (!who.isMover) {
if ((this.VxGoal > 0 && who.velocity.x < this.VxGoal) || (this.VxGoal < 0 && who.velocity.x > this.VxGoal)) {
who.force.x += this.force * who.mass
}
const stoppingFriction = 0.5
Matter.Body.setVelocity(who, { x: this.VxGoal * (1 - stoppingFriction) + who.velocity.x * stoppingFriction, y: who.velocity.y });
Matter.Body.setAngularVelocity(who, who.angularVelocity * 0.8)
}
}
const blocks = Matter.Query.collides(this, body)
for (let i = 0; i < blocks.length; i++) {
pushBlock(blocks[i].bodyA)
pushBlock(blocks[i].bodyB)
}
}
},
draw() {
ctx.beginPath();
const v = this.vertices;
ctx.moveTo(v[0].x, v[0].y);
for (let i = 1; i < v.length; ++i) ctx.lineTo(v[i].x, v[i].y);
ctx.lineTo(v[0].x, v[0].y);
ctx.fillStyle = "#586370"
ctx.fill();
}
});
Matter.Body.setStatic(rect, true); //make static
return rect
},
chain(x, y, angle = 0, isAttached = true, len = 15, radius = 20, stiffness = 1, damping = 1) { chain(x, y, angle = 0, isAttached = true, len = 15, radius = 20, stiffness = 1, damping = 1) {
const gap = 2 * radius const gap = 2 * radius
const unit = { const unit = {
@@ -2350,38 +2432,44 @@ const level = {
} }
//map elements go here //map elements go here
//box around portals //box around portals
spawn.mapRect(x + -50, y + -2700, 150, 100); spawn.mapRect(x + -50, y + -2700, 150, 110);
spawn.mapRect(x + -50, y + -2450, 150, 25); spawn.mapRect(x + -50, y + -2440, 150, 25);
spawn.mapRect(x + 1900, y + -2725, 150, 550); spawn.mapRect(x + 1900, y + -2715, 150, 550);
spawn.mapRect(x + 1900, y + -2025, 150, 50); spawn.mapRect(x + 1900, y + -2015, 150, 50);
spawn.mapRect(x + 1900, y + -1125, 150, 150); spawn.mapRect(x + 1900, y + -1115, 150, 150);
spawn.mapRect(x + 1900, y + -825, 150, 50); spawn.mapRect(x + 1900, y + -815, 150, 50);
spawn.mapRect(x + -50, y + -350, 150, 50); spawn.mapRect(x + -50, y + -340, 150, 50);
spawn.mapRect(x + -50, y + -650, 150, 150); // spawn.mapRect(x + -50, y + -640, 150, 150);
spawn.mapRect(x + 1975, y - 1025, 50, 225); spawn.mapRect(x + 1975, y - 1015, 50, 225);
spawn.mapRect(x + 1975, y - 2200, 50, 200); spawn.mapRect(x + 1975, y - 2190, 50, 200);
spawn.mapRect(x + -25, y - 2625, 50, 200); spawn.mapRect(x + -25, y - 2615, 50, 200);
spawn.mapRect(x + -25, y - 525, 75, 200); spawn.mapRect(x + -25, y - 515, 75, 200);
const rampSpeed = 4 + Math.floor(9 * Math.random()) //ledge to get to upper left door
// spawn.mapRect(x + -50, y - 1400, 100, 25);
spawn.mapRect(x + -25, y - 1075, 250, 25);
spawn.mapRect(x + -50, y - 1075, 150, 590);
const rampSpeed = 8 //+ Math.floor(4 * Math.random())
const mover4 = level.mover(x, y + -2425, 1000, 50, rampSpeed) const mover4 = level.mover(x, y + -2425, 1000, 50, rampSpeed)
const mover3 = level.mover(x + 1000, y + -2000, 1000, 50, rampSpeed) const mover3 = level.mover(x + 1000, y + -2000, 1000, 50, rampSpeed)
const mover2 = level.mover(x + 1000, y + -800, 1000, 50, -rampSpeed) const mover2 = level.mover(x + 1000, y + -800, 1000, 50, -rampSpeed)
const mover1 = level.mover(x, y + -325, 1000, 50, -rampSpeed) const mover1 = level.mover(x, y + -325, 1000, 50, -rampSpeed)
const portal1 = level.portal({ const portal1 = level.portal({
x: x + 125, x: x + 125,
y: y - 425 y: y - 415
}, 2 * Math.PI, { //right }, 2 * Math.PI, { //right
x: x + 125, x: x + 125,
y: y - 2525 y: y - 2515
}, 2 * Math.PI) //right }, 2 * Math.PI) //right
const portal2 = level.portal({ const portal2 = level.portal({
x: x + 1875, x: x + 1875,
y: y - 900 y: y - 890
}, Math.PI, { //left }, Math.PI, { //left
x: x + 1875, x: x + 1875,
y: y - 2100 y: y - 2090
}, Math.PI) //left }, Math.PI) //left
doCustom.push(() => { doCustom.push(() => {
@@ -2442,183 +2530,6 @@ const level = {
} }
) )
}, },
// (x = offset.x, y = offset.y) => {
// // spawn.mapVertex(x + 5, y + -1318, "0 0 0 -250 125 -250"); //left ledges
// // spawn.mapVertex(x + 1995, y + -1318, "0 0 0 -250 -125 -250"); // right ledges
// let r = 150
// const hexagon = `${r} 0 ${r*Math.cos(5.236)} ${r*Math.sin(5.236)} ${r*Math.cos(4.189)} ${r*Math.sin(4.189)} ${-r} 0 ${r*Math.cos(2.0944)} ${r*Math.sin(2.0944)} ${r*Math.cos(1.0472)} ${r*Math.sin(1.0472)} `
// //450 horizontal spread // -130-130-130 = 390 vertical
// let xOff = 100 + 225
// spawn.mapVertex(x + xOff + 0 * 450, y + -260 - 0 * 390, hexagon);
// spawn.mapVertex(x + xOff + 1 * 450, y + -260 - 0 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -260 - 0 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -260 - 0 * 390, hexagon);
// xOff = 100
// // spawn.mapVertex(x + xOff + 0 * 450, y + 1 * -260 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 1 * 450, y + -260 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -260 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -260 - 1 * 390, hexagon);
// // spawn.mapVertex(x + xOff + 4 * 450, y + 1 * -260 - 1 * 390, hexagon);
// xOff = 100 + 225
// spawn.mapVertex(x + xOff + 0 * 450, y + -260 - 2 * 390, hexagon);
// spawn.mapVertex(x + xOff + 1 * 450, y + -260 - 2 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -260 - 2 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -260 - 2 * 390, hexagon);
// xOff = 100
// // spawn.mapVertex(x + xOff + 0 * 450, y + 1 * -260 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 1 * 450, y + -260 - 3 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -260 - 3 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -260 - 3 * 390, hexagon);
// // spawn.mapVertex(x + xOff + 4 * 450, y + 1 * -260 - 1 * 390, hexagon);
// xOff = 100 + 225
// spawn.mapVertex(x + xOff + 0 * 450, y + -260 - 4 * 390, hexagon);
// spawn.mapVertex(x + xOff + 1 * 450, y + -260 - 4 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -260 - 4 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -260 - 4 * 390, hexagon);
// //phase 2
// xOff = 100
// spawn.mapVertex(x + xOff + 1 * 450, y + -130 - 0 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -130 - 0 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -130 - 0 * 390, hexagon);
// xOff = 100 + 225
// spawn.mapVertex(x + xOff + 0 * 450, y + -130 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 1 * 450, y + -130 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -130 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -130 - 1 * 390, hexagon);
// spawn.mapVertex(x + xOff + 4 * 450, y + -130 - 1 * 390, hexagon);
// xOff = 100
// spawn.mapVertex(x + xOff + 1 * 450, y + -130 - 2 * 390, hexagon);
// spawn.mapVertex(x + xOff + 2 * 450, y + -130 - 2 * 390, hexagon);
// spawn.mapVertex(x + xOff + 3 * 450, y + -130 - 2 * 390, hexagon);
// // spawn.mapVertex(x + 550, y + 1 * -260, hexagon);
// // spawn.mapVertex(x + 550, y + 2 * -260, hexagon);
// // spawn.mapVertex(x + 550, y + 3 * -260, hexagon);
// // spawn.mapVertex(x + 550, y + 5 * -260, hexagon);
// // spawn.mapVertex(x + 550, y + 4 * -260, hexagon);
// // spawn.mapVertex(x + 775, y + -260, hexagon);
// // spawn.mapVertex(x + 1225, y + -260, hexagon);
// // spawn.mapVertex(x + 550, y + -650, hexagon);
// // spawn.mapVertex(x + 1000, y + -650, hexagon);
// // spawn.mapVertex(x + 1450, y + -650, hexagon);
// // spawn.mapVertex(x + 775, y + -1040, hexagon);
// // spawn.mapVertex(x + 1225, y + -1040, hexagon);
// // spawn.mapVertex(x + 550, y + -1430, hexagon);
// // spawn.mapVertex(x + 1000, y + -1430, hexagon);
// // spawn.mapVertex(x + 1450, y + -1430, hexagon);
// // spawn.mapVertex(x + 775, y + -1820, hexagon);
// // spawn.mapVertex(x + 1225, y + -1820, hexagon);
// let count = 0
// doCustomTopLayer.push(
// () => {
// if (!(count % 60)) {
// addMapToLevelInProgress = (who) => { //adds new map elements to the level while the level is already running //don't forget to run simulation.draw.setPaths() after you all the the elements so they show up visually
// who.collisionFilter.category = cat.map;
// who.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
// Matter.Body.setStatic(who, true); //make static
// Composite.add(engine.world, who); //add to world
// }
// const numberOfMapElementsAdded = 0
// for (let i = 0; i < numberOfMapElementsAdded; i++) addMapToLevelInProgress(map[map.length - 1 - i])
// simulation.draw.setPaths() //update map graphics
// }
// })
// spawn.randomMob(x + 225, y + -1025, mobSpawnChance);
// spawn.randomMob(x + 200, y + -675, mobSpawnChance);
// spawn.randomMob(x + 225, y + -200, mobSpawnChance);
// spawn.randomMob(x + 1750, y + -1075, mobSpawnChance);
// spawn.randomMob(x + 1700, y + -650, mobSpawnChance);
// spawn.randomMob(x + 1675, y + -175, mobSpawnChance);
// spawn.randomGroup(x + 300, y + -2200);
// spawn.randomGroup(x + 1625, y + -2200);
// spawn.randomLevelBoss(x + 950, y + -2200);
// },
// (x = offset.x, y = offset.y) => { //hopBoss1
// const button = level.button(x + 935, y + 0)
// button.isUp = true
// // spawn.mapVertex(x + 5, y + -1318, "0 0 0 -250 125 -250"); //left ledges
// // spawn.mapVertex(x + 1995, y + -1318, "0 0 0 -250 -125 -250"); // right ledges
// doCustomTopLayer.push(
// () => {
// button.draw();
// if (button.isUp) {
// button.query();
// if (!button.isUp) {
// // doCustomTopLayer.push(() => {
// // ctx.fillStyle = "rgba(150,255,220,0.15)"
// // ctx.fillRect(x + 250, y + -2725, 625, 725)
// // })
// const mapStartingLength = map.length //track this so you know how many you added when running addMapToLevelInProgress
// addMapToLevelInProgress = (who) => { //adds new map elements to the level while the level is already running //don't forget to run simulation.draw.setPaths() after you all the the elements so they show up visually
// who.collisionFilter.category = cat.map;
// who.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet;
// Matter.Body.setStatic(who, true); //make static
// Composite.add(engine.world, who); //add to world
// }
// //map elements go here
// // spawn.mapRect(x + -50, y + -1875, 875, 200);
// // spawn.mapRect(x + 650, y + -2700, 125, 625);
// // spawn.mapRect(x + 1200, y + -2250, 250, 25);
// spawn.mapRect(x + -25, y + -1875, 1250, 200);
// // spawn.mapRect(x + 1075, y + -2700, 100, 650);
// spawn.mapRect(x + 1325, y + -1875, 475, 200);
// // spawn.mapRect(x + 1900, y + -1600, 125, 25);
// // spawn.mapRect(x + 900, y + -1875, 325, 25);
// // spawn.mapRect(x + 1375, y + -1875, 350, 25);
// // spawn.mapRect(x + 675, y + -2725, 50, 650);
// spawn.mapRect(x + 1900, y + -1675, 125, 25);
// spawn.mapRect(x + 1700, y + -1400, 325, 25);
// spawn.mapRect(x + -50, y + -1400, 325, 25);
// spawn.mapRect(x + -25, y + -700, 500, 25);
// spawn.mapRect(x + 675, y + -700, 600, 25);
// spawn.mapRect(x + 1475, y + -700, 500, 25);
// spawn.mapRect(x + 475, y + -1025, 200, 25);
// spawn.mapRect(x + 1275, y + -1025, 200, 25);
// spawn.mapRect(x + 475, y + -300, 200, 25);
// spawn.mapRect(x + 1275, y + -300, 200, 25);
// for (let i = 0, numberOfMapElementsAdded = map.length - mapStartingLength; i < numberOfMapElementsAdded; i++) addMapToLevelInProgress(map[map.length - 1 - i])
// simulation.draw.setPaths() //update map graphics
// //mobs go here
// powerUps.directSpawn(x + 50, y - 1525, "ammo");
// powerUps.directSpawn(x + 1950, y - 1525, "ammo");
// spawn.hopMomBoss(x + 550, y + -2325)
// for (let i = 0; i < 20; ++i) spawn.hopBullet(x + 50 + 1900 * Math.random(), y + -2325)
// // spawn.hopper(x + 1500, y + -775);
// // spawn.hopper(x + 525, y + -775);
// }
// }
// }
// )
// },
(x = offset.x, y = offset.y) => { //hopBoss2 (x = offset.x, y = offset.y) => { //hopBoss2
const button = level.button(x + 935, y + 0) const button = level.button(x + 935, y + 0)
button.isUp = true button.isUp = true
@@ -2658,11 +2569,16 @@ const level = {
//mobs go here //mobs go here
powerUps.directSpawn(x + 50, y - 1525, "ammo"); powerUps.directSpawn(x + 50, y - 1525, "ammo");
powerUps.directSpawn(x + 1950, y - 1525, "ammo"); powerUps.directSpawn(x + 1950, y - 1525, "ammo");
powerUps.directSpawn(x + 1900, y - 1525, "ammo");
spawn.hopMomBoss(x + 800, y + -2200) spawn.hopMomBoss(x + 800, y + -2200)
for (let i = 0; i < 10; ++i) spawn.hopBullet(x + 150 + 750 * Math.random(), y + -1600) for (let i = 0; i < 6; ++i) spawn.hopBullet(x + 150 + 750 * Math.random(), y + -1600)
for (let i = 0; i < 10; ++i) spawn.hopBullet(x + 1100 + 750 * Math.random(), y + -1600) for (let i = 0; i < 6; ++i) spawn.hopBullet(x + 1100 + 750 * Math.random(), y + -1600)
spawn.hopper(x + 1500, y + -775); spawn.hopper(x + 1550, y + -775);
spawn.hopper(x + 525, y + -775); spawn.hopper(x + 500, y + -775);
spawn.hopper(x + 1400, y + -775);
spawn.hopper(x + 550, y + -775);
spawn.hopper(x + 525, y + -1475);
spawn.hopper(x + 1550, y + -1500);
} }
} }
} }
@@ -2740,10 +2656,12 @@ const level = {
for (let i = 0; i < numberOfMapElementsAdded; i++) addMapToLevelInProgress(map[map.length - 1 - i]) for (let i = 0; i < numberOfMapElementsAdded; i++) addMapToLevelInProgress(map[map.length - 1 - i])
spawn.randomMob(x + 225, y + -1025, mobSpawnChance); spawn.randomMob(x + 225, y + -1025, mobSpawnChance);
spawn.randomMob(x + 250, y + -1025, mobSpawnChance);
spawn.randomMob(x + 200, y + -675, mobSpawnChance); spawn.randomMob(x + 200, y + -675, mobSpawnChance);
spawn.randomMob(x + 225, y + -200, mobSpawnChance); spawn.randomMob(x + 225, y + -200, mobSpawnChance);
spawn.randomMob(x + 1750, y + -1075, mobSpawnChance); spawn.randomMob(x + 1750, y + -1075, mobSpawnChance);
spawn.randomMob(x + 1700, y + -650, mobSpawnChance); spawn.randomMob(x + 1700, y + -650, mobSpawnChance);
spawn.randomMob(x + 1725, y + -650, mobSpawnChance);
spawn.randomMob(x + 1675, y + -175, mobSpawnChance); spawn.randomMob(x + 1675, y + -175, mobSpawnChance);
} }
simulation.draw.setPaths() //update map graphics simulation.draw.setPaths() //update map graphics
@@ -2814,15 +2732,18 @@ const level = {
const numberOfMapElementsAdded = 11 const numberOfMapElementsAdded = 11
for (let i = 0; i < numberOfMapElementsAdded; i++) addMapToLevelInProgress(map[map.length - 1 - i]) for (let i = 0; i < numberOfMapElementsAdded; i++) addMapToLevelInProgress(map[map.length - 1 - i])
spawn.randomMob(x + 1050, y + -1500, mobSpawnChance);
spawn.randomMob(x + 1075, y + -1500, mobSpawnChance); spawn.randomMob(x + 1075, y + -1500, mobSpawnChance);
spawn.randomMob(x + 325, y + -550, mobSpawnChance); spawn.randomMob(x + 325, y + -550, mobSpawnChance);
spawn.randomMob(x + 800, y + -925, mobSpawnChance); spawn.randomMob(x + 800, y + -925, mobSpawnChance);
spawn.randomMob(x + 1400, y + -1250, mobSpawnChance); spawn.randomMob(x + 1400, y + -1250, mobSpawnChance);
spawn.randomMob(x + 1325, y + -1725, mobSpawnChance);
spawn.randomMob(x + 1350, y + -1725, mobSpawnChance); spawn.randomMob(x + 1350, y + -1725, mobSpawnChance);
spawn.randomMob(x + 575, y + -1375, mobSpawnChance); spawn.randomMob(x + 575, y + -1375, mobSpawnChance);
spawn.randomMob(x + 225, y + -2275, mobSpawnChance); spawn.randomMob(x + 225, y + -2275, mobSpawnChance);
spawn.randomMob(x + 875, y + -2450, mobSpawnChance); spawn.randomMob(x + 875, y + -2450, mobSpawnChance);
spawn.randomMob(x + 1550, y + -2525, mobSpawnChance); spawn.randomMob(x + 1550, y + -2525, mobSpawnChance);
spawn.randomMob(x + 1525, y + -2525, mobSpawnChance);
spawn.randomLevelBoss(x + 1075, y + -1500); spawn.randomLevelBoss(x + 1075, y + -1500);
spawn.secondaryBossChance(x + 1200, y + -1000) spawn.secondaryBossChance(x + 1200, y + -1000)
simulation.draw.setPaths() //update map graphics simulation.draw.setPaths() //update map graphics
@@ -3087,18 +3008,23 @@ const level = {
}, },
testing() { testing() {
const mover = level.mover(800, -300, 3000, 25); //x,y,width.height,VxGoal,force
const mover = level.mover(800, -300, 3000, 25); //x,y,width.height,goal,force const train = level.transport(600, -500, 500, 25, 8); //x,y,width.height,VxGoal,force
spawn.bodyRect(600, -475, 50, 50); spawn.bodyRect(1900, -550, 50, 50);
const button = level.button(350, -400)
spawn.bodyRect(250, -450, 50, 50); //block on button
// const hazard = level.hazard(6000, -1000, 5, 1000, 0.4) //laser
const button = level.button(1000, 0)
spawn.bodyRect(1000, -50, 50, 50);
level.custom = () => { level.custom = () => {
//oscillate back and forth
if (train.position.x < 800) {
train.changeDirection(true) //go right
} else if (train.position.x > 2000) {
train.changeDirection(false) //go left
}
if (!button.isUp) train.move();
mover.push(); mover.push();
ctx.fillStyle = "#d4d4d4" ctx.fillStyle = "#d4d4d4"
ctx.fillRect(2500, -475, 200, 300) ctx.fillRect(2500, -475, 200, 300)
@@ -3109,6 +3035,7 @@ const level = {
level.enter.draw(); level.enter.draw();
}; };
level.customTopLayer = () => { level.customTopLayer = () => {
train.draw()
mover.draw(); mover.draw();
// hazard.opticalQuery(); // hazard.opticalQuery();
button.query(); button.query();
@@ -3311,7 +3238,7 @@ const level = {
} else if (!isFightOver && !(simulation.cycle % 180)) { } else if (!isFightOver && !(simulation.cycle % 180)) {
let isFoundBoss = false let isFoundBoss = false
for (let i = 0; i < mob.length; i++) { for (let i = 0; i < mob.length; i++) {
if (mob[i].isBoss) { if (mob[i].isReactorBoss) {
isFoundBoss = true isFoundBoss = true
break break
} }
@@ -3459,34 +3386,269 @@ const level = {
powerUps.addResearchToLevel() //needs to run after mobs are spawned powerUps.addResearchToLevel() //needs to run after mobs are spawned
}, },
factory() { factory() {
simulation.enableConstructMode() // simulation.enableConstructMode() //remove this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
level.setPosToSpawn(0, -50); //normal spawn // level.difficultyIncrease(10 * 4) //30 is near max on hard //60 is near max on why
level.setPosToSpawn(2235, -1375); //normal spawn
spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20); //bump for level entrance spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20); //bump for level entrance
level.exit.x = 1500; level.exit.x = 5150;
level.exit.y = -1875; level.exit.y = -2705;
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20); //bump for level exit spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20); //bump for level exit
level.defaultZoom = 1800 level.defaultZoom = 1800
simulation.zoomTransition(level.defaultZoom) simulation.zoomTransition(level.defaultZoom)
document.body.style.backgroundColor = "#d8dadf"; document.body.style.backgroundColor = "#d8d9dc";
color.map = "#222629" color.map = "#262a2f"
let isPowerLeft = true
const movers = []
const moveSpeed = -5
movers.push(level.mover(125, -140, 925, 35, moveSpeed))
movers.push(level.mover(1100, -437, 1100, 35, moveSpeed))
movers.push(level.mover(2000, -600, 850, 35, moveSpeed))
const moveSpeedStopGo = 7
movers.push(level.mover(2700, -200, 3600, 35, 0))
const leftMoverSpeed = 6
movers.push(level.mover(6750, -450, 425, 350, leftMoverSpeed))
movers.push(level.mover(7675, -725, 500, 410, -leftMoverSpeed))
movers.push(level.mover(6750, -1075, 425, 50, -leftMoverSpeed))
movers.push(level.mover(5525, -1075, 450, 50, leftMoverSpeed))
movers.push(level.mover(7175, -215, 2275, 50, 3))
const trains = []
trains.push(level.transport(6275, -2100, 600, 50, 8 + simulation.difficultyMode))
trains.push(level.transport(6275, -2425, 600, 50, -8 - simulation.difficultyMode))
const lasers = []
const laserX = 3317 //3882 - 1130 / 2
const laserGap = 1130
lasers.push(level.hazard(laserX, -500, 6, 300, 0.4))
lasers.push(level.hazard(laserX + laserGap, -500, 6, 300, 0.4))
lasers.push(level.hazard(laserX + laserGap * 2, -500, 6, 300, 0.4))
for (let i = 0; i < lasers.length; i++) {
lasers[i].isOn = false;
spawn.mapRect(lasers[i].min.x - 55, -550, 110, 50);
spawn.mapRect(lasers[i].min.x - 10, -500, 25, 20);
}
const button1 = level.button(2235, -200)
button1.isUp = true
let bonusAmmoCount = 0
spawnBlock = (x, y) => {
const index = body.length
spawn.bodyRect(x, y, 50, 50); // spawn.bodyRect(x, y, 40 + Math.floor(30 * Math.random()), 40 + Math.floor(30 * Math.random()));
body[index].collisionFilter.category = cat.body;
body[index].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
body[index].classType = "body";
Composite.add(engine.world, body[index]); //add to world
}
level.custom = () => { level.custom = () => {
if (isPowerLeft) {
if (!(simulation.cycle % 90)) spawnBlock(2730, -1600);
} else {
for (let i = 0; i < trains.length; i++) {
//oscillate back and forth
if (trains[i].position.x < 5275) {
trains[i].changeDirection(true) //go right
} else if (trains[i].position.x > 7875) {
trains[i].changeDirection(false) //go left
}
trains[i].move();
}
const rate = 160 //multiples of 32!
if ((simulation.cycle % rate) === 80) {
for (let i = 0; i < lasers.length; i++) lasers[i].isOn = false;
movers[3].VxGoal = moveSpeedStopGo;
movers[3].force = 0.0005
movers[2].VxGoal = moveSpeedStopGo;
movers[2].force = 0.0005
} else if ((simulation.cycle % rate) === 0) {
movers[3].VxGoal = 0;
movers[3].force = 0
movers[2].VxGoal = 0;
movers[2].force = 0
spawnBlock(2730, -1600); //3315, -1600);
if ((simulation.cycle % (rate * 3)) === 0) {
if (bonusAmmoCount < 6 && Math.random() < 0.6) { //some extra ammo because of all the extra mobs that don't drop ammo
bonusAmmoCount++
powerUps.spawn(2760, -1550, Math.random() < 0.5 ? "heal" : "ammo", false);
}
for (let i = 0; i < lasers.length; i++) lasers[i].isOn = true;
const block2Mob = (laserIndex) => { //convert block into mob
const laserHit = Matter.Query.ray(body, lasers[laserIndex].min, lasers[laserIndex].max) //check for collisions with 3rd laser
if (laserHit.length) {
for (let i = 0; i < body.length; i++) {
if (laserHit[0].body.id === body[i].id) { //need to find the block id so it can be removed
const list = ["flutter", "flutter", "flutter", "hopper", "slasher", "slasher", "slasher", "stabber", "springer", "striker", "sneaker", "launcher", "launcherOne", "exploder", "sucker", "spinner", "grower", "beamer", "spawner", "ghoster"]
const pick = list[Math.floor(Math.random() * list.length)]
spawn[pick](lasers[laserIndex].max.x, lasers[laserIndex].max.y - 20);
const who = mob[mob.length - 1]
Matter.Body.setVelocity(who, { x: (8 + 5 * Math.random()), y: -(14 + 10 * Math.random()) });
who.locatePlayer()
who.leaveBody = false;
who.isDropPowerUp = false
//remove block
Matter.Composite.remove(engine.world, body[i]);
body.splice(i, 1);
break
}
}
}
}
if (mob.length < 100 && !m.isBodiesAsleep) {
block2Mob(0)
block2Mob(1)
block2Mob(2)
}
}
}
}
if (button1.isUp) {
button1.query();
if (!button1.isUp) {
isPowerLeft = false
for (let i = 0; i < 3; i++) {
movers[i].VxGoal = 0;
movers[i].force = movers[i].VxGoal > 0 ? 0.0005 : -0.0005
}
powerUps.spawnStartingPowerUps(2760, -1550);
spawn.randomMob(2700, -350, 0.2);
spawn.randomMob(6975, -650, 0.2);
spawn.randomMob(6550, -325, 0.3);
spawn.randomMob(7350, -350, 0.3);
spawn.randomMob(7925, -975, 0.5);
spawn.randomMob(7950, -1725, 0.5);
spawn.randomMob(7000, -1375, 0.3);
spawn.randomMob(5700, -1350, 0.5);
spawn.randomMob(5250, -1575, 0.5);
spawn.randomMob(6325, -75, 0.3);
spawn.randomMob(7900, -1925, 0.1);
spawn.randomMob(5300, -1975, 0.3);
spawn.randomMob(7875, -1900, 0.3);
spawn.randomMob(5325, -1975, 0.4);
spawn.randomGroup(3900, -725, 0.4);
if (simulation.difficulty > 1) spawn.randomLevelBoss(6501, -1771);
spawn.secondaryBossChance(6063, -661)
powerUps.addResearchToLevel() //needs to run after mobs are spawned
}
}
button1.draw();
for (let i = 0; i < movers.length; i++) movers[i].push();
level.exit.drawAndCheck(); level.exit.drawAndCheck();
level.enter.draw(); level.enter.draw();
}; ctx.fillStyle = "rgba(0,0,0,0.1)"
level.customTopLayer = () => {}; ctx.fillRect(6937, -1050, 50, 675);
ctx.fillStyle = "rgba(0,255,255,0.15)" // ctx.fillStyle = "#f2f2f2"
ctx.fillRect(4975, -3050, 475, 375); //exit room
};
level.customTopLayer = () => {
if (isPowerLeft) {
ctx.fillStyle = "rgba(0,0,0,0.1)"
ctx.fillRect(2400, -1650, 7050, 2750) //right side
ctx.fillRect(4950, -3075, 3225, 1425);
ctx.fillStyle = "rgba(0,0,0,0.1)"
ctx.beginPath()
ctx.moveTo(2407, -576);
ctx.lineTo(2000, -573)
ctx.lineTo(1950, -439)
ctx.lineTo(1100, -432)
ctx.lineTo(1020, -143)
ctx.lineTo(125, -137)
ctx.lineTo(-109, 300)
ctx.lineTo(-125, 1089)
ctx.lineTo(2372, 1081)
ctx.lineTo(2452, 65)
ctx.fill();
} else {
for (let i = 0; i < trains.length; i++) {
trains[i].draw()
}
ctx.beginPath()
ctx.moveTo(2526, -589);
ctx.lineTo(2531, -597)
ctx.lineTo(2506, -594)
ctx.lineTo(2850, -600)
ctx.lineTo(2890, -193)
ctx.lineTo(6300, -200)
ctx.lineTo(6618, 857)
ctx.lineTo(6622, 1100)
ctx.lineTo(2521, 1100)
ctx.fillStyle = "rgba(0,0,0,0.1)"
ctx.fill();
ctx.fillStyle = "rgba(0,0,0,0.1)"
ctx.fillRect(-100, -1650, 2625, 2750) //left side
for (let i = 0; i < lasers.length; i++) lasers[i].opticalQuery()
}
ctx.fillStyle = "rgba(0,0,0,0.07)"
ctx.fillRect(7675, -1825, 1775, 1650);
ctx.fillRect(4975, -1900, 475, 825);
ctx.fillRect(2050, -1650, 350, 325) //entrance room
for (let i = 0; i < movers.length; i++) movers[i].draw();
};
spawn.mapRect(-1550, -3050, 1450, 4150); //left wall
spawn.mapRect(-1550, -3050, 6525, 1400); //ceiling
spawn.mapRect(-1550, -3050, 6525, 1400);
spawn.mapRect(3000, -1700, 1975, 675); //ceiling center
spawn.mapRect(3800, -4000, 5650, 950);
spawn.mapRect(3800, -4000, 1175, 2975);
spawn.mapRect(8175, -4000, 1275, 3685); //right wall
spawn.mapRect(8175, -200, 1275, 1300); //right wall
spawn.mapRect(75, 0, 6275, 1100); //ground
spawn.mapRect(6475, -200, 2750, 1300);
spawn.mapRect(4975, -1087, 550, 62);
spawn.mapRect(4975, -1100, 500, 75);
spawn.mapRect(7875, -1100, 175, 25); //right 3 hop stairs
spawn.mapRect(8075, -1450, 200, 25);
spawn.mapRect(7675, -1825, 375, 25);
spawn.mapRect(7675, -1800, 250, 725);
spawn.mapRect(5125, -1275, 200, 25); //left 3 hop stairs
spawn.mapRect(4900, -1575, 175, 25);
spawn.mapRect(5125, -1900, 325, 25);
spawn.mapRect(5225, -1875, 225, 625);
spawn.mapRect(5400, -3100, 50, 250); //exit
spawn.mapRect(4875, -2675, 675, 50); //exit
spawn.mapRect(1925, -1325, 550, 50); //entrance
spawn.mapRect(2050, -1675, 50, 175); //entrance
spawn.mapRect(1700, -200, 750, 275); //button shelf
if (Math.random() < 0.5) { //left side
spawn.mapRect(625, -1100, 425, 300);
spawn.mapRect(1375, -1100, 425, 300);
spawn.mapRect(1750, -835, 100, 35);
spawn.mapRect(-200, -525, 150, 35);
} else {
spawn.mapRect(800, -1125, 925, 400);
spawn.mapRect(75, -775, 400, 50);
spawn.mapRect(1700, -760, 75, 35);
spawn.mapRect(-200, -425, 150, 35);
}
spawn.mapRect(2400, -600, 125, 675);
spawn.mapRect(2400, -1750, 125, 1050);
spawn.mapRect(2700, -1700, 125, 85);
spawn.randomMob(350, -325, 0.5);
spawn.randomMob(875, -375, 0.5);
spawn.randomMob(1250, -575, 0.5);
spawn.randomMob(1550, -600, 0.5);
spawn.randomSmallMob(1250, -175);
spawn.randomSmallMob(1500, -229);
spawn.randomSmallMob(1850, -300);
powerUps.spawn(5200, -1300, "ammo");
spawn.mapRect(-100, 0, 1000, 100);
// powerUps.spawnStartingPowerUps(1475, -1175);
// spawn.debris(750, -2200, 3700, 16); //16 debris per level
// spawn.bodyRect(1540, -1110, 300, 25, 0.9);
// spawn.randomSmallMob(1300, -70);
// spawn.randomMob(2650, -975, 0.8);
// spawn.randomGroup(1700, -900, 0.4);
// if (simulation.difficulty > 1) spawn.randomLevelBoss(2200, -1300);
// spawn.secondaryBossChance(100, -1500)
powerUps.addResearchToLevel() //needs to run after mobs are spawned
}, },
final() { final() {
// color.map = "rgba(0,0,0,0.8)" // color.map = "rgba(0,0,0,0.8)"
@@ -13321,7 +13483,6 @@ const level = {
platformShadow(1275, -2150, 250, 100, shadows) platformShadow(1275, -2150, 250, 100, shadows)
cage(1400, -2050, 500, cages, 'starter', true) cage(1400, -2050, 500, cages, 'starter', true)
map[map.length] = Bodies.trapezoid(1400, -2193, 250, 100, 0.5) map[map.length] = Bodies.trapezoid(1400, -2193, 250, 100, 0.5)
//DEBRIS //DEBRIS
//idk just put the debris wherever you want //idk just put the debris wherever you want
spawn.debris(-550, -225, 100) spawn.debris(-550, -225, 100)
@@ -13329,18 +13490,12 @@ const level = {
spawn.debris(-275, -1400, 50) spawn.debris(-275, -1400, 50)
spawn.debris(2850, -2075, 150) spawn.debris(2850, -2075, 150)
spawn.debris(4250, -2250, 150) spawn.debris(4250, -2250, 150)
//BOSS //BOSS
// geneticBoss(1400, -3800) // geneticBoss(1400, -3800)
anotherBoss(0, 0) //will only spawn historyBoss if there is an additional boss anotherBoss(0, 0) //will only spawn historyBoss if there is an additional boss
//POWERUPS
}, },
stereoMadness() { stereoMadness() {
simulation.makeTextLog(`<strong>stereoMadness</strong> by <span class='color-var'>Richard0820</span>`); simulation.makeTextLog(`<strong>stereoMadness</strong> by <span class='color-var'>Richard0820</span>`);
let totalCoin = 0; let totalCoin = 0;
const hunter = function(x, y, radius = 30) { //doesn't stop chasing until past 105000 const hunter = function(x, y, radius = 30) { //doesn't stop chasing until past 105000
mobs.spawn(x, y, 6, radius, "black"); mobs.spawn(x, y, 6, radius, "black");

View File

@@ -55,7 +55,7 @@ const lore = {
trainer: { trainer: {
color: "#f20", color: "#f20",
voice: undefined, voice: undefined,
text: function (say) { text: function(say) {
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity); simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
lore.talkingColor = this.color lore.talkingColor = this.color
const utterance = new SpeechSynthesisUtterance(say); const utterance = new SpeechSynthesisUtterance(say);
@@ -67,7 +67,7 @@ const lore = {
anand: { anand: {
color: "#e0c", color: "#e0c",
voice: undefined, voice: undefined,
text: function (say) { text: function(say) {
if (level.levels[level.onLevel] === undefined) { //only talk if on the lore level (which is undefined because it is popped out of the level.levels array) if (level.levels[level.onLevel] === undefined) { //only talk if on the lore level (which is undefined because it is popped out of the level.levels array)
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity); simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
lore.talkingColor = this.color lore.talkingColor = this.color
@@ -101,7 +101,7 @@ const lore = {
}, },
miriam: { miriam: {
color: "#f20", color: "#f20",
text: function (say) { text: function(say) {
if (level.levels[level.onLevel] === undefined) { //only talk if on the lore level (which is undefined because it is popped out of the level.levels array) if (level.levels[level.onLevel] === undefined) { //only talk if on the lore level (which is undefined because it is popped out of the level.levels array)
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity); simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
lore.talkingColor = this.color lore.talkingColor = this.color
@@ -116,7 +116,7 @@ const lore = {
lore.isSpeech = false lore.isSpeech = false
lore.nextSentence() lore.nextSentence()
} }
speechFrozen = setTimeout(function () { // speech frozen after 10 seconds of no end speechFrozen = setTimeout(function() { // speech frozen after 10 seconds of no end
console.log('speech frozen') console.log('speech frozen')
lore.isSpeech = false lore.isSpeech = false
lore.nextSentence() lore.nextSentence()
@@ -330,7 +330,7 @@ const lore = {
if (input.down) { if (input.down) {
lore.miriam.text("So, No. Maybe you are lucky. Emotions are complex.") lore.miriam.text("So, No. Maybe you are lucky. Emotions are complex.")
} else if (input.up) { } else if (input.up) {
lore.anand.text("YES, Cool! I wonder if its emotions came from watching humans. ") lore.anand.text("YES, Cool! I wonder if its emotions came from watching humans.")
lore.sentence-- lore.sentence--
lore.conversation[lore.chapter].splice(lore.sentence + 1, 1, () => { lore.conversation[lore.chapter].splice(lore.sentence + 1, 1, () => {
lore.miriam.text("Or maybe it learned independently, because it needed them.") lore.miriam.text("Or maybe it learned independently, because it needed them.")
@@ -384,7 +384,7 @@ const lore = {
lore.miriam.text("Oh no.") lore.miriam.text("Oh no.")
}, },
() => { () => {
lore.anand.text("We can't talk to it while it's fighting") lore.anand.text("We can't talk to it while it's fighting.")
}, },
() => { () => {
lore.talkingColor = "#dff"; lore.talkingColor = "#dff";

View File

@@ -562,9 +562,9 @@ const mobs = {
}; };
vertexCollision(this.position, look, map); vertexCollision(this.position, look, map);
vertexCollision(this.position, look, body); vertexCollision(this.position, look, body);
if (!m.isCloak) vertexCollision(this.position, look, [playerBody, playerHead]); if (!m.isCloak) vertexCollision(this.position, look, [player]);
// hitting player // hitting player
if (best.who === playerBody || best.who === playerHead) { if (best.who === player) {
if (m.immuneCycle < m.cycle) { if (m.immuneCycle < m.cycle) {
const dmg = 0.0014 * simulation.dmgScale; const dmg = 0.0014 * simulation.dmgScale;
m.damage(dmg); m.damage(dmg);

View File

@@ -458,10 +458,12 @@ const powerUps = {
// } // }
} }
if (tech.isRerollBots) { if (tech.isRerollBots) {
let delay = 0
for (const cost = 2 + Math.floor(0.2 * b.totalBots()); powerUps.research.count > cost - 1; powerUps.research.count -= cost) { // 1/5 = 0.2 let cycle = () => {
delay += 500 const cost = 2 + Math.floor(0.2 * b.totalBots())
setTimeout(() => { if (m.alive && powerUps.research.count >= cost) requestAnimationFrame(cycle);
if (!simulation.paused && !simulation.isChoosing && !(simulation.cycle % 60)) {
powerUps.research.count -= cost
b.randomBot() b.randomBot()
if (tech.renormalization) { if (tech.renormalization) {
for (let i = 0; i < cost; i++) { for (let i = 0; i < cost; i++) {
@@ -471,8 +473,27 @@ const powerUps = {
} }
} }
} }
}, delay); }
} }
requestAnimationFrame(cycle);
// let delay = 0
// for (let cost = 2 + Math.floor(0.2 * b.totalBots()); powerUps.research.count > cost - 1; powerUps.research.count -= cost) { // 1/5 = 0.2
// cost = 2 + Math.floor(0.2 * b.totalBots())
// delay += 500
// setTimeout(() => {
// b.randomBot()
// if (tech.renormalization) {
// for (let i = 0; i < cost; i++) {
// if (Math.random() < 0.44) {
// m.fieldCDcycle = m.cycle + 20;
// powerUps.spawn(m.pos.x + 100 * (Math.random() - 0.5), m.pos.y + 100 * (Math.random() - 0.5), "research");
// }
// }
// }
// }, delay);
// }
} }
if (tech.isDeathAvoid && document.getElementById("tech-anthropic")) { if (tech.isDeathAvoid && document.getElementById("tech-anthropic")) {
document.getElementById("tech-anthropic").innerHTML = `-${powerUps.research.count}` document.getElementById("tech-anthropic").innerHTML = `-${powerUps.research.count}`

View File

@@ -2528,7 +2528,7 @@ const spawn = {
me.friction = 1 me.friction = 1
me.frictionStatic = 1 me.frictionStatic = 1
me.restitution = 0; me.restitution = 0;
me.delay = 100 + 40 * simulation.CDScale; me.delay = 120 + 40 * simulation.CDScale;
Matter.Body.rotate(me, Math.random() * Math.PI); Matter.Body.rotate(me, Math.random() * Math.PI);
spawn.shield(me, x, y, 1); spawn.shield(me, x, y, 1);
me.onDeath = function() { me.onDeath = function() {
@@ -3029,21 +3029,16 @@ const spawn = {
mobs.spawn(x, y, 5, radius, "#6ba"); mobs.spawn(x, y, 5, radius, "#6ba");
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
me.babyList = [] //list of mobs that are apart of this boss me.babyList = [] //list of mobs that are apart of this boss
Matter.Body.setDensity(me, 0.001); //extra dense //normal is 0.001 //makes effective life much larger and damage on collision Matter.Body.setDensity(me, 0.0015); //extra dense //normal is 0.001 //makes effective life much larger and damage on collision
me.damageReduction = 0.13 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) //normal is 1, most bosses have 0.25 me.damageReduction = 0.13 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) //normal is 1, most bosses have 0.25
me.isBoss = true; me.isBoss = true;
me.friction = 0; me.friction = 0;
me.frictionAir = 0.0067; me.frictionAir = 0.006;
me.g = 0.0002; //required if using this.gravity me.g = 0.0002; //required if using this.gravity
me.seePlayerFreq = 33; me.seePlayerFreq = 31;
const springStiffness = 0.00003; //simulation.difficulty const springStiffness = 0.00003; //simulation.difficulty
const springDampening = 0.0002; const springDampening = 0.0002;
// const springStiffness = 0.00014;
// const springDampening = 0.0005;
me.springTarget = { me.springTarget = {
x: me.position.x, x: me.position.x,
y: me.position.y y: me.position.y
@@ -4957,6 +4952,7 @@ const spawn = {
mobs.spawn(x, y, 16, radius, "rgb(255,255,255)"); mobs.spawn(x, y, 16, radius, "rgb(255,255,255)");
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
me.isBoss = true; me.isBoss = true;
me.isReactorBoss = true;
me.inertia = Infinity; //no rotation me.inertia = Infinity; //no rotation
me.burstFireFreq = 22 + Math.floor(13 * simulation.CDScale) me.burstFireFreq = 22 + Math.floor(13 * simulation.CDScale)
me.burstTotalPhases = 3 + Math.floor(1.4 / simulation.CDScale) me.burstTotalPhases = 3 + Math.floor(1.4 / simulation.CDScale)
@@ -5060,6 +5056,7 @@ const spawn = {
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
// Matter.Body.rotate(me, 2 * Math.PI * Math.random()); // Matter.Body.rotate(me, 2 * Math.PI * Math.random());
me.isBoss = true; me.isBoss = true;
me.isReactorBoss = true;
Matter.Body.setDensity(me, 0.001); //normal is 0.001 Matter.Body.setDensity(me, 0.001); //normal is 0.001
me.damageReduction = 0.04 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.damageReduction = 0.04 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1)
me.startingDamageReduction = me.damageReduction me.startingDamageReduction = me.damageReduction
@@ -5218,6 +5215,7 @@ const spawn = {
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
Matter.Body.rotate(me, 2 * Math.PI * Math.random()); Matter.Body.rotate(me, 2 * Math.PI * Math.random());
me.isBoss = true; me.isBoss = true;
me.isReactorBoss = true;
Matter.Body.setDensity(me, 0.003); //normal is 0.001 Matter.Body.setDensity(me, 0.003); //normal is 0.001
me.damageReduction = 0.1 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.damageReduction = 0.1 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1)
me.startingDamageReduction = me.damageReduction me.startingDamageReduction = me.damageReduction
@@ -5299,7 +5297,7 @@ const spawn = {
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
Matter.Body.rotate(me, 2 * Math.PI * Math.random()); Matter.Body.rotate(me, 2 * Math.PI * Math.random());
me.isBoss = true; me.isBoss = true;
me.isReactorBoss = true;
me.inertia = Infinity; me.inertia = Infinity;
me.frictionAir = 0.01 me.frictionAir = 0.01
me.restitution = 1 me.restitution = 1

View File

@@ -220,6 +220,14 @@ 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 (tech.isDivisor) {
for (let i = 0; i < b.inventory.length; i++) {
if (b.guns[b.inventory[i]].ammo % 3 === 0) {
dmg *= 1.4
break
}
}
}
if (tech.isNoGroundDamage) dmg *= m.onGround ? 0.78 : 1.88 if (tech.isNoGroundDamage) dmg *= m.onGround ? 0.78 : 1.88
if (tech.isDilate) dmg *= 1.5 + Math.sin(m.cycle * 0.0075) if (tech.isDilate) dmg *= 1.5 + Math.sin(m.cycle * 0.0075)
if (tech.isGunChoice && tech.buffedGun === b.inventoryGun) dmg *= 1 + 0.31 * b.inventory.length if (tech.isGunChoice && tech.buffedGun === b.inventoryGun) dmg *= 1 + 0.31 * b.inventory.length
@@ -312,7 +320,7 @@ const tech = {
}, },
requires: "not skin", requires: "not skin",
effect() { effect() {
tech.hardLanding = 40 tech.hardLanding = 70
tech.isFallingDamage = true; tech.isFallingDamage = true;
m.setMaxHealth(); m.setMaxHealth();
m.addHealth(1 / simulation.healScale) m.addHealth(1 / simulation.healScale)
@@ -339,7 +347,7 @@ const tech = {
requires: "not skinned", requires: "not skinned",
effect() { effect() {
m.skin.mech(); m.skin.mech();
tech.hardLanding = 90 tech.hardLanding = 110
tech.squirrelFx += 0.4; tech.squirrelFx += 0.4;
tech.squirrelJump += 0.16; tech.squirrelJump += 0.16;
m.setMovement() m.setMovement()
@@ -528,6 +536,25 @@ const tech = {
tech.isRewindGrenade = false; tech.isRewindGrenade = false;
} }
}, },
{
name: "ternary", //"divisor",
descriptionFunction() {
return `<strong>+40%</strong> <strong class='color-d'>damage</strong> while one of your <strong class='color-g'>guns</strong><br>has <strong class='color-ammo'>ammo</strong> divisible by <strong>3</strong>`
},
maxCount: 1,
count: 0,
frequency: 1,
frequencyDefault: 1,
allowed: () => true,
requires: "",
// divisible: 3, // + Math.floor(6 * Math.random()),
effect() {
tech.isDivisor = true;
},
remove() {
tech.isDivisor = false;
}
},
{ {
name: "ordnance", name: "ordnance",
description: "<strong>double</strong> the <strong class='flicker'>frequency</strong> of finding <strong class='color-g'>gun</strong><strong class='color-m'>tech</strong><br>spawn a <strong class='color-g'>gun</strong> and <strong>+7%</strong> <strong class='color-junk'>JUNK</strong> to <strong class='color-m'>tech</strong> pool", description: "<strong>double</strong> the <strong class='flicker'>frequency</strong> of finding <strong class='color-g'>gun</strong><strong class='color-m'>tech</strong><br>spawn a <strong class='color-g'>gun</strong> and <strong>+7%</strong> <strong class='color-junk'>JUNK</strong> to <strong class='color-m'>tech</strong> pool",
@@ -4831,7 +4858,7 @@ const tech = {
}, },
{ {
name: "Zectron", name: "Zectron",
description: `<strong>+66%</strong> <strong>super ball</strong> density and <strong class='color-d'>damage</strong>, but<br>after colliding with <strong>super balls</strong> <strong>-25%</strong> <strong class='color-f'>energy</strong>`, description: `<strong>+75%</strong> <strong>super ball</strong> density and <strong class='color-d'>damage</strong>, but<br>after colliding with <strong>super balls</strong> <strong>-25%</strong> <strong class='color-f'>energy</strong>`,
isGunTech: true, isGunTech: true,
maxCount: 1, maxCount: 1,
count: 0, count: 0,
@@ -11365,4 +11392,5 @@ const tech = {
hardLanding: null, hardLanding: null,
isNoGroundDamage: null, isNoGroundDamage: null,
isSuperBounce: null, isSuperBounce: null,
isDivisor: null
} }

View File

@@ -1,13 +1,28 @@
******************************************************** NEXT PATCH ************************************************** ******************************************************** NEXT PATCH **************************************************
map: factory
this is completely unbalanced, so let me know if what rough edges need to be sanded
found on seed 47086 level 6
tech: ternary - +40 damage if any gun has ammo divisible by 3
level element: transport - horizontal moving platforms
level element: mover - stationary platform that pushes the player horizontally
to see examples of transport and mover look in level.testing()
*********************************************************** TODO ***************************************************** *********************************************************** TODO *****************************************************
level element - mover level element - mover, transport
test effect of changing m.Vx on things like: shooting bullets? test effect of changing m.Vx on things like: shooting bullets?
add mobs add mobs?
extend the recentered friction zero to other things
like blocks the player stands on?
maybe zero on the horizontal velocity of whatever the player is standing on
remove the pause on wave between wave packets
maybe don't do packets, do sine wave beats instead?
wave tech don't end wave bullets on hitting mob, instead add a short cooldown, 1/4 of a second between hurting mobs
maybe fire rate could lower the frequency that wave bullets damage mobs as they pass through them
add a graphic to show the time when doing damage
extend uncertainty to superballs extend uncertainty to superballs
maybe make aiming them more random? maybe make aiming them more random?