level clean ups rooftops, office
This commit is contained in:
@@ -466,7 +466,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Pauli exclusion",
|
name: "Pauli exclusion",
|
||||||
description: `unable to <strong>collide</strong> with enemies for <strong>+2</strong> seconds<br>activates after being <strong>harmed</strong> from a collision`,
|
description: `unable to <strong>collide</strong> with enemies for <strong>+1</strong> second<br>activates after being <strong>harmed</strong> from a collision`,
|
||||||
maxCount: 9,
|
maxCount: 9,
|
||||||
count: 0,
|
count: 0,
|
||||||
allowed() {
|
allowed() {
|
||||||
@@ -474,7 +474,7 @@ const b = {
|
|||||||
},
|
},
|
||||||
requires: "",
|
requires: "",
|
||||||
effect() {
|
effect() {
|
||||||
b.modCollisionImmuneCycles += 120;
|
b.modCollisionImmuneCycles += 60;
|
||||||
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
@@ -542,7 +542,7 @@ const b = {
|
|||||||
requires: "",
|
requires: "",
|
||||||
effect() {
|
effect() {
|
||||||
b.isModPiezo = true;
|
b.isModPiezo = true;
|
||||||
mech.fieldMeter = mech.fieldEnergyMax;
|
mech.energy = mech.fieldEnergyMax;
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
b.isModPiezo = false;
|
b.isModPiezo = false;
|
||||||
@@ -559,7 +559,7 @@ const b = {
|
|||||||
requires: "",
|
requires: "",
|
||||||
effect() {
|
effect() {
|
||||||
b.modEnergySiphon += 0.15;
|
b.modEnergySiphon += 0.15;
|
||||||
mech.fieldMeter = mech.fieldEnergyMax
|
mech.energy = mech.fieldEnergyMax
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
b.modEnergySiphon = 0;
|
b.modEnergySiphon = 0;
|
||||||
@@ -592,7 +592,7 @@ const b = {
|
|||||||
requires: "",
|
requires: "",
|
||||||
effect() {
|
effect() {
|
||||||
mech.fieldEnergyMax += 0.5
|
mech.fieldEnergyMax += 0.5
|
||||||
mech.fieldMeter += 0.5
|
mech.energy += 0.5
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
mech.fieldEnergyMax = 1;
|
mech.fieldEnergyMax = 1;
|
||||||
@@ -642,7 +642,7 @@ const b = {
|
|||||||
requires: "",
|
requires: "",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
b.isModMassEnergy = true // used in mech.grabPowerUp
|
b.isModMassEnergy = true // used in mech.grabPowerUp
|
||||||
mech.fieldMeter = mech.fieldEnergyMax * 2
|
mech.energy = mech.fieldEnergyMax * 2
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
b.isModMassEnergy = false;
|
b.isModMassEnergy = false;
|
||||||
@@ -1176,8 +1176,8 @@ const b = {
|
|||||||
if (dist < radius) {
|
if (dist < radius) {
|
||||||
if (b.isModImmuneExplosion) {
|
if (b.isModImmuneExplosion) {
|
||||||
const drain = Math.max(radius * 0.0006, 0.2)
|
const drain = Math.max(radius * 0.0006, 0.2)
|
||||||
if (mech.fieldMeter > drain) {
|
if (mech.energy > drain) {
|
||||||
mech.fieldMeter -= drain
|
mech.energy -= drain
|
||||||
} else {
|
} else {
|
||||||
mech.damage(radius * 0.0001); //do half damage if have the mod, but out of mana
|
mech.damage(radius * 0.0001); //do half damage if have the mod, but out of mana
|
||||||
}
|
}
|
||||||
@@ -1685,8 +1685,8 @@ const b = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//hit target with laser
|
//hit target with laser
|
||||||
if (this.lockedOn && this.lockedOn.alive && mech.fieldMeter > 0.15) {
|
if (this.lockedOn && this.lockedOn.alive && mech.energy > 0.15) {
|
||||||
mech.fieldMeter -= 0.0014
|
mech.energy -= 0.0014
|
||||||
//make sure you can still see vertex
|
//make sure you can still see vertex
|
||||||
const DIST = Vector.magnitude(Vector.sub(this.vertices[0], this.lockedOn.position));
|
const DIST = Vector.magnitude(Vector.sub(this.vertices[0], this.lockedOn.position));
|
||||||
if (DIST - this.lockedOn.radius < this.range + 150 &&
|
if (DIST - this.lockedOn.radius < this.range + 150 &&
|
||||||
@@ -2518,13 +2518,13 @@ const b = {
|
|||||||
mob[i].force.y += 1.5 * FORCE.y;
|
mob[i].force.y += 1.5 * FORCE.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mech.fieldMeter > 0.005) { // charging on mouse down
|
} else if (mech.energy > 0.005) { // charging on mouse down
|
||||||
mech.fireCDcycle = Infinity //can't fire until mouse is released
|
mech.fireCDcycle = Infinity //can't fire until mouse is released
|
||||||
const lastCharge = this.charge
|
const lastCharge = this.charge
|
||||||
let chargeRate = (mech.crouch) ? 0.975 : 0.987
|
let chargeRate = (mech.crouch) ? 0.975 : 0.987
|
||||||
chargeRate *= Math.pow(b.modFireRate, 0.04)
|
chargeRate *= Math.pow(b.modFireRate, 0.04)
|
||||||
this.charge = this.charge * chargeRate + (1 - chargeRate) // this.charge converges to 1
|
this.charge = this.charge * chargeRate + (1 - chargeRate) // this.charge converges to 1
|
||||||
mech.fieldMeter -= (this.charge - lastCharge) * 0.28 //energy drain is proportional to charge gained, but doesn't stop normal mech.fieldRegen
|
mech.energy -= (this.charge - lastCharge) * 0.28 //energy drain is proportional to charge gained, but doesn't stop normal mech.fieldRegen
|
||||||
|
|
||||||
//draw targeting
|
//draw targeting
|
||||||
let best;
|
let best;
|
||||||
@@ -2649,10 +2649,10 @@ const b = {
|
|||||||
fire() {
|
fire() {
|
||||||
const reflectivity = 1 - 1 / (b.modLaserReflections * 1.5)
|
const reflectivity = 1 - 1 / (b.modLaserReflections * 1.5)
|
||||||
let damage = b.dmgScale * b.modLaserDamage
|
let damage = b.dmgScale * b.modLaserDamage
|
||||||
if (mech.fieldMeter < b.modLaserFieldDrain) {
|
if (mech.energy < b.modLaserFieldDrain) {
|
||||||
mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
|
mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
|
||||||
} else {
|
} else {
|
||||||
mech.fieldMeter -= mech.fieldRegen + b.modLaserFieldDrain
|
mech.energy -= mech.fieldRegen + b.modLaserFieldDrain
|
||||||
let best = {
|
let best = {
|
||||||
x: null,
|
x: null,
|
||||||
y: null,
|
y: null,
|
||||||
@@ -2878,8 +2878,8 @@ const b = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//use energy to explode
|
//use energy to explode
|
||||||
const energy = 0.3 * Math.min(mech.fieldMeter, 1.75)
|
const energy = 0.3 * Math.min(mech.energy, 1.75)
|
||||||
mech.fieldMeter -= energy
|
mech.energy -= energy
|
||||||
if (best.who) b.explosion(path[1], 1000 * energy)
|
if (best.who) b.explosion(path[1], 1000 * energy)
|
||||||
mech.fireCDcycle = mech.cycle + Math.floor(60 * b.modFireRate); // cool down
|
mech.fireCDcycle = mech.cycle + Math.floor(60 * b.modFireRate); // cool down
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ function collisionChecks(event) {
|
|||||||
let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0
|
let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0
|
||||||
mech.damage(dmg);
|
mech.damage(dmg);
|
||||||
if (mob[k].onHit) mob[k].onHit(k);
|
if (mob[k].onHit) mob[k].onHit(k);
|
||||||
if (b.isModPiezo) mech.fieldMeter = mech.fieldEnergyMax;
|
if (b.isModPiezo) mech.energy = mech.fieldEnergyMax;
|
||||||
if (b.isModAnnihilation && mob[k].dropPowerUp && !mob[k].isShielded) {
|
if (b.isModAnnihilation && mob[k].dropPowerUp && !mob[k].isShielded) {
|
||||||
mob[k].death();
|
mob[k].death();
|
||||||
game.drawList.push({
|
game.drawList.push({
|
||||||
@@ -196,7 +196,7 @@ function collisionChecks(event) {
|
|||||||
const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity));
|
const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity));
|
||||||
if (v > 8) {
|
if (v > 8) {
|
||||||
let dmg = b.dmgScale * (b.modAcidDmg + v * Math.sqrt(obj.mass) * 0.07);
|
let dmg = b.dmgScale * (b.modAcidDmg + v * Math.sqrt(obj.mass) * 0.07);
|
||||||
mob[k].damage(dmg);
|
mob[k].damage(dmg, true);
|
||||||
if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer();
|
if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer();
|
||||||
game.drawList.push({
|
game.drawList.push({
|
||||||
//add dmg to draw queue
|
//add dmg to draw queue
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ const game = {
|
|||||||
b.giveGuns("all", 1000)
|
b.giveGuns("all", 1000)
|
||||||
} else if (keys[72]) { // heal with H
|
} else if (keys[72]) { // heal with H
|
||||||
mech.addHealth(Infinity)
|
mech.addHealth(Infinity)
|
||||||
mech.fieldMeter = mech.fieldEnergyMax;
|
mech.energy = mech.fieldEnergyMax;
|
||||||
} else if (keys[89]) { //add mods with y
|
} else if (keys[89]) { //add mods with y
|
||||||
b.giveMod()
|
b.giveMod()
|
||||||
} else if (keys[82]) { // teleport to mouse with R
|
} else if (keys[82]) { // teleport to mouse with R
|
||||||
@@ -644,14 +644,14 @@ const game = {
|
|||||||
|
|
||||||
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
|
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
|
||||||
if (b.isModEnergyRecovery) {
|
if (b.isModEnergyRecovery) {
|
||||||
mech.fieldMeter += mech.fieldEnergyMax * 0.07
|
mech.energy += mech.fieldEnergyMax * 0.07
|
||||||
if (mech.fieldMeter > mech.fieldEnergyMax) mech.fieldMeter = mech.fieldEnergyMax;
|
if (mech.energy > mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax;
|
||||||
}
|
}
|
||||||
if (b.isModHealthRecovery) {
|
if (b.isModHealthRecovery) {
|
||||||
mech.addHealth(0.01)
|
mech.addHealth(0.01)
|
||||||
}
|
}
|
||||||
if (b.isModEnergyLoss) {
|
if (b.isModEnergyLoss) {
|
||||||
mech.fieldMeter = 0.05;
|
mech.energy = 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { //haven't killed a mob in the last 5 seconds
|
} else { //haven't killed a mob in the last 5 seconds
|
||||||
|
|||||||
77
js/level.js
77
js/level.js
@@ -597,10 +597,17 @@ const level = {
|
|||||||
level.fill.push({
|
level.fill.push({
|
||||||
x: -650,
|
x: -650,
|
||||||
y: -2300,
|
y: -2300,
|
||||||
width: 450,
|
width: 440,
|
||||||
height: 300,
|
height: 300,
|
||||||
color: "rgba(0,0,0,0.15)"
|
color: "rgba(0,0,0,0.15)"
|
||||||
});
|
});
|
||||||
|
level.fillBG.push({
|
||||||
|
x: 3460,
|
||||||
|
y: -700,
|
||||||
|
width: 1090,
|
||||||
|
height: 800,
|
||||||
|
color: "#d4f4f4"
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
//reverse direction, start in bottom right
|
//reverse direction, start in bottom right
|
||||||
mech.setPosToSpawn(3650, -325);
|
mech.setPosToSpawn(3650, -325);
|
||||||
@@ -611,10 +618,17 @@ const level = {
|
|||||||
level.fillBG.push({
|
level.fillBG.push({
|
||||||
x: -650,
|
x: -650,
|
||||||
y: -2300,
|
y: -2300,
|
||||||
width: 450,
|
width: 440,
|
||||||
height: 300,
|
height: 300,
|
||||||
color: "#d4f4f4"
|
color: "#d4f4f4"
|
||||||
});
|
});
|
||||||
|
level.fill.push({
|
||||||
|
x: 3460,
|
||||||
|
y: -700,
|
||||||
|
width: 1090,
|
||||||
|
height: 800,
|
||||||
|
color: "rgba(0,0,0,0.1)"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
level.enter.x = mech.spawnPos.x - 50;
|
level.enter.x = mech.spawnPos.x - 50;
|
||||||
level.enter.y = mech.spawnPos.y + 20;
|
level.enter.y = mech.spawnPos.y + 20;
|
||||||
@@ -627,10 +641,10 @@ const level = {
|
|||||||
//foreground
|
//foreground
|
||||||
|
|
||||||
level.fill.push({
|
level.fill.push({
|
||||||
x: 3450,
|
x: 3460,
|
||||||
y: -1250,
|
y: -1250,
|
||||||
width: 1100,
|
width: 1080,
|
||||||
height: 1250,
|
height: 550,
|
||||||
color: "rgba(0,0,0,0.1)"
|
color: "rgba(0,0,0,0.1)"
|
||||||
});
|
});
|
||||||
level.fill.push({
|
level.fill.push({
|
||||||
@@ -656,17 +670,17 @@ const level = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
level.fill.push({
|
level.fill.push({
|
||||||
x: 1950,
|
x: 1860,
|
||||||
y: -1950,
|
y: -1950,
|
||||||
width: 600,
|
width: 630,
|
||||||
height: 350,
|
height: 350,
|
||||||
color: "rgba(0,0,0,0.1)"
|
color: "rgba(0,0,0,0.1)"
|
||||||
});
|
});
|
||||||
|
|
||||||
level.fill.push({
|
level.fill.push({
|
||||||
x: 1950,
|
x: 1760,
|
||||||
y: -1550,
|
y: -1550,
|
||||||
width: 1025,
|
width: 1290,
|
||||||
height: 550,
|
height: 550,
|
||||||
color: "rgba(0,0,0,0.1)"
|
color: "rgba(0,0,0,0.1)"
|
||||||
});
|
});
|
||||||
@@ -678,16 +692,16 @@ const level = {
|
|||||||
color: "rgba(0,0,0,0.1)"
|
color: "rgba(0,0,0,0.1)"
|
||||||
});
|
});
|
||||||
level.fill.push({
|
level.fill.push({
|
||||||
x: 3450,
|
x: 3510,
|
||||||
y: -1550,
|
y: -1550,
|
||||||
width: 350,
|
width: 330,
|
||||||
height: 300,
|
height: 300,
|
||||||
color: "rgba(0,0,0,0.1)"
|
color: "rgba(0,0,0,0.1)"
|
||||||
});
|
});
|
||||||
level.fill.push({
|
level.fill.push({
|
||||||
x: 700,
|
x: 710,
|
||||||
y: -2225,
|
y: -2225,
|
||||||
width: 700,
|
width: 580,
|
||||||
height: 225,
|
height: 225,
|
||||||
color: "rgba(0,0,0,0.1)"
|
color: "rgba(0,0,0,0.1)"
|
||||||
});
|
});
|
||||||
@@ -705,11 +719,11 @@ const level = {
|
|||||||
spawn.bodyRect(-240, -2115, 30, 36); //door to starting room
|
spawn.bodyRect(-240, -2115, 30, 36); //door to starting room
|
||||||
spawn.bodyRect(-240, -2080, 30, 35); //door to starting room
|
spawn.bodyRect(-240, -2080, 30, 35); //door to starting room
|
||||||
spawn.bodyRect(-240, -2045, 30, 35); //door to starting room
|
spawn.bodyRect(-240, -2045, 30, 35); //door to starting room
|
||||||
spawn.mapRect(1950, -2000, 600, 50);
|
spawn.mapRect(1850, -2000, 650, 50);
|
||||||
spawn.bodyRect(200, -2150, 200, 220, 0.8);
|
spawn.bodyRect(200, -2150, 200, 220, 0.8);
|
||||||
spawn.mapRect(700, -2275, 700, 50);
|
spawn.mapRect(700, -2275, 600, 50);
|
||||||
spawn.bodyRect(1050, -2350, 30, 30, 0.8);
|
spawn.bodyRect(1050, -2350, 30, 30, 0.8);
|
||||||
spawn.boost(1800, -1000, 1200);
|
// spawn.boost(1800, -1000, 1200);
|
||||||
spawn.bodyRect(1625, -1100, 100, 75);
|
spawn.bodyRect(1625, -1100, 100, 75);
|
||||||
spawn.bodyRect(1350, -1025, 400, 25); // ground plank
|
spawn.bodyRect(1350, -1025, 400, 25); // ground plank
|
||||||
spawn.mapRect(-725, -1000, 2150, 100); //lower left ledge
|
spawn.mapRect(-725, -1000, 2150, 100); //lower left ledge
|
||||||
@@ -724,8 +738,8 @@ const level = {
|
|||||||
spawn.bodyRect(2700, -1125, 125, 125, 0.8);
|
spawn.bodyRect(2700, -1125, 125, 125, 0.8);
|
||||||
spawn.bodyRect(2710, -1250, 125, 125, 0.8);
|
spawn.bodyRect(2710, -1250, 125, 125, 0.8);
|
||||||
spawn.bodyRect(2705, -1350, 75, 100, 0.8);
|
spawn.bodyRect(2705, -1350, 75, 100, 0.8);
|
||||||
spawn.mapRect(3450, -1600, 350, 50);
|
spawn.mapRect(3500, -1600, 350, 50);
|
||||||
spawn.mapRect(1950, -1600, 1025, 50);
|
spawn.mapRect(1750, -1600, 1310, 50);
|
||||||
spawn.bodyRect(3100, -1015, 375, 15);
|
spawn.bodyRect(3100, -1015, 375, 15);
|
||||||
spawn.bodyRect(3500, -850, 75, 125, 0.8);
|
spawn.bodyRect(3500, -850, 75, 125, 0.8);
|
||||||
spawn.mapRect(3450, -1000, 50, 580); //left building wall
|
spawn.mapRect(3450, -1000, 50, 580); //left building wall
|
||||||
@@ -734,7 +748,7 @@ const level = {
|
|||||||
spawn.bodyRect(4850, -750, 300, 25, 0.8);
|
spawn.bodyRect(4850, -750, 300, 25, 0.8);
|
||||||
spawn.bodyRect(3925, -1400, 100, 150, 0.8);
|
spawn.bodyRect(3925, -1400, 100, 150, 0.8);
|
||||||
spawn.mapRect(3450, -1250, 1100, 50);
|
spawn.mapRect(3450, -1250, 1100, 50);
|
||||||
spawn.mapRect(3450, -1225, 50, 75);
|
// spawn.mapRect(3450, -1225, 50, 75);
|
||||||
spawn.mapRect(4500, -1225, 50, 390);
|
spawn.mapRect(4500, -1225, 50, 390);
|
||||||
spawn.mapRect(3450, -725, 1500, 50);
|
spawn.mapRect(3450, -725, 1500, 50);
|
||||||
spawn.mapRect(5100, -725, 400, 50);
|
spawn.mapRect(5100, -725, 400, 50);
|
||||||
@@ -909,6 +923,7 @@ const level = {
|
|||||||
spawn.mapRect(4250, -3700, 50, 300);
|
spawn.mapRect(4250, -3700, 50, 300);
|
||||||
spawn.mapRect(3700, -3250, 1100, 100);
|
spawn.mapRect(3700, -3250, 1100, 100);
|
||||||
|
|
||||||
|
spawn.randomBoss(350, -500, 1)
|
||||||
spawn.randomSmallMob(-225, 25);
|
spawn.randomSmallMob(-225, 25);
|
||||||
spawn.randomSmallMob(1000, -1100);
|
spawn.randomSmallMob(1000, -1100);
|
||||||
spawn.randomSmallMob(4000, -250);
|
spawn.randomSmallMob(4000, -250);
|
||||||
@@ -927,7 +942,6 @@ const level = {
|
|||||||
spawn.randomMob(1700, -50, 0.3)
|
spawn.randomMob(1700, -50, 0.3)
|
||||||
spawn.randomMob(2350, -900, 0.3)
|
spawn.randomMob(2350, -900, 0.3)
|
||||||
spawn.randomMob(4700, -150, 0.2);
|
spawn.randomMob(4700, -150, 0.2);
|
||||||
spawn.randomBoss(350, -500, 1)
|
|
||||||
spawn.randomBoss(4000, -350, 0.6);
|
spawn.randomBoss(4000, -350, 0.6);
|
||||||
spawn.randomBoss(2750, -550, 0.1);
|
spawn.randomBoss(2750, -550, 0.1);
|
||||||
if (game.difficulty > 2) {
|
if (game.difficulty > 2) {
|
||||||
@@ -1481,12 +1495,26 @@ const level = {
|
|||||||
level.exit.x = 3250;
|
level.exit.x = 3250;
|
||||||
level.exit.y = -530;
|
level.exit.y = -530;
|
||||||
// spawn.randomSmallMob(3550, -550);
|
// spawn.randomSmallMob(3550, -550);
|
||||||
|
level.fillBG.push({
|
||||||
|
x: 3050,
|
||||||
|
y: -950,
|
||||||
|
width: 625,
|
||||||
|
height: 500,
|
||||||
|
color: "#dff"
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
//reverse direction, start in bottom right
|
//reverse direction, start in bottom right
|
||||||
mech.setPosToSpawn(3250, -550); //normal spawn
|
mech.setPosToSpawn(3250, -550); //normal spawn
|
||||||
level.exit.x = 1375;
|
level.exit.x = 1375;
|
||||||
level.exit.y = -1530;
|
level.exit.y = -1530;
|
||||||
spawn.bodyRect(3655, -650, 40, 150); //door
|
// spawn.bodyRect(3655, -650, 40, 150); //door
|
||||||
|
level.fillBG.push({
|
||||||
|
x: 725,
|
||||||
|
y: -1950,
|
||||||
|
width: 825,
|
||||||
|
height: 450,
|
||||||
|
color: "#dff"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 50); //ground bump wall
|
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 50); //ground bump wall
|
||||||
level.enter.x = mech.spawnPos.x - 50;
|
level.enter.x = mech.spawnPos.x - 50;
|
||||||
@@ -1554,8 +1582,9 @@ const level = {
|
|||||||
spawn.mapRect(-600, -2000 + 250, 2000 - 700, 50); //roof left
|
spawn.mapRect(-600, -2000 + 250, 2000 - 700, 50); //roof left
|
||||||
spawn.mapRect(-600 + 1300, -2000, 50, 300); //right roof wall
|
spawn.mapRect(-600 + 1300, -2000, 50, 300); //right roof wall
|
||||||
spawn.mapRect(-600 + 1300, -2000, 900, 50); //center wall
|
spawn.mapRect(-600 + 1300, -2000, 900, 50); //center wall
|
||||||
map[map.length] = Bodies.polygon(425, -1700, 0, 15); //circle above door
|
|
||||||
spawn.bodyRect(420, -1675, 15, 170, 1, spawn.propsDoor); // door
|
map[map.length] = Bodies.polygon(725, -1700, 0, 15); //circle above door
|
||||||
|
spawn.bodyRect(720, -1675, 15, 170, 1, spawn.propsDoor); // door
|
||||||
body[body.length - 1].isNotHoldable = true;
|
body[body.length - 1].isNotHoldable = true;
|
||||||
//makes door swing
|
//makes door swing
|
||||||
consBB[consBB.length] = Constraint.create({
|
consBB[consBB.length] = Constraint.create({
|
||||||
@@ -1590,6 +1619,8 @@ const level = {
|
|||||||
spawn.mapRect(4150, -600, 350, 150); //table
|
spawn.mapRect(4150, -600, 350, 150); //table
|
||||||
spawn.mapRect(3650, -1300, 50, 650); //exit wall
|
spawn.mapRect(3650, -1300, 50, 650); //exit wall
|
||||||
spawn.mapRect(3650, -1300, 1350, 50); //exit wall
|
spawn.mapRect(3650, -1300, 1350, 50); //exit wall
|
||||||
|
spawn.bodyRect(3665, -650, 20, 150); //door
|
||||||
|
|
||||||
|
|
||||||
spawn.mapRect(3000, -2000 * 0.5, 700, 50); //exit roof
|
spawn.mapRect(3000, -2000 * 0.5, 700, 50); //exit roof
|
||||||
spawn.mapRect(3000, -2000 * 0.25, 2000 - 300, 50); //1st floor
|
spawn.mapRect(3000, -2000 * 0.25, 2000 - 300, 50); //1st floor
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ const mobs = {
|
|||||||
// ctx.lineDashOffset = 6*(game.cycle % 215);
|
// ctx.lineDashOffset = 6*(game.cycle % 215);
|
||||||
if (this.distanceToPlayer() < this.laserRange && !mech.isStealth) {
|
if (this.distanceToPlayer() < this.laserRange && !mech.isStealth) {
|
||||||
mech.damage(0.0003 * game.dmgScale);
|
mech.damage(0.0003 * game.dmgScale);
|
||||||
if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.003
|
if (mech.energy > 0.1) mech.energy -= 0.003
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(this.position.x, this.position.y);
|
ctx.moveTo(this.position.x, this.position.y);
|
||||||
ctx.lineTo(mech.pos.x, mech.pos.y);
|
ctx.lineTo(mech.pos.x, mech.pos.y);
|
||||||
@@ -933,8 +933,8 @@ const mobs = {
|
|||||||
ctx.fillRect(x, y, w * this.health, h);
|
ctx.fillRect(x, y, w * this.health, h);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
damage(dmg) {
|
damage(dmg, isBypassShield = false) {
|
||||||
if (!this.isShielded) {
|
if (!this.isShielded || isBypassShield) {
|
||||||
dmg /= Math.sqrt(this.mass)
|
dmg /= Math.sqrt(this.mass)
|
||||||
if (this.shield) dmg *= 0.04
|
if (this.shield) dmg *= 0.04
|
||||||
if (b.isModLowHealthDmg) dmg *= (3 / (2 + mech.health)) //up to 50% dmg at zero player health
|
if (b.isModLowHealthDmg) dmg *= (3 / (2 + mech.health)) //up to 50% dmg at zero player health
|
||||||
@@ -942,7 +942,7 @@ const mobs = {
|
|||||||
// if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(1000, Math.min(3500, this.distanceToPlayer())) - 1000) * 0.01 //up to 50% dmg at max range of 3500
|
// if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(1000, Math.min(3500, this.distanceToPlayer())) - 1000) * 0.01 //up to 50% dmg at max range of 3500
|
||||||
if (b.isModEnergyLoss) dmg *= 1.5;
|
if (b.isModEnergyLoss) dmg *= 1.5;
|
||||||
if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(500, Math.min(3000, this.distanceToPlayer())) - 500) * 0.0067 //up to 50% dmg at max range of 3500
|
if (b.isModFarAwayDmg) dmg *= 1 + Math.sqrt(Math.max(500, Math.min(3000, this.distanceToPlayer())) - 500) * 0.0067 //up to 50% dmg at max range of 3500
|
||||||
if (b.modEnergySiphon && dmg !== Infinity) mech.fieldMeter += Math.min(this.health, dmg) * b.modEnergySiphon
|
if (b.modEnergySiphon && dmg !== Infinity) mech.energy += Math.min(this.health, dmg) * b.modEnergySiphon
|
||||||
if (b.modHealthDrain && dmg !== Infinity) mech.addHealth(Math.min(this.health, dmg) * b.modHealthDrain)
|
if (b.modHealthDrain && dmg !== Infinity) mech.addHealth(Math.min(this.health, dmg) * b.modHealthDrain)
|
||||||
this.health -= dmg
|
this.health -= dmg
|
||||||
//this.fill = this.color + this.health + ')';
|
//this.fill = this.color + this.health + ')';
|
||||||
|
|||||||
102
js/player.js
102
js/player.js
@@ -665,7 +665,7 @@ const mech = {
|
|||||||
holdingTarget: null,
|
holdingTarget: null,
|
||||||
fieldShieldingScale: 1,
|
fieldShieldingScale: 1,
|
||||||
// these values are set on reset by setHoldDefaults()
|
// these values are set on reset by setHoldDefaults()
|
||||||
fieldMeter: 0,
|
energy: 0,
|
||||||
fieldRegen: 0,
|
fieldRegen: 0,
|
||||||
fieldMode: 0,
|
fieldMode: 0,
|
||||||
fieldFire: false,
|
fieldFire: false,
|
||||||
@@ -679,13 +679,12 @@ const mech = {
|
|||||||
mech.fieldThreshold = Math.cos(mech.fieldArc * Math.PI)
|
mech.fieldThreshold = Math.cos(mech.fieldArc * Math.PI)
|
||||||
},
|
},
|
||||||
setHoldDefaults() {
|
setHoldDefaults() {
|
||||||
if (mech.fieldMeter < mech.fieldEnergyMax) mech.fieldMeter = mech.fieldEnergyMax;
|
if (mech.energy < mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax;
|
||||||
mech.fieldRegen = 0.001;
|
mech.fieldRegen = 0.001;
|
||||||
mech.fieldFire = false;
|
mech.fieldFire = false;
|
||||||
mech.fieldCDcycle = 0;
|
mech.fieldCDcycle = 0;
|
||||||
mech.isStealth = false;
|
mech.isStealth = false;
|
||||||
player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield
|
player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield
|
||||||
// mech.fieldShieldingScale = 1; //scale energy loss after collision with mob
|
|
||||||
mech.holdingMassScale = 0.5;
|
mech.holdingMassScale = 0.5;
|
||||||
mech.throwChargeRate = 2;
|
mech.throwChargeRate = 2;
|
||||||
mech.throwChargeMax = 50;
|
mech.throwChargeMax = 50;
|
||||||
@@ -695,17 +694,17 @@ const mech = {
|
|||||||
mech.wakeCheck();
|
mech.wakeCheck();
|
||||||
},
|
},
|
||||||
drawFieldMeter(range = 60) {
|
drawFieldMeter(range = 60) {
|
||||||
if (mech.fieldMeter < mech.fieldEnergyMax) {
|
if (mech.energy < mech.fieldEnergyMax) {
|
||||||
mech.fieldMeter += mech.fieldRegen;
|
mech.energy += mech.fieldRegen;
|
||||||
ctx.fillStyle = "rgba(0, 0, 0, 0.4)";
|
ctx.fillStyle = "rgba(0, 0, 0, 0.4)";
|
||||||
const xOff = mech.pos.x - mech.radius * mech.fieldEnergyMax
|
const xOff = mech.pos.x - mech.radius * mech.fieldEnergyMax
|
||||||
const yOff = mech.pos.y - 50
|
const yOff = mech.pos.y - 50
|
||||||
ctx.fillRect(xOff, yOff, range * mech.fieldEnergyMax, 10);
|
ctx.fillRect(xOff, yOff, range * mech.fieldEnergyMax, 10);
|
||||||
ctx.fillStyle = "#0cf";
|
ctx.fillStyle = "#0cf";
|
||||||
ctx.fillRect(xOff, yOff, range * mech.fieldMeter, 10);
|
ctx.fillRect(xOff, yOff, range * mech.energy, 10);
|
||||||
}
|
}
|
||||||
// else {
|
// else {
|
||||||
// mech.fieldMeter = mech.fieldEnergyMax
|
// mech.energy = mech.fieldEnergyMax
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
lookingAt(who) {
|
lookingAt(who) {
|
||||||
@@ -775,8 +774,8 @@ const mech = {
|
|||||||
},
|
},
|
||||||
holding() {
|
holding() {
|
||||||
if (mech.holdingTarget) {
|
if (mech.holdingTarget) {
|
||||||
mech.fieldMeter -= mech.fieldRegen;
|
mech.energy -= mech.fieldRegen;
|
||||||
if (mech.fieldMeter < 0) mech.fieldMeter = 0;
|
if (mech.energy < 0) mech.energy = 0;
|
||||||
Matter.Body.setPosition(mech.holdingTarget, {
|
Matter.Body.setPosition(mech.holdingTarget, {
|
||||||
x: mech.pos.x + 70 * Math.cos(mech.angle),
|
x: mech.pos.x + 70 * Math.cos(mech.angle),
|
||||||
y: mech.pos.y + 70 * Math.sin(mech.angle)
|
y: mech.pos.y + 70 * Math.sin(mech.angle)
|
||||||
@@ -790,8 +789,8 @@ const mech = {
|
|||||||
throwBlock() {
|
throwBlock() {
|
||||||
if (mech.holdingTarget) {
|
if (mech.holdingTarget) {
|
||||||
if (keys[32] || game.mouseDownRight) {
|
if (keys[32] || game.mouseDownRight) {
|
||||||
if (mech.fieldMeter > 0.0007) {
|
if (mech.energy > 0.0007) {
|
||||||
mech.fieldMeter -= 0.0007;
|
mech.energy -= 0.0007;
|
||||||
mech.throwCharge += mech.throwChargeRate;;
|
mech.throwCharge += mech.throwChargeRate;;
|
||||||
//draw charge
|
//draw charge
|
||||||
const x = mech.pos.x + 15 * Math.cos(mech.angle);
|
const x = mech.pos.x + 15 * Math.cos(mech.angle);
|
||||||
@@ -858,10 +857,10 @@ const mech = {
|
|||||||
},
|
},
|
||||||
drawField() {
|
drawField() {
|
||||||
if (mech.holdingTarget) {
|
if (mech.holdingTarget) {
|
||||||
ctx.fillStyle = "rgba(110,170,200," + (mech.fieldMeter * (0.05 + 0.05 * Math.random())) + ")";
|
ctx.fillStyle = "rgba(110,170,200," + (mech.energy * (0.05 + 0.05 * Math.random())) + ")";
|
||||||
ctx.strokeStyle = "rgba(110, 200, 235, " + (0.3 + 0.08 * Math.random()) + ")" //"#9bd" //"rgba(110, 200, 235, " + (0.5 + 0.1 * Math.random()) + ")"
|
ctx.strokeStyle = "rgba(110, 200, 235, " + (0.3 + 0.08 * Math.random()) + ")" //"#9bd" //"rgba(110, 200, 235, " + (0.5 + 0.1 * Math.random()) + ")"
|
||||||
} else {
|
} else {
|
||||||
ctx.fillStyle = "rgba(110,170,200," + (0.02 + mech.fieldMeter * (0.15 + 0.15 * Math.random())) + ")";
|
ctx.fillStyle = "rgba(110,170,200," + (0.02 + mech.energy * (0.15 + 0.15 * Math.random())) + ")";
|
||||||
ctx.strokeStyle = "rgba(110, 200, 235, " + (0.6 + 0.2 * Math.random()) + ")" //"#9bd" //"rgba(110, 200, 235, " + (0.5 + 0.1 * Math.random()) + ")"
|
ctx.strokeStyle = "rgba(110, 200, 235, " + (0.6 + 0.2 * Math.random()) + ")" //"#9bd" //"rgba(110, 200, 235, " + (0.5 + 0.1 * Math.random()) + ")"
|
||||||
}
|
}
|
||||||
// const off = 2 * Math.cos(game.cycle * 0.1)
|
// const off = 2 * Math.cos(game.cycle * 0.1)
|
||||||
@@ -911,7 +910,7 @@ const mech = {
|
|||||||
});
|
});
|
||||||
if (dist2 < 5000) { //use power up if it is close enough
|
if (dist2 < 5000) { //use power up if it is close enough
|
||||||
if (b.isModMassEnergy) {
|
if (b.isModMassEnergy) {
|
||||||
mech.fieldMeter = mech.fieldEnergyMax * 1.5;
|
mech.energy = mech.fieldEnergyMax * 1.5;
|
||||||
// mech.addHealth(0.01);
|
// mech.addHealth(0.01);
|
||||||
}
|
}
|
||||||
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
|
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
|
||||||
@@ -928,11 +927,11 @@ const mech = {
|
|||||||
},
|
},
|
||||||
pushMass(who) {
|
pushMass(who) {
|
||||||
const speed = Vector.magnitude(Vector.sub(who.velocity, player.velocity))
|
const speed = Vector.magnitude(Vector.sub(who.velocity, player.velocity))
|
||||||
const fieldBlockCost = 0.03 + Math.sqrt(who.mass) * speed * 0.003 //0.012
|
const fieldBlockCost = (0.03 + Math.sqrt(who.mass) * speed * 0.003) * mech.fieldShieldingScale;
|
||||||
if (mech.fieldMeter > fieldBlockCost * 0.2) { //shield needs at least some of the cost to block
|
if (mech.energy > fieldBlockCost * 0.2) { //shield needs at least some of the cost to block
|
||||||
mech.fieldMeter -= fieldBlockCost * mech.fieldShieldingScale;
|
mech.energy -= fieldBlockCost
|
||||||
if (mech.fieldMeter < 0) mech.fieldMeter = 0;
|
if (mech.energy < 0) mech.energy = 0;
|
||||||
if (mech.fieldMeter > mech.fieldEnergyMax) mech.fieldMeter = mech.fieldEnergyMax;
|
if (mech.energy > mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax;
|
||||||
mech.drawHold(who);
|
mech.drawHold(who);
|
||||||
mech.fieldCDcycle = mech.cycle + 10;
|
mech.fieldCDcycle = mech.cycle + 10;
|
||||||
mech.holdingTarget = null
|
mech.holdingTarget = null
|
||||||
@@ -1025,7 +1024,7 @@ const mech = {
|
|||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
lookForPickUp(range = mech.fieldRange) { //find body to pickup
|
lookForPickUp(range = mech.fieldRange) { //find body to pickup
|
||||||
mech.fieldMeter -= mech.fieldRegen;
|
mech.energy -= mech.fieldRegen;
|
||||||
const grabbing = {
|
const grabbing = {
|
||||||
targetIndex: null,
|
targetIndex: null,
|
||||||
targetRange: range,
|
targetRange: range,
|
||||||
@@ -1128,12 +1127,12 @@ const mech = {
|
|||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
mech.holding();
|
mech.holding();
|
||||||
mech.throwBlock();
|
mech.throwBlock();
|
||||||
} else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.05 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
|
} else if ((keys[32] || game.mouseDownRight && mech.energy > 0.05 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
|
||||||
mech.drawField();
|
mech.drawField();
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.lookForPickUp();
|
mech.lookForPickUp();
|
||||||
mech.pushMobsFacing();
|
mech.pushMobsFacing();
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
|
||||||
mech.pickUp();
|
mech.pickUp();
|
||||||
} else {
|
} else {
|
||||||
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
||||||
@@ -1157,8 +1156,8 @@ const mech = {
|
|||||||
mech.throwBlock();
|
mech.throwBlock();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
||||||
const DRAIN = 0.0023
|
const DRAIN = 0.0023
|
||||||
if (mech.fieldMeter > DRAIN) {
|
if (mech.energy > DRAIN) {
|
||||||
mech.fieldMeter -= DRAIN;
|
mech.energy -= DRAIN;
|
||||||
|
|
||||||
//draw field everywhere
|
//draw field everywhere
|
||||||
ctx.globalCompositeOperation = "saturation"
|
ctx.globalCompositeOperation = "saturation"
|
||||||
@@ -1196,7 +1195,7 @@ const mech = {
|
|||||||
mech.wakeCheck();
|
mech.wakeCheck();
|
||||||
mech.fieldCDcycle = mech.cycle + 120;
|
mech.fieldCDcycle = mech.cycle + 120;
|
||||||
}
|
}
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
|
||||||
mech.wakeCheck();
|
mech.wakeCheck();
|
||||||
mech.pickUp();
|
mech.pickUp();
|
||||||
} else {
|
} else {
|
||||||
@@ -1212,10 +1211,6 @@ const mech = {
|
|||||||
name: "plasma torch",
|
name: "plasma torch",
|
||||||
description: "use <strong class='color-f'>energy</strong> to emit <strong class='color-d'>damaging</strong> plasma<br><em>effective at close range</em>",
|
description: "use <strong class='color-f'>energy</strong> to emit <strong class='color-d'>damaging</strong> plasma<br><em>effective at close range</em>",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
// mech.fieldShieldingScale = 2;
|
|
||||||
// mech.fieldRange = 125;
|
|
||||||
// mech.fieldArc = 0.1 //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
|
||||||
// mech.calculateFieldThreshold(); //run after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
|
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
@@ -1223,8 +1218,8 @@ const mech = {
|
|||||||
mech.throwBlock();
|
mech.throwBlock();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
|
||||||
const DRAIN = 0.0005
|
const DRAIN = 0.0005
|
||||||
if (mech.fieldMeter > DRAIN) {
|
if (mech.energy > DRAIN) {
|
||||||
mech.fieldMeter -= DRAIN;
|
mech.energy -= DRAIN;
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.lookForPickUp();
|
mech.lookForPickUp();
|
||||||
mech.pushMobs360();
|
mech.pushMobs360();
|
||||||
@@ -1365,7 +1360,7 @@ const mech = {
|
|||||||
} else {
|
} else {
|
||||||
mech.fieldCDcycle = mech.cycle + 120; //if out of energy
|
mech.fieldCDcycle = mech.cycle + 120; //if out of energy
|
||||||
}
|
}
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
|
||||||
mech.pickUp();
|
mech.pickUp();
|
||||||
} else {
|
} else {
|
||||||
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
||||||
@@ -1391,7 +1386,7 @@ const mech = {
|
|||||||
mech.throwBlock();
|
mech.throwBlock();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
|
||||||
const DRAIN = 0.00035
|
const DRAIN = 0.00035
|
||||||
if (mech.fieldMeter > DRAIN) {
|
if (mech.energy > DRAIN) {
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.lookForPickUp();
|
mech.lookForPickUp();
|
||||||
mech.pushMobs360();
|
mech.pushMobs360();
|
||||||
@@ -1414,13 +1409,13 @@ const mech = {
|
|||||||
zeroG(powerUp, this.fieldDrawRadius, 0.7);
|
zeroG(powerUp, this.fieldDrawRadius, 0.7);
|
||||||
zeroG(body, this.fieldDrawRadius, 0.7);
|
zeroG(body, this.fieldDrawRadius, 0.7);
|
||||||
} else if (keys[87] || keys[38]) { //up
|
} else if (keys[87] || keys[38]) { //up
|
||||||
mech.fieldMeter -= 5 * DRAIN;
|
mech.energy -= 5 * DRAIN;
|
||||||
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 850 * 0.03;
|
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 850 * 0.03;
|
||||||
player.force.y -= 1.45 * player.mass * mech.gravity;
|
player.force.y -= 1.45 * player.mass * mech.gravity;
|
||||||
zeroG(powerUp, this.fieldDrawRadius, 1.38);
|
zeroG(powerUp, this.fieldDrawRadius, 1.38);
|
||||||
zeroG(body, this.fieldDrawRadius, 1.38);
|
zeroG(body, this.fieldDrawRadius, 1.38);
|
||||||
} else {
|
} else {
|
||||||
mech.fieldMeter -= DRAIN;
|
mech.energy -= DRAIN;
|
||||||
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 650 * 0.03;
|
this.fieldDrawRadius = this.fieldDrawRadius * 0.97 + 650 * 0.03;
|
||||||
player.force.y -= 1.07 * player.mass * mech.gravity; // slow upward drift
|
player.force.y -= 1.07 * player.mass * mech.gravity; // slow upward drift
|
||||||
zeroG(powerUp, this.fieldDrawRadius);
|
zeroG(powerUp, this.fieldDrawRadius);
|
||||||
@@ -1451,7 +1446,7 @@ const mech = {
|
|||||||
//trigger cool down
|
//trigger cool down
|
||||||
mech.fieldCDcycle = mech.cycle + 120;
|
mech.fieldCDcycle = mech.cycle + 120;
|
||||||
}
|
}
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
|
||||||
mech.pickUp();
|
mech.pickUp();
|
||||||
this.fieldDrawRadius = 0
|
this.fieldDrawRadius = 0
|
||||||
} else {
|
} else {
|
||||||
@@ -1466,15 +1461,12 @@ const mech = {
|
|||||||
name: "standing wave harmonics",
|
name: "standing wave harmonics",
|
||||||
description: "three oscillating <strong>shields</strong> are permanently active<br><strong class='color-f'>energy</strong> regenerates while field is active",
|
description: "three oscillating <strong>shields</strong> are permanently active<br><strong class='color-f'>energy</strong> regenerates while field is active",
|
||||||
effect: () => {
|
effect: () => {
|
||||||
// mech.fieldRegen *= 0.6;
|
|
||||||
mech.fieldShieldingScale = 1.33;
|
|
||||||
|
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.isHolding) {
|
if (mech.isHolding) {
|
||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
mech.holding();
|
mech.holding();
|
||||||
mech.throwBlock();
|
mech.throwBlock();
|
||||||
} else if (((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0)) { //not hold but field button is pressed
|
} else if (((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle && mech.energy > 0)) { //not hold but field button is pressed
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.lookForPickUp();
|
mech.lookForPickUp();
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle) { //holding, but field button is released
|
||||||
@@ -1482,12 +1474,12 @@ const mech = {
|
|||||||
} else {
|
} else {
|
||||||
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
||||||
}
|
}
|
||||||
if (mech.fieldMeter > 0.1 && mech.fieldCDcycle < mech.cycle) {
|
if (mech.energy > 0.1 && mech.fieldCDcycle < mech.cycle) {
|
||||||
const fieldRange1 = (0.55 + 0.35 * Math.sin(mech.cycle / 23)) * mech.fieldRange
|
const fieldRange1 = (0.55 + 0.35 * Math.sin(mech.cycle / 23)) * mech.fieldRange
|
||||||
const fieldRange2 = (0.5 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange
|
const fieldRange2 = (0.5 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange
|
||||||
const fieldRange3 = (0.45 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange
|
const fieldRange3 = (0.45 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange
|
||||||
const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3)
|
const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3)
|
||||||
ctx.fillStyle = "rgba(110,170,200," + (0.04 + mech.fieldMeter * (0.12 + 0.13 * Math.random())) + ")";
|
ctx.fillStyle = "rgba(110,170,200," + (0.04 + mech.energy * (0.12 + 0.13 * Math.random())) + ")";
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mech.pos.x, mech.pos.y, fieldRange1, 0, 2 * Math.PI);
|
ctx.arc(mech.pos.x, mech.pos.y, fieldRange1, 0, 2 * Math.PI);
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
@@ -1510,16 +1502,16 @@ const mech = {
|
|||||||
effect: () => {
|
effect: () => {
|
||||||
mech.fieldRegen *= 2;
|
mech.fieldRegen *= 2;
|
||||||
mech.hold = function () {
|
mech.hold = function () {
|
||||||
if (mech.fieldMeter > mech.fieldEnergyMax - 0.02 && mech.fieldCDcycle < mech.cycle) {
|
if (mech.energy > mech.fieldEnergyMax - 0.02 && mech.fieldCDcycle < mech.cycle) {
|
||||||
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
|
||||||
if (b.isModSporeField) {
|
if (b.isModSporeField) {
|
||||||
const len = Math.floor(6 + 3 * Math.random())
|
const len = Math.floor(6 + 3 * Math.random())
|
||||||
mech.fieldMeter -= len * 0.12;
|
mech.energy -= len * 0.12;
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
b.spore(player)
|
b.spore(player)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mech.fieldMeter -= 0.33;
|
mech.energy -= 0.33;
|
||||||
b.drone(1)
|
b.drone(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1528,12 +1520,12 @@ const mech = {
|
|||||||
mech.drawHold(mech.holdingTarget);
|
mech.drawHold(mech.holdingTarget);
|
||||||
mech.holding();
|
mech.holding();
|
||||||
mech.throwBlock();
|
mech.throwBlock();
|
||||||
} else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.1 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
|
} else if ((keys[32] || game.mouseDownRight && mech.energy > 0.1 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
|
||||||
mech.drawField();
|
mech.drawField();
|
||||||
mech.grabPowerUp();
|
mech.grabPowerUp();
|
||||||
mech.lookForPickUp();
|
mech.lookForPickUp();
|
||||||
mech.pushMobsFacing();
|
mech.pushMobsFacing();
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
|
||||||
mech.pickUp();
|
mech.pickUp();
|
||||||
} else {
|
} else {
|
||||||
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
||||||
@@ -1556,8 +1548,8 @@ const mech = {
|
|||||||
mech.throwBlock();
|
mech.throwBlock();
|
||||||
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
||||||
const DRAIN = 0.00015 + 0.00027 * player.speed
|
const DRAIN = 0.00015 + 0.00027 * player.speed
|
||||||
if (mech.fieldMeter > DRAIN) {
|
if (mech.energy > DRAIN) {
|
||||||
mech.fieldMeter -= DRAIN;
|
mech.energy -= DRAIN;
|
||||||
|
|
||||||
mech.isStealth = true //isStealth disables most uses of foundPlayer()
|
mech.isStealth = true //isStealth disables most uses of foundPlayer()
|
||||||
player.collisionFilter.mask = cat.map
|
player.collisionFilter.mask = cat.map
|
||||||
@@ -1565,7 +1557,7 @@ const mech = {
|
|||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(mech.pos.x, mech.pos.y, mech.fieldRange, 0, 2 * Math.PI);
|
ctx.arc(mech.pos.x, mech.pos.y, mech.fieldRange, 0, 2 * Math.PI);
|
||||||
ctx.globalCompositeOperation = "destination-in"; //in or atop
|
ctx.globalCompositeOperation = "destination-in"; //in or atop
|
||||||
ctx.fillStyle = `rgba(255,255,255,${mech.fieldMeter*0.5})`;
|
ctx.fillStyle = `rgba(255,255,255,${mech.energy*0.5})`;
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
ctx.globalCompositeOperation = "source-over";
|
ctx.globalCompositeOperation = "source-over";
|
||||||
ctx.strokeStyle = "#000"
|
ctx.strokeStyle = "#000"
|
||||||
@@ -1577,7 +1569,7 @@ const mech = {
|
|||||||
} else {
|
} else {
|
||||||
mech.fieldCDcycle = mech.cycle + 120;
|
mech.fieldCDcycle = mech.cycle + 120;
|
||||||
}
|
}
|
||||||
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
} else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
|
||||||
mech.pickUp();
|
mech.pickUp();
|
||||||
} else {
|
} else {
|
||||||
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
|
||||||
@@ -1605,8 +1597,8 @@ const mech = {
|
|||||||
// mech.throwBlock();
|
// mech.throwBlock();
|
||||||
// } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
// } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
|
||||||
// const DRAIN = 0.0005
|
// const DRAIN = 0.0005
|
||||||
// if (mech.fieldMeter > DRAIN) {
|
// if (mech.energy > DRAIN) {
|
||||||
// mech.fieldMeter -= DRAIN;
|
// mech.energy -= DRAIN;
|
||||||
|
|
||||||
// //try to hack a mob
|
// //try to hack a mob
|
||||||
// for (let i = 0, len = mob.length; i < len; ++i) {
|
// for (let i = 0, len = mob.length; i < len; ++i) {
|
||||||
@@ -1616,7 +1608,7 @@ const mech = {
|
|||||||
// Matter.Query.ray(map, mob[i].position, this.pos).length === 0
|
// Matter.Query.ray(map, mob[i].position, this.pos).length === 0
|
||||||
// ) {
|
// ) {
|
||||||
// if (mech.hackProgress > 180) { //hack the mob
|
// if (mech.hackProgress > 180) { //hack the mob
|
||||||
// mech.fieldMeter = 0;
|
// mech.energy = 0;
|
||||||
// mob[i].hackedTarget = null;
|
// mob[i].hackedTarget = null;
|
||||||
// mob[i].seePlayerFreq = Math.round((30 + 30 * Math.random()) * game.lookFreqScale)
|
// mob[i].seePlayerFreq = Math.round((30 + 30 * Math.random()) * game.lookFreqScale)
|
||||||
// mob[i].do = function () {
|
// mob[i].do = function () {
|
||||||
@@ -1645,7 +1637,7 @@ const mech = {
|
|||||||
// mech.hackProgress = 0
|
// mech.hackProgress = 0
|
||||||
// mech.fieldCDcycle = mech.cycle + 120;
|
// mech.fieldCDcycle = mech.cycle + 120;
|
||||||
// }
|
// }
|
||||||
// } else if (mech.holdingTarget && mech.fireCDcycle < mech.cycle && mech.fieldMeter > 0.05) { //holding, but field button is released
|
// } else if (mech.holdingTarget && mech.fireCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
|
||||||
// mech.pickUp();
|
// mech.pickUp();
|
||||||
// mech.hackProgress = 0
|
// mech.hackProgress = 0
|
||||||
// } else {
|
// } else {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ const powerUps = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (target.ammo === Infinity) {
|
if (target.ammo === Infinity) {
|
||||||
mech.fieldMeter = mech.fieldEnergyMax;
|
mech.energy = mech.fieldEnergyMax;
|
||||||
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:115%;'><span class='color-f'>+energy</span></span>", 300);
|
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:115%;'><span class='color-f'>+energy</span></span>", 300);
|
||||||
} else {
|
} else {
|
||||||
let ammo = Math.ceil((target.ammoPack * (1 + 0.1 * Math.random())));
|
let ammo = Math.ceil((target.ammoPack * (1 + 0.1 * Math.random())));
|
||||||
@@ -87,7 +87,7 @@ const powerUps = {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// target = b.guns[Math.floor(Math.random() * b.guns.length)]; //if you don't have any guns just add ammo to a random gun you don't have yet
|
// target = b.guns[Math.floor(Math.random() * b.guns.length)]; //if you don't have any guns just add ammo to a random gun you don't have yet
|
||||||
mech.fieldMeter = mech.fieldEnergyMax;
|
mech.energy = mech.fieldEnergyMax;
|
||||||
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:115%;'><span class='color-f'>+energy</span></span>", 300);
|
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:115%;'><span class='color-f'>+energy</span></span>", 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -504,8 +504,8 @@ const spawn = {
|
|||||||
|
|
||||||
//when player is inside event horizon
|
//when player is inside event horizon
|
||||||
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
||||||
if (mech.fieldMeter > 0.1) {
|
if (mech.energy > 0.1) {
|
||||||
mech.fieldMeter -= 0.005
|
mech.energy -= 0.005
|
||||||
} else {
|
} else {
|
||||||
mech.damage(0.0002 * game.dmgScale);
|
mech.damage(0.0002 * game.dmgScale);
|
||||||
}
|
}
|
||||||
@@ -602,8 +602,8 @@ const spawn = {
|
|||||||
ctx.fill();
|
ctx.fill();
|
||||||
//when player is inside event horizon
|
//when player is inside event horizon
|
||||||
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
|
||||||
if (mech.fieldMeter > 0.1) {
|
if (mech.energy > 0.1) {
|
||||||
mech.fieldMeter -= 0.0075
|
mech.energy -= 0.0075
|
||||||
} else {
|
} else {
|
||||||
mech.damage(0.0003 * game.dmgScale);
|
mech.damage(0.0003 * game.dmgScale);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user