gravityObservatory

new level: gravityObservatory

level: testChamber2 renamed gravityInterferometer
  it has been added to the levels that are extra hard and only show up late game
  it also got a bit hard with the addition of 1 more laser

deflected mob bullets are converted into small blocks
ablative drones is now a gun tech for drones
  it makes ~33% more drones
1.033->1.05x sneak attack damage per coupling for cloaking field

bug fixes
  extended vertical flip to edge cases:
    trail left by snakeBoss
    laser array from boss and mobs
    springer,spiderBoss,mantisBoss constraints
  subway: dark matter no longer removed if it gets too far from the player
  training: fixed potential lock out from running out of ammo
  training: fixed accidental difficulty increase
This commit is contained in:
landgreen
2024-10-05 17:11:06 -07:00
parent cea1c64c6e
commit a47ef97dbc
9 changed files with 628 additions and 187 deletions

View File

@@ -2559,10 +2559,7 @@ const spawn = {
const springStiffness = 0.00014;
const springDampening = 0.0005;
me.springTarget = {
x: me.position.x,
y: me.position.y
};
me.springTarget = { x: me.position.x, y: me.position.y };
const len = cons.length;
cons[len] = Constraint.create({
pointA: me.springTarget,
@@ -4322,7 +4319,7 @@ const spawn = {
me.accelMag = 0.0002 * simulation.accelScale;
spawn.shield(me, x, y);
me.lasers = [] //keeps track of static laser beams
me.laserArray = [] //keeps track of static laser beams
me.laserLimit = simulation.difficultyMode < 3 ? 1 : 2
me.fireDelay = Math.max(75, 140 - simulation.difficulty * 0.5)
me.cycle = 0
@@ -4354,14 +4351,14 @@ const spawn = {
best2.y = save1Y
}
this.lasers.push({ a: { x: best1.x, y: best1.y }, b: { x: best2.x, y: best2.y }, fade: 0 })
this.laserArray.push({ a: { x: best1.x, y: best1.y }, b: { x: best2.x, y: best2.y }, fade: 0 })
//friction to animate the mob dropping something
Matter.Body.setVelocity(this, Vector.mult(this.velocity, 0.05));
Matter.Body.setAngularVelocity(this, this.angularVelocity * 0.05)
// simulation.drawList.push({ x: best1.x, y: best1.y, radius: 10, color: "rgba(255,0,100,0.3)", time: simulation.drawTime * 2 });
// simulation.drawList.push({ x: best2.x, y: best2.y, radius: 10, color: "rgba(255,0,100,0.3)", time: simulation.drawTime * 2 });
if (this.lasers.length > this.laserLimit) this.lasers.shift() //cap total lasers
if (this.laserArray.length > this.laserLimit) this.laserArray.shift() //cap total laserArray
if (!this.seePlayer.recall && (Vector.magnitude(Vector.sub(this.position, this.driftGoal)) < 200 || 0.3 > Math.random())) {
//used in drift when can't find player
const radius = Math.random() * 1000;
@@ -4371,9 +4368,9 @@ const spawn = {
}
}
me.fireLaser = function () {
for (let i = 0; i < this.lasers.length; i++) { //fire all lasers in the array
let best = vertexCollision(this.lasers[i].a, this.lasers[i].b, m.isCloak ? [body] : [body, [playerBody, playerHead]]); //not checking map to fix not hitting player bug, this might make some lasers look strange when the map changes
if (this.lasers[i].fade > 0.99) {
for (let i = 0; i < this.laserArray.length; i++) { //fire all lasers in the array
let best = vertexCollision(this.laserArray[i].a, this.laserArray[i].b, m.isCloak ? [body] : [body, [playerBody, playerHead]]); //not checking map to fix not hitting player bug, this might make some lasers look strange when the map changes
if (this.laserArray[i].fade > 0.99) {
if (best.who && (best.who === playerBody || best.who === playerHead) && m.immuneCycle < m.cycle) { // hitting player
m.immuneCycle = m.cycle + m.collisionImmuneCycles; //player is immune to damage after getting hit
const dmg = 0.03 * simulation.dmgScale;
@@ -4385,7 +4382,7 @@ const spawn = {
color: "rgba(255,0,100,0.5)",
time: 20
});
this.lasers.splice(i, 1) //remove this laser node
this.laserArray.splice(i, 1) //remove this laser node
if (this.distanceToPlayer < 1000) { //mob jumps away from player
const forceMag = 0.03 * this.mass;
const angle = Math.atan2(this.seePlayer.position.y - this.position.y, this.seePlayer.position.x - this.position.x);
@@ -4395,7 +4392,7 @@ const spawn = {
} else if (best.who && best.who.classType === "body") { //hitting block
ctx.beginPath();
ctx.moveTo(best.x, best.y);
ctx.lineTo(this.lasers[i].a.x, this.lasers[i].a.y);
ctx.lineTo(this.laserArray[i].a.x, this.laserArray[i].a.y);
ctx.strokeStyle = `rgb(255,0,100)`;
ctx.lineWidth = 2;
ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]);
@@ -4403,8 +4400,8 @@ const spawn = {
ctx.setLineDash([]);
} else { //hitting nothing
ctx.beginPath();
ctx.moveTo(this.lasers[i].b.x, this.lasers[i].b.y);
ctx.lineTo(this.lasers[i].a.x, this.lasers[i].a.y);
ctx.moveTo(this.laserArray[i].b.x, this.laserArray[i].b.y);
ctx.lineTo(this.laserArray[i].a.x, this.laserArray[i].a.y);
ctx.strokeStyle = `rgb(255,0,100)`;
ctx.lineWidth = 2;
ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]);
@@ -4412,12 +4409,12 @@ const spawn = {
ctx.setLineDash([]);
}
} else {//fade in warning
this.lasers[i].fade += 0.01
this.laserArray[i].fade += 0.01
ctx.beginPath();
ctx.moveTo(this.lasers[i].a.x, this.lasers[i].a.y);
ctx.lineTo(this.lasers[i].b.x, this.lasers[i].b.y);
ctx.lineWidth = 2 + 40 - 40 * this.lasers[i].fade;
ctx.strokeStyle = `rgba(255,0,100,${0.02 + 0.1 * this.lasers[i].fade})`;
ctx.moveTo(this.laserArray[i].a.x, this.laserArray[i].a.y);
ctx.lineTo(this.laserArray[i].b.x, this.laserArray[i].b.y);
ctx.lineWidth = 2 + 40 - 40 * this.laserArray[i].fade;
ctx.strokeStyle = `rgba(255,0,100,${0.02 + 0.1 * this.laserArray[i].fade})`;
ctx.stroke();
}
}
@@ -4486,7 +4483,7 @@ const spawn = {
this.laserDelay = 130
}
};
me.lasers = [] //keeps track of static laser beams
me.laserArray = [] //keeps track of static laser beams
me.laserLimit = 2 + (simulation.difficultyMode > 2) + (simulation.difficultyMode > 4)
me.fireDelay = Math.max(75, 140 - simulation.difficulty * 0.5)
me.cycle = 0
@@ -4517,7 +4514,7 @@ const spawn = {
best2.x = save1X
best2.y = save1Y
}
this.lasers.push({ a: { x: best1.x, y: best1.y }, b: { x: best2.x, y: best2.y }, fade: 0 })
this.laserArray.push({ a: { x: best1.x, y: best1.y }, b: { x: best2.x, y: best2.y }, fade: 0 })
}
// add(m.pos, m.angle)
add(m.pos, this.angle + Math.PI / 4 + Math.PI / 2)
@@ -4534,9 +4531,9 @@ const spawn = {
}
}
me.fireLaser = function () {
for (let i = 0; i < this.lasers.length; i++) { //fire all lasers in the array
let best = vertexCollision(this.lasers[i].a, this.lasers[i].b, m.isCloak ? [body] : [body, [playerBody, playerHead]]); //not checking map to fix not hitting player bug, this might make some lasers look strange when the map changes
if (this.lasers[i].fade > 0.99) {
for (let i = 0; i < this.laserArray.length; i++) { //fire all laserArray in the array
let best = vertexCollision(this.laserArray[i].a, this.laserArray[i].b, m.isCloak ? [body] : [body, [playerBody, playerHead]]); //not checking map to fix not hitting player bug, this might make some lasers look strange when the map changes
if (this.laserArray[i].fade > 0.99) {
if (best.who && (best.who === playerBody || best.who === playerHead) && m.immuneCycle < m.cycle) { // hitting player
m.immuneCycle = m.cycle + m.collisionImmuneCycles; //player is immune to damage after getting hit
const dmg = 0.03 * simulation.dmgScale;
@@ -4548,7 +4545,7 @@ const spawn = {
color: "rgba(255,0,100,0.5)",
time: 20
});
this.lasers.splice(i, 1) //remove this laser node
this.laserArray.splice(i, 1) //remove this laser node
if (this.distanceToPlayer < 1000) { //mob jumps away from player
const forceMag = 0.03 * this.mass;
const angle = Math.atan2(this.seePlayer.position.y - this.position.y, this.seePlayer.position.x - this.position.x);
@@ -4558,7 +4555,7 @@ const spawn = {
} else if (best.who && best.who.classType === "body") { //hitting block
ctx.beginPath();
ctx.moveTo(best.x, best.y);
ctx.lineTo(this.lasers[i].a.x, this.lasers[i].a.y);
ctx.lineTo(this.laserArray[i].a.x, this.laserArray[i].a.y);
ctx.strokeStyle = `rgb(255,0,100)`;
ctx.lineWidth = 2;
ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]);
@@ -4566,8 +4563,8 @@ const spawn = {
ctx.setLineDash([]);
} else { //hitting nothing
ctx.beginPath();
ctx.moveTo(this.lasers[i].b.x, this.lasers[i].b.y);
ctx.lineTo(this.lasers[i].a.x, this.lasers[i].a.y);
ctx.moveTo(this.laserArray[i].b.x, this.laserArray[i].b.y);
ctx.lineTo(this.laserArray[i].a.x, this.laserArray[i].a.y);
ctx.strokeStyle = `rgb(255,0,100)`;
ctx.lineWidth = 2;
ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]);
@@ -4575,16 +4572,16 @@ const spawn = {
ctx.setLineDash([]);
}
} else {//fade in warning
this.lasers[i].fade += 0.007
this.laserArray[i].fade += 0.007
ctx.beginPath();
ctx.moveTo(this.lasers[i].a.x, this.lasers[i].a.y);
ctx.lineTo(this.lasers[i].b.x, this.lasers[i].b.y);
ctx.lineWidth = 2 + 40 - 40 * this.lasers[i].fade;
ctx.strokeStyle = `rgba(255,0,100,${0.02 + 0.1 * this.lasers[i].fade})`;
ctx.moveTo(this.laserArray[i].a.x, this.laserArray[i].a.y);
ctx.lineTo(this.laserArray[i].b.x, this.laserArray[i].b.y);
ctx.lineWidth = 2 + 40 - 40 * this.laserArray[i].fade;
ctx.strokeStyle = `rgba(255,0,100,${0.02 + 0.1 * this.laserArray[i].fade})`;
ctx.stroke();
if (this.lasers[i].fade > 0.99) {
this.lasers[i].fade = 1;
if (this.lasers.length > this.laserLimit) this.lasers.shift() //cap total lasers
if (this.laserArray[i].fade > 0.99) {
this.laserArray[i].fade = 1;
if (this.laserArray.length > this.laserLimit) this.laserArray.shift() //cap total lasers
break
}
}
@@ -4744,9 +4741,9 @@ const spawn = {
Matter.Body.setAngularVelocity(this, 0)
}
ctx.beginPath();
this.lasers(this.vertices[0], this.angle + Math.PI / 3);
this.lasers(this.vertices[1], this.angle + Math.PI);
this.lasers(this.vertices[2], this.angle - Math.PI / 3);
this.laserArray(this.vertices[0], this.angle + Math.PI / 3);
this.laserArray(this.vertices[1], this.angle + Math.PI);
this.laserArray(this.vertices[2], this.angle - Math.PI / 3);
ctx.strokeStyle = "#50f";
ctx.lineWidth = 1.5;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
@@ -4757,7 +4754,7 @@ const spawn = {
ctx.stroke(); // Draw it
}
};
me.lasers = function (where, angle) {
me.laserArray = function (where, angle) {
const seeRange = 7000;
best = {
x: null,