explosions balance, added pulse gun, harmonic field balance

This commit is contained in:
landgreen
2019-12-21 10:01:38 -08:00
parent a3fa842d53
commit f48cd896f2
5 changed files with 718 additions and 508 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -14,8 +14,8 @@ const level = {
start() { start() {
if (level.levelsCleared === 0) { if (level.levelsCleared === 0) {
// game.difficulty = 6; //for testing to simulate possible mobs spawns // game.difficulty = 6; //for testing to simulate possible mobs spawns
// b.giveGuns(7) b.giveGuns(15)
// mech.fieldUpgrades[1].effect(); // mech.fieldUpgrades[2].effect();
// b.giveMod(21) // b.giveMod(21)
this.intro(); //starting level this.intro(); //starting level
@@ -109,10 +109,7 @@ const level = {
// powerUps.spawn(450, -400, "mod", false, 6); // powerUps.spawn(450, -400, "mod", false, 6);
// powerUps.spawn(450, -400, "mod", false); // powerUps.spawn(450, -400, "mod", false);
// spawn.bodyRect(-45, -100, 40, 50); // spawn.bodyRect(-45, -100, 40, 50);
spawn.starter(800, -1050); spawn.shooter(800, -1050);
spawn.starter(800, -1050);
spawn.starter(800, -1050);
spawn.starter(800, -1050);
// spawn.groupBoss(-600, -550); // spawn.groupBoss(-600, -550);
// spawn.hopper(800, -150); // spawn.hopper(800, -150);
// spawn.beamer(800, -150); // spawn.beamer(800, -150);

View File

@@ -268,12 +268,7 @@ const mobs = {
ctx.setLineDash([125 * Math.random(), 125 * Math.random()]); ctx.setLineDash([125 * Math.random(), 125 * Math.random()]);
// 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) {
//if (Math.random()>0.2 && this.seePlayer.yes && this.distanceToPlayer2()<800000) {
if (b.isModTempResist) {
mech.damage(0.00006 * game.dmgScale);
} else {
mech.damage(0.0003 * game.dmgScale); mech.damage(0.0003 * game.dmgScale);
}
if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.004 if (mech.fieldMeter > 0.1) mech.fieldMeter -= 0.004
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); ctx.moveTo(this.position.x, this.position.y);
@@ -361,12 +356,7 @@ const mobs = {
if (!mech.isStealth) vertexCollision(this.position, look, [player]); if (!mech.isStealth) vertexCollision(this.position, look, [player]);
// hitting player // hitting player
if (best.who === player) { if (best.who === player) {
if (b.isModTempResist) {
dmg = 0.0004 * game.dmgScale;
} else {
dmg = 0.002 * game.dmgScale; dmg = 0.002 * game.dmgScale;
}
mech.damage(dmg); mech.damage(dmg);
//draw damage //draw damage
ctx.fillStyle = color; ctx.fillStyle = color;
@@ -915,8 +905,8 @@ const mobs = {
const angle = Math.atan2(unitVector.y, unitVector.x); const angle = Math.atan2(unitVector.y, unitVector.x);
Matter.Body.setAngle(this, angle - Math.PI); Matter.Body.setAngle(this, angle - Math.PI);
}, },
explode() { explode(mass = this.mass) {
mech.damage(Math.min(Math.max(0.02 * Math.sqrt(this.mass), 0.01), 0.35) * game.dmgScale); mech.damage(Math.min(Math.max(0.02 * Math.sqrt(mass), 0.01), 0.35) * game.dmgScale);
this.dropPowerUp = false; this.dropPowerUp = false;
this.death(); //death with no power up or body this.death(); //death with no power up or body
}, },

View File

@@ -458,7 +458,7 @@ const mech = {
if (b.isModDroneOnDamage) { if (b.isModDroneOnDamage) {
const len = (dmg - 0.08 + 0.05 * Math.random()) / 0.05 const len = (dmg - 0.08 + 0.05 * Math.random()) / 0.05
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
if (Math.random() < 0.6) b.guns[13].fire() //spawn drone if (Math.random() < 0.6) b.drone() //spawn drone
} }
} }
@@ -886,20 +886,20 @@ const mech = {
mech.holdingTarget = null mech.holdingTarget = null
//knock backs //knock backs
const unit = Matter.Vector.normalise(Matter.Vector.sub(player.position, who.position)) const unit = Matter.Vector.normalise(Matter.Vector.sub(player.position, who.position))
const mass = Math.min(Math.sqrt(who.mass), 3.5); //large masses above 4*4 can start to overcome the push back const massRoot = Math.sqrt(Math.min(12, Math.max(0.15, who.mass))); // masses above 12 can start to overcome the push back
Matter.Body.setVelocity(who, { Matter.Body.setVelocity(who, {
x: player.velocity.x - (15 * unit.x) / mass, x: player.velocity.x - (15 * unit.x) / massRoot,
y: player.velocity.y - (15 * unit.y) / mass y: player.velocity.y - (15 * unit.y) / massRoot
}); });
if (mech.crouch) { if (mech.crouch) {
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x + 0.4 * unit.x * mass, x: player.velocity.x + 0.4 * unit.x * massRoot,
y: player.velocity.y + 0.4 * unit.y * mass y: player.velocity.y + 0.4 * unit.y * massRoot
}); });
} else { } else {
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x + 5 * unit.x * mass, x: player.velocity.x + 5 * unit.x * massRoot,
y: player.velocity.y + 5 * unit.y * mass y: player.velocity.y + 5 * unit.y * massRoot
}); });
} }
@@ -1086,7 +1086,7 @@ const mech = {
mech.holding(); mech.holding();
mech.throw(); mech.throw();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
const DRAIN = 0.0027 const DRAIN = 0.0023
if (mech.fieldMeter > DRAIN) { if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN; mech.fieldMeter -= DRAIN;
@@ -1140,7 +1140,7 @@ 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><strong>decreased</strong> <strong>shield</strong> range and efficiency", 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.fieldMode = 2; mech.fieldMode = 2;
mech.fieldText(); mech.fieldText();
@@ -1289,10 +1289,16 @@ const mech = {
} }
ctx.lineWidth = 2 * Math.random(); ctx.lineWidth = 2 * Math.random();
ctx.stroke(); ctx.stroke();
//draw shield around player
const pushRange = 110;
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, pushRange, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(255,0,255,0.05)"
ctx.fill();
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
mech.pushMobs360(110); mech.pushMobs360(pushRange);
// mech.pushBody360(100); //disabled because doesn't work at short range // mech.pushBody360(100); //disabled because doesn't work at short range
} else { } else {
mech.fieldCDcycle = mech.cycle + 120; //if out of energy mech.fieldCDcycle = mech.cycle + 120; //if out of energy
@@ -1395,13 +1401,13 @@ const mech = {
}, },
{ {
name: "standing wave harmonics", name: "standing wave harmonics",
description: "oscillating <strong>shields</strong> surround you <strong>constantly</strong><br> <strong>decreased</strong> <strong class='color-f'>energy</strong> regeneration", description: "three oscillating <strong>shields</strong> are perminantly active<br><strong class='color-f'>energy</strong> regenerates at normal rate",
effect: () => { effect: () => {
mech.fieldMode = 4; mech.fieldMode = 4;
mech.fieldText(); mech.fieldText();
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.fieldRegen *= 0.6; // mech.fieldRegen *= 0.6;
mech.fieldShieldingScale = 1.5; mech.fieldShieldingScale = 1.33;
mech.hold = function () { mech.hold = function () {
if (mech.isHolding) { if (mech.isHolding) {
@@ -1440,17 +1446,16 @@ const mech = {
}, },
{ {
name: "nano-scale manufacturing", name: "nano-scale manufacturing",
description: "excess <strong class='color-f'>energy</strong> used to build <strong>drones</strong><br><strong>3x</strong> <strong class='color-f'>energy</strong> regeneration", description: "excess <strong class='color-f'>energy</strong> used to build <strong>drones</strong><br><strong>2x</strong> <strong class='color-f'>energy</strong> regeneration",
effect: () => { effect: () => {
let gunIndex = 13 //Math.random() < 0.5 ? 13 : 14
mech.fieldMode = 5; mech.fieldMode = 5;
mech.fieldText(); mech.fieldText();
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.fieldRegen *= 3; mech.fieldRegen *= 2;
mech.hold = function () { mech.hold = function () {
if (mech.fieldMeter > mech.fieldEnergyMax - 0.02) { if (mech.fieldMeter > mech.fieldEnergyMax - 0.02) {
mech.fieldMeter -= 0.43; mech.fieldMeter -= 0.32;
b.guns[gunIndex].fire() //spawn drone b.drone(1)
mech.fireCDcycle = mech.cycle + 25; // set fire cool down to prevent +energy from making huge numbers of drones mech.fireCDcycle = mech.cycle + 25; // set fire cool down to prevent +energy from making huge numbers of drones
} }
if (mech.isHolding) { if (mech.isHolding) {

View File

@@ -900,9 +900,9 @@ const spawn = {
let me = mob[mob.length - 1]; let me = mob[mob.length - 1];
me.stroke = "transparent"; me.stroke = "transparent";
me.onHit = function () { me.onHit = function () {
this.explode(); this.explode(this.mass * 10);
}; };
Matter.Body.setDensity(me, 0.001); //normal is 0.001 Matter.Body.setDensity(me, 0.0001); //normal is 0.001
me.timeLeft = 240; me.timeLeft = 240;
me.g = 0.001; //required if using 'gravity' me.g = 0.001; //required if using 'gravity'
me.frictionAir = 0; me.frictionAir = 0;