diff --git a/js/bullets.js b/js/bullets.js
index 41199cb..3a33672 100644
--- a/js/bullets.js
+++ b/js/bullets.js
@@ -239,7 +239,7 @@ const b = {
},
{
name: "mass driver",
- description: "blocks do 3x more damage to mobs
charge block throws in 3x less time",
+ description: "objects do 3x more damage to mobs
charge throws in 3x less time",
maxCount: 1,
count: 0,
allowed() {
@@ -1099,13 +1099,13 @@ const b = {
},
{
name: "bremsstrahlung radiation",
- description: "blocking with standing wave harmonics
damages the blocked mob ",
+ description: "blocking with your field does damage",
maxCount: 9,
count: 0,
allowed() {
- return mech.fieldUpgrades[mech.fieldMode].name === "standing wave harmonics"
+ return mech.fieldUpgrades[mech.fieldMode].name === "standing wave harmonics" || mech.fieldUpgrades[mech.fieldMode].name === "diamagnetic field"
},
- requires: "standing wave harmonics",
+ requires: "standing wave harmonics
or diamagnetic field",
effect() {
b.modBlockDmg += 0.6 //if you change this value also update the for loop in the electricity graphics in mech.pushMass
},
@@ -1131,24 +1131,6 @@ const b = {
mech.fieldShieldingScale = 1;
}
},
- {
- name: "perfect diamagnetism",
- description: "you don't lose energy when blocking
with nano-scale manufacturing",
- maxCount: 1,
- count: 0,
- allowed() {
- return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing"
- },
- requires: "nano-scale manufacturing",
- effect() {
- b.modFieldEfficiency = 0
- mech.fieldShieldingScale = b.modFieldEfficiency;
- },
- remove() {
- b.modFieldEfficiency = 1;
- if (mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing") mech.fieldShieldingScale = b.modFieldEfficiency;
- }
- },
{
name: "mycelium manufacturing",
description: "nano-scale manufacturing is repurposed
excess energy used to grow spores",
diff --git a/js/level.js b/js/level.js
index 5d890f8..9e7aa09 100644
--- a/js/level.js
+++ b/js/level.js
@@ -15,7 +15,7 @@ const level = {
if (level.levelsCleared === 0) {
// level.difficultyIncrease(9)
// b.giveGuns("mine")
- // mech.setField("negative mass field")
+ mech.setField("perfect diamagnetism")
// b.giveMod("irradiated needles");
// b.giveMod("reflective cavity");
diff --git a/js/player.js b/js/player.js
index b926ef6..59283b1 100644
--- a/js/player.js
+++ b/js/player.js
@@ -666,7 +666,7 @@ const mech = {
fieldEnergyMax: 1, //can be increased by a mod
holdingTarget: null,
fieldShieldingScale: 1,
- fieldRange: 175,
+ fieldRange: 155,
// these values are set on reset by setHoldDefaults()
energy: 0,
fieldRegen: 0,
@@ -866,7 +866,7 @@ const mech = {
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 range = mech.fieldRange - 20;
+ const range = mech.fieldRange;
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - Math.PI * mech.fieldArc, mech.angle + Math.PI * mech.fieldArc, false);
ctx.lineWidth = 2;
@@ -895,6 +895,34 @@ const mech = {
ctx.lineWidth = 1;
ctx.stroke();
},
+ drawDiamagneticField(wave) {
+ if (mech.holdingTarget) {
+ ctx.fillStyle = "rgba(110,170,200," + (0.06 + 0.03 * Math.random()) + ")";
+ ctx.strokeStyle = "rgba(110, 200, 235, " + (0.35 + 0.05 * Math.random()) + ")" //"#9bd" //"rgba(110, 200, 235, " + (0.5 + 0.1 * Math.random()) + ")"
+ } else {
+ ctx.fillStyle = "rgba(110,170,200," + (0.20 + 0.07 * Math.random() - 0.07 * wave) + ")";
+ ctx.strokeStyle = "rgba(110, 200, 235, " + (0.3 + 0.5 * Math.random()) + ")" //"#9bd" //"rgba(110, 200, 235, " + (0.5 + 0.1 * Math.random()) + ")"
+ }
+ // const off = 2 * Math.cos(game.cycle * 0.1)
+ const range = mech.fieldRange;
+ ctx.beginPath();
+ ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - Math.PI * mech.fieldArc, mech.angle + Math.PI * mech.fieldArc, false);
+ ctx.lineWidth = 2.5 - 1.5 * wave;
+ ctx.lineCap = "butt"
+ ctx.stroke();
+ let eye = 13;
+ const curve = 0.6 + 0.08 * wave
+ let aMag = (1 - curve) * Math.PI * mech.fieldArc
+ let a = mech.angle + aMag
+ let cp1x = mech.pos.x + curve * range * Math.cos(a)
+ let cp1y = mech.pos.y + curve * range * Math.sin(a)
+ ctx.quadraticCurveTo(cp1x, cp1y, mech.pos.x + eye * Math.cos(mech.angle), mech.pos.y + eye * Math.sin(mech.angle))
+ a = mech.angle - aMag
+ cp1x = mech.pos.x + curve * range * Math.cos(a)
+ cp1y = mech.pos.y + curve * range * Math.sin(a)
+ ctx.quadraticCurveTo(cp1x, cp1y, mech.pos.x + 1 * range * Math.cos(mech.angle - Math.PI * mech.fieldArc), mech.pos.y + 1 * range * Math.sin(mech.angle - Math.PI * mech.fieldArc))
+ ctx.fill();
+ },
grabPowerUp() { //look for power ups to grab with field
const grabPowerUpRange2 = 156000 //(mech.fieldRange + 220) * (mech.fieldRange + 220)
for (let i = 0, len = powerUp.length; i < len; ++i) {
@@ -935,7 +963,6 @@ const mech = {
if (mech.energy < 0) mech.energy = 0;
if (mech.energy > mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax;
mech.drawHold(who);
- mech.fieldCDcycle = mech.cycle + 10;
mech.holdingTarget = null
const unit = Vector.normalise(Vector.sub(player.position, who.position))
if (b.modBlockDmg) {
@@ -958,29 +985,38 @@ const mech = {
ctx.stroke();
}
//knock backs
- 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, {
- x: player.velocity.x - (15 * unit.x) / massRoot,
- y: player.velocity.y - (15 * unit.y) / massRoot
- });
- if (mech.crouch) {
- Matter.Body.setVelocity(player, {
- x: player.velocity.x + 0.4 * unit.x * massRoot,
- y: player.velocity.y + 0.4 * unit.y * massRoot
+ if (mech.fieldShieldingScale > 0) {
+ 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, {
+ x: player.velocity.x - (15 * unit.x) / massRoot,
+ y: player.velocity.y - (15 * unit.y) / massRoot
});
+ mech.fieldCDcycle = mech.cycle + 10;
+ if (mech.crouch) {
+ Matter.Body.setVelocity(player, {
+ x: player.velocity.x + 0.4 * unit.x * massRoot,
+ y: player.velocity.y + 0.4 * unit.y * massRoot
+ });
+ } else {
+ Matter.Body.setVelocity(player, {
+ x: player.velocity.x + 5 * unit.x * massRoot,
+ y: player.velocity.y + 5 * unit.y * massRoot
+ });
+ }
} else {
- Matter.Body.setVelocity(player, {
- x: player.velocity.x + 5 * unit.x * massRoot,
- y: player.velocity.y + 5 * unit.y * massRoot
+ const massRoot = Math.sqrt(Math.max(0.15, who.mass)); // masses above 12 can start to overcome the push back
+ Matter.Body.setVelocity(who, {
+ x: player.velocity.x - (15 * unit.x) / massRoot,
+ y: player.velocity.y - (15 * unit.y) / massRoot
});
}
-
}
},
pushMobsFacing() { // find mobs in range and in direction looking
+
for (let i = 0, len = mob.length; i < len; ++i) {
if (
- Vector.magnitude(Vector.sub(mob[i].position, player.position)) < mech.fieldRange &&
+ Vector.magnitude(Vector.sub(mob[i].position, player.position)) - mob[i].radius < mech.fieldRange &&
mech.lookingAt(mob[i]) &&
Matter.Query.ray(map, mob[i].position, mech.pos).length === 0
) {
@@ -1119,7 +1155,7 @@ const mech = {
},
fieldUpgrades: [{
name: "field emitter",
- description: "use energy to shield yourself from damage
lets you pick up and throw objects",
+ description: "use energy to shield yourself from damage
pick up and throw objects",
isEasyToAim: false,
effect: () => {
game.replaceTextLog = true; //allow text over write
@@ -1142,6 +1178,38 @@ const mech = {
}
}
},
+ {
+ name: "perfect diamagnetism",
+ // description: "gain energy when blocking
no recoil when blocking",
+ description: "blocking produces energy
blocking has no recoil or cool down",
+ isEasyToAim: false,
+ effect: () => {
+ mech.fieldShieldingScale = -2;
+ // mech.fieldArc = 0.3; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
+ // mech.calculateFieldThreshold();
+ mech.hold = function () {
+ const wave = Math.sin(mech.cycle * 0.025);
+ mech.fieldRange = 165 + 10 * wave
+ mech.fieldArc = 0.31 + 0.03 * wave //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
+ mech.calculateFieldThreshold();
+ if (mech.isHolding) {
+ mech.drawHold(mech.holdingTarget);
+ mech.holding();
+ mech.throwBlock();
+ } else if ((keys[32] || game.mouseDownRight && mech.energy > 0.05 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
+ mech.drawDiamagneticField(wave);
+ mech.grabPowerUp();
+ mech.lookForPickUp();
+ mech.pushMobsFacing();
+ } else if (mech.holdingTarget && mech.fieldCDcycle < mech.cycle && mech.energy > 0.05) { //holding, but field button is released
+ mech.pickUp();
+ } 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.drawFieldMeter()
+ }
+ }
+ },
{
name: "time dilation field",
description: "use energy to stop time
can fire bullets while field is active",
@@ -1375,7 +1443,7 @@ const mech = {
},
{
name: "negative mass field",
- description: "use energy to nullify gravity
and reduce harm by 66%", //
launch larger blocks at much higher speeds
+ description: "use energy to nullify gravity
reduce harm by 66% while field is active", //
launch larger blocks at much higher speeds
fieldDrawRadius: 0,
isEasyToAim: true,
effect: () => {
diff --git a/todo.txt b/todo.txt
index 7019ba4..24eb62b 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,6 +1,11 @@
************** TODO - n-gon **************
+field - the basic field emitter, but no energy loss and no knock back on blocks
+ this field should make blocking a viable strategy
+ gain energy on blocking?
+ call it diamagnetic field and remove the diamagnetism mod?
+
mod - nails do poison damage
mod - increase laser bot range, and reduce energy drain