diff --git a/js/bullets.js b/js/bullets.js
index 922f550..85b1cd5 100644
--- a/js/bullets.js
+++ b/js/bullets.js
@@ -29,7 +29,7 @@ const b = {
isModFarAwayDmg: null,
isModEntanglement: null,
isModMassEnergy: null,
- isModFourOptions: null,
+ isModExtraChoice: null,
modLaserBotCount: null,
modNailBotCount: null,
modCollisionImmuneCycles: null,
@@ -48,7 +48,7 @@ const b = {
isModEnergyRecovery: null,
isModHealthRecovery: null,
isModEnergyLoss: null,
- isModFoamShieldHit: null,
+ isModFoamShieldSKip: null,
isModDeathAvoid: null,
isModDeathAvoidOnCD: null,
modWaveSpeedMap: null,
@@ -577,11 +577,13 @@ const b = {
b.modOnHealthChange();
mech.displayHealth();
document.getElementById("health-bg").style.display = "none"
+ document.getElementById("dmg").style.backgroundColor = "#0cf";
b.isModEnergyHealth = true;
},
remove() {
b.isModEnergyHealth = false;
document.getElementById("health-bg").style.display = "inline"
+ document.getElementById("dmg").style.backgroundColor = "#f67";
mech.health = mech.energy;
}
},
@@ -596,7 +598,7 @@ const b = {
requires: "not mass-energy equivalence",
effect() {
b.isModPiezo = true;
- mech.energy = mech.fieldEnergyMax;
+ mech.energy = mech.maxEnergy;
},
remove() {
b.isModPiezo = false;
@@ -631,7 +633,7 @@ const b = {
requires: "",
effect() {
b.modEnergySiphon += 0.15;
- mech.energy = mech.fieldEnergyMax
+ mech.energy = mech.maxEnergy
},
remove() {
b.modEnergySiphon = 0;
@@ -663,11 +665,11 @@ const b = {
},
requires: "",
effect() {
- mech.fieldEnergyMax += 0.5
+ mech.maxEnergy += 0.5
mech.energy += 0.5
},
remove() {
- mech.fieldEnergyMax = 1;
+ mech.maxEnergy = 1;
}
},
{
@@ -716,7 +718,7 @@ const b = {
requires: "",
effect: () => {
b.isModMassEnergy = true // used in mech.grabPowerUp
- mech.energy = mech.fieldEnergyMax * 2
+ mech.energy = mech.maxEnergy * 2
},
remove() {
b.isModMassEnergy = false;
@@ -724,7 +726,7 @@ const b = {
},
{
name: "Bayesian inference",
- description: "20% chance for double power ups to drop
one fewer choice when selecting power ups",
+ description: "33% chance for double power ups to drop
only one choice when selecting power ups",
maxCount: 1,
count: 0,
allowed() {
@@ -732,7 +734,7 @@ const b = {
},
requires: "",
effect: () => {
- b.isModBayesian = 0.20;
+ b.isModBayesian = 0.33;
},
remove() {
b.isModBayesian = 0;
@@ -748,10 +750,10 @@ const b = {
},
requires: "",
effect: () => {
- b.isModFourOptions = true;
+ b.isModExtraChoice = true;
},
remove() {
- b.isModFourOptions = false;
+ b.isModExtraChoice = false;
}
},
{
@@ -1288,8 +1290,8 @@ const b = {
}
},
{
- name: "quantum foam",
- description: "foam can stick to shields",
+ name: "quantum tunneling",
+ description: "foam bypasses shields to stick to mobs",
maxCount: 1,
count: 0,
allowed() {
@@ -1297,10 +1299,10 @@ const b = {
},
requires: "foam",
effect() {
- b.isModFoamShieldHit = true;
+ b.isModFoamShieldSKip = true;
},
remove() {
- b.isModFoamShieldHit = false;
+ b.isModFoamShieldSKip = false;
}
},
{
@@ -1374,7 +1376,7 @@ const b = {
{
name: "timelike world line",
description: "time dilation increases your time rate by 2x
while energy drain is decreased by 2x",
- maxCount: 9,
+ maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "time dilation field"
@@ -2092,7 +2094,7 @@ const b = {
}
}
}
- for (let i = 0; i < 16; i++) {
+ for (let i = 0; i < 14; i++) {
const speed = 53 + 10 * Math.random()
if (targets.length > 0) { // aim near a random target in array
const index = Math.floor(Math.random() * targets.length)
@@ -3092,7 +3094,7 @@ const b = {
};
if (b.isModRPG) {
- b.fireProps(25, mech.crouch ? 60 : -15, dir, me); //cd , speed
+ b.fireProps(35, mech.crouch ? 60 : -15, dir, me); //cd , speed
bullet[me].endCycle = game.cycle + 70;
bullet[me].frictionAir = 0.07;
const MAG = 0.015
@@ -3350,11 +3352,11 @@ const b = {
isStarterGun: true,
isEasyToAim: false,
fire() {
- mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 12 : 5) * b.modFireRate); // cool down
+ mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 13 : 6) * b.modFireRate); // cool down
const me = bullet.length;
const dir = mech.angle + 0.2 * (Math.random() - 0.5)
const RADIUS = (8 + 16 * Math.random())
- bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 25, RADIUS, {
+ bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, RADIUS, {
angle: dir,
density: 0.00005, // 0.001 is normal density
inertia: Infinity,
@@ -3365,7 +3367,7 @@ const b = {
classType: "bullet",
collisionFilter: {
category: cat.bullet,
- mask: cat.map | cat.body | cat.mob | cat.mobShield
+ mask: cat.mob | cat.mobShield //cat.map | cat.body | cat.mob | cat.mobShield
},
minDmgSpeed: 0,
endCycle: Infinity,
@@ -3374,7 +3376,7 @@ const b = {
target: null,
targetVertex: null,
onDmg(who) {
- if (!this.target && who.alive && (who.dropPowerUp || b.isModFoamShieldHit) && (!who.isShielded || b.isModFoamShieldHit)) {
+ if (!this.target && who.alive && who.dropPowerUp && (!who.isShielded || b.isModFoamShieldSKip)) {
this.target = who;
this.collisionFilter.category = cat.body;
this.collisionFilter.mask = null;
@@ -3399,7 +3401,23 @@ const b = {
// ctx.fill()
if (!mech.isBodiesAsleep) { //if time dilation isn't active
- this.force.y += this.mass * 0.00006; //gravity
+
+ //check for touching map
+ if (Matter.Query.collides(this, map).length > 0) {
+ const slow = 0.94
+ Matter.Body.setVelocity(this, {
+ x: this.velocity.x * slow,
+ y: this.velocity.y * slow
+ });
+ } else if (Matter.Query.collides(this, body).length > 0) {
+ const slow = 0.97
+ Matter.Body.setVelocity(this, {
+ x: this.velocity.x * slow,
+ y: this.velocity.y * slow
+ });
+ } else {
+ this.force.y += this.mass * 0.00006; //gravity
+ }
if (this.count < 17) {
this.count++
@@ -3409,7 +3427,7 @@ const b = {
this.radius *= SCALE;
} else {
//shrink
- const SCALE = 1 - 0.0035 / b.isModBulletsLastLonger
+ const SCALE = 1 - 0.0033 / b.isModBulletsLastLonger
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
if (this.radius < 14) this.endCycle = 0;
@@ -3419,12 +3437,11 @@ const b = {
Matter.Body.setPosition(this, this.target.vertices[this.targetVertex])
Matter.Body.setVelocity(this.target, Vector.mult(this.target.velocity, 0.9))
Matter.Body.setAngularVelocity(this.target, this.target.angularVelocity * 0.9)
- if (this.target.isShielded) {
- this.target.damage(b.dmgScale * 0.001);
+ if (b.isModFoamShieldSKip) {
+ this.target.damage(b.dmgScale * 0.0025, true); //shield damage bypass
} else {
this.target.damage(b.dmgScale * 0.005);
}
-
} else if (this.target !== null) { //look for a new target
this.target = null
this.collisionFilter.category = cat.bullet;
@@ -3434,7 +3451,8 @@ const b = {
}
});
World.add(engine.world, bullet[me]); //add bullet to world
- const SPEED = mech.crouch ? 22 : 12 - RADIUS * 0.25;
+ if (b.isModFoamShieldSKip) bullet[me].collisionFilter.mask = cat.mob // | cat.mobShield
+ const SPEED = (mech.crouch ? 17 : 12) - RADIUS * 0.25;
Matter.Body.setVelocity(bullet[me], {
x: SPEED * Math.cos(dir),
y: SPEED * Math.sin(dir)
diff --git a/js/engine.js b/js/engine.js
index cb46a7f..84517ac 100644
--- a/js/engine.js
+++ b/js/engine.js
@@ -162,7 +162,7 @@ function collisionChecks(event) {
mob[k].foundPlayer();
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
if (b.isModPiezo) {
- mech.energy = mech.fieldEnergyMax;
+ mech.energy = mech.maxEnergy;
dmg *= 0.85
}
mech.damage(dmg);
diff --git a/js/game.js b/js/game.js
index f4be07d..77d5ea9 100644
--- a/js/game.js
+++ b/js/game.js
@@ -358,7 +358,7 @@ const game = {
b.giveGuns("all", 1000)
} else if (keys[72]) { // heal with H
mech.addHealth(Infinity)
- mech.energy = mech.fieldEnergyMax;
+ mech.energy = mech.maxEnergy;
} else if (keys[89]) { //add mods with y
b.giveMod()
} else if (keys[82]) { // teleport to mouse with R
@@ -471,7 +471,7 @@ const game = {
b.setupAllMods(); //sets mods to default values
game.updateModHUD();
mech.maxHealth = 1
- mech.fieldEnergyMax = 1
+ mech.maxEnergy = 1
game.paused = false;
engine.timing.timeScale = 1;
game.fpsCap = game.fpsCapDefault;
@@ -724,8 +724,8 @@ const game = {
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
if (b.isModEnergyRecovery) {
- mech.energy += mech.fieldEnergyMax * 0.07
- if (mech.energy > mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax;
+ mech.energy += mech.maxEnergy * 0.07
+ if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
}
if (b.isModHealthRecovery) mech.addHealth(0.01)
}
diff --git a/js/level.js b/js/level.js
index 5a24b26..2038cbe 100644
--- a/js/level.js
+++ b/js/level.js
@@ -15,10 +15,10 @@ const level = {
if (build.isURLBuild && level.levelsCleared === 0) build.onLoadPowerUps();
if (level.levelsCleared === 0) { //this code only runs on the first level
// level.difficultyIncrease(9)
- // b.giveGuns("missiles")
+ b.giveGuns("foam")
// mech.setField("time dilation field")
// b.giveMod("renormalization");
- // b.giveMod("pocket universe");
+ // b.giveMod("quantum tunneling");
// b.giveGuns("grenades")
// b.giveMod("rocket-propelled grenade");
// mech.setField("pilot wave")
@@ -100,7 +100,7 @@ const level = {
//******************************************************************************************************************
testing() {
- level.difficultyIncrease(9);
+ level.difficultyIncrease(19);
spawn.setSpawnList();
spawn.setSpawnList();
level.defaultZoom = 1500
@@ -153,12 +153,16 @@ const level = {
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump
// spawn.bomberBoss(2900, -500)
- spawn.stabber(1200, -500)
- // spawn.chaser(1200, -500)
+ spawn.suckerBoss(1200, -500)
+ // spawn.hopper(1200, -500)
+ // spawn.shield(mob[mob.length - 1], 1200, -500, 1);
+
// spawn.nodeBoss(1200, -500, "spiker")
// spawn.hopper(1200, -500)
// spawn.timeSkipBoss(2900, -500)
// spawn.randomMob(1600, -500)
+ spawn.boost()
+ spawn.boost(1500, 0, 1400);
},
bosses() {
@@ -254,28 +258,35 @@ const level = {
level.addZone(level.exit.x, level.exit.y, 100, 30, "nextLevel");
spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump
- document.body.style.backgroundColor = "#eee";
+ document.body.style.backgroundColor = "#ddd";
// game.draw.mapFill = "#444"
// game.draw.bodyFill = "rgba(140,140,140,0.85)"
// game.draw.bodyStroke = "#222"
+ level.fill.push({
+ x: 2600,
+ y: -600,
+ width: 400,
+ height: 500,
+ color: "rgba(0,255,255,0.05)"
+ });
level.fillBG.push({
x: 2600,
y: -600,
width: 400,
height: 500,
- color: "#dee"
+ color: "#fff"
});
- level.fill.push({
- x: -150,
- y: -1000,
- width: 2750,
- height: 1000,
- color: "rgba(0,10,30,0.04)"
- });
+ // level.fill.push({
+ // x: -150,
+ // y: -1000,
+ // width: 2750,
+ // height: 1000,
+ // color: "rgba(0,10,30,0.04)"
+ // });
- const lineColor = "#ddd"
+ const lineColor = "#ccc"
level.fillBG.push({
x: 1600,
y: -500,
@@ -428,8 +439,7 @@ const level = {
spawn.bodyRect(2000, 50, 60, 60);
// spawn.bodyRect(1650, 50, 300, 200);
spawn.bodyRect(3175, -155, 325, 325);
- spawn.mapRect(1800, 175, 800, 100); //stops above body from moving to right
-
+ spawn.mapRect(1800, Math.floor(Math.random() * 200), 850, 300); //stops above body from moving to right
//exit building
// spawn.mapRect(-100, -410, 100, 30);
spawn.mapRect(-300, -800, 500, 50);
@@ -509,7 +519,7 @@ const level = {
});
//far right structure
- spawn.mapRect(5200, -775, 100, 920);
+ spawn.mapRect(5200, -725, 100, 870);
spawn.mapRect(5300, -1075, 350, 1220);
spawn.boost(5825, 235, 1400);
level.fill.push({
@@ -528,8 +538,8 @@ const level = {
height: 1500,
color: "rgba(0,20,40,0.13)"
});
- spawn.mapRect(4000, -400, 325, 50);
- spawn.mapRect(4725, -400, 325, 50);
+ spawn.mapRect(3950, -350, 375, 50);
+ spawn.mapRect(4725, -350, 375, 50);
spawn.mapRect(4000, -1300, 1050, 100);
//steep stairs
diff --git a/js/mobs.js b/js/mobs.js
index ae98f40..034820e 100644
--- a/js/mobs.js
+++ b/js/mobs.js
@@ -953,8 +953,14 @@ const mobs = {
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
//energy and heal drain should be calculated after damage boosts
- 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.modEnergySiphon && dmg !== Infinity) {
+ mech.energy += Math.min(this.health, dmg) * b.modEnergySiphon
+ if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy
+ }
+ if (b.modHealthDrain && dmg !== Infinity) {
+ mech.addHealth(Math.min(this.health, dmg) * b.modHealthDrain)
+ if (mech.health > mech.maxHealth) mech.health = mech.maxHealth
+ }
this.health -= dmg
//this.fill = this.color + this.health + ')';
this.onDamage(dmg); //custom damage effects
diff --git a/js/player.js b/js/player.js
index 10fba08..ee95473 100644
--- a/js/player.js
+++ b/js/player.js
@@ -759,7 +759,7 @@ const mech = {
fireCDcycle: 0,
fieldCDcycle: 0,
fieldMode: 0, //basic field mode before upgrades
- fieldEnergyMax: 1, //can be increased by a mod
+ maxEnergy: 1, //can be increased by a mod
holdingTarget: null,
fieldShieldingScale: 1,
timeSkipLastCycle: 0,
@@ -777,7 +777,7 @@ const mech = {
mech.fieldThreshold = Math.cos(mech.fieldArc * Math.PI)
},
setHoldDefaults() {
- if (mech.energy < mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax;
+ if (mech.energy < mech.maxEnergy) mech.energy = mech.maxEnergy;
mech.fieldRegen = b.modEnergyRegen; //0.001
mech.fieldMeterColor = "#0cf"
mech.fieldShieldingScale = 1;
@@ -796,17 +796,18 @@ const mech = {
},
fieldMeterColor: "#0cf",
drawFieldMeter(bgColor = "rgba(0, 0, 0, 0.4)", range = 60) {
- if (mech.energy < mech.fieldEnergyMax) {
+ if (mech.energy < mech.maxEnergy) {
mech.energy += mech.fieldRegen;
ctx.fillStyle = bgColor;
- const xOff = mech.pos.x - mech.radius * mech.fieldEnergyMax
+ const xOff = mech.pos.x - mech.radius * mech.maxEnergy
const yOff = mech.pos.y - 50
- ctx.fillRect(xOff, yOff, range * mech.fieldEnergyMax, 10);
+ ctx.fillRect(xOff, yOff, range * mech.maxEnergy, 10);
ctx.fillStyle = mech.fieldMeterColor;
ctx.fillRect(xOff, yOff, range * mech.energy, 10);
}
+ if (mech.energy < 0) mech.energy = 0
// else {
- // mech.energy = mech.fieldEnergyMax
+ // mech.energy = mech.maxEnergy
// }
},
lookingAt(who) {
@@ -1019,7 +1020,7 @@ const mech = {
y: powerUp[i].velocity.y * 0.11
});
if (dist2 < 5000 && !game.isChoosing) { //use power up if it is close enough
- if (b.isModMassEnergy) mech.energy = mech.fieldEnergyMax * 2;
+ if (b.isModMassEnergy) mech.energy = mech.maxEnergy * 2;
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.3,
y: player.velocity.y + ((powerUp[i].velocity.y * powerUp[i].mass) / player.mass) * 0.3
@@ -1038,7 +1039,7 @@ const mech = {
if (mech.energy > fieldBlockCost * 0.2) { //shield needs at least some of the cost to block
mech.energy -= fieldBlockCost
if (mech.energy < 0) mech.energy = 0;
- if (mech.energy > mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax;
+ if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
const unit = Vector.normalise(Vector.sub(player.position, who.position))
if (b.modBlockDmg) {
@@ -1378,7 +1379,7 @@ const mech = {
effect: () => {
// mech.fieldRegen *= 2;
mech.hold = function () {
- if (mech.energy > mech.fieldEnergyMax - 0.02 && mech.fieldCDcycle < mech.cycle) {
+ if (mech.energy > mech.maxEnergy - 0.02 && mech.fieldCDcycle < mech.cycle) {
if (b.isModSporeField) {
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
const len = Math.floor(6 + 4 * Math.random())
@@ -1926,20 +1927,21 @@ const mech = {
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.energy < mech.fieldEnergyMax) {
+ if (mech.energy < mech.maxEnergy) {
mech.energy += mech.fieldRegen;
- const xOff = mech.pos.x - mech.radius * mech.fieldEnergyMax
+ const xOff = mech.pos.x - mech.radius * mech.maxEnergy
const yOff = mech.pos.y - 50
ctx.fillStyle = "rgba(0, 0, 0, 0.3)";
- ctx.fillRect(xOff, yOff, 60 * mech.fieldEnergyMax, 10);
+ ctx.fillRect(xOff, yOff, 60 * mech.maxEnergy, 10);
ctx.fillStyle = mech.fieldMeterColor;
ctx.fillRect(xOff, yOff, 60 * mech.energy, 10);
ctx.beginPath()
- ctx.rect(xOff, yOff, 60 * mech.fieldEnergyMax, 10);
+ ctx.rect(xOff, yOff, 60 * mech.maxEnergy, 10);
ctx.strokeStyle = "rgb(0, 0, 0)";
ctx.lineWidth = 1;
ctx.stroke();
}
+ if (mech.energy < 0) mech.energy = 0
}
}
},
@@ -2000,6 +2002,7 @@ const mech = {
}
}
+ //grab power ups into the field
for (let i = 0, len = powerUp.length; i < len; ++i) {
const dxP = mech.fieldPosition.x - powerUp[i].position.x;
const dyP = mech.fieldPosition.y - powerUp[i].position.y;
@@ -2014,11 +2017,11 @@ const mech = {
y: powerUp[i].velocity.y * 0.11
});
if (dist2 < 5000 && !game.isChoosing) { //use power up if it is close enough
- if (b.isModMassEnergy) mech.energy = mech.fieldEnergyMax * 2;
+ if (b.isModMassEnergy) mech.energy = mech.maxEnergy * 2;
powerUp[i].effect();
Matter.World.remove(engine.world, powerUp[i]);
powerUp.splice(i, 1);
- mech.fieldRadius += 50
+ // mech.fieldRadius += 50
break; //because the array order is messed up after splice
}
}
diff --git a/js/powerups.js b/js/powerups.js
index 7d83a2f..7b3bddb 100644
--- a/js/powerups.js
+++ b/js/powerups.js
@@ -78,7 +78,7 @@ const powerUps = {
}
}
if (target.ammo === Infinity) {
- mech.energy = mech.fieldEnergyMax;
+ if (mech.energy < mech.maxEnergy) mech.energy = mech.maxEnergy;
if (!game.lastLogTime) game.makeTextLog("+energy", 300);
} else {
let ammo = Math.ceil((target.ammoPack * (1 + 0.1 * Math.random())));
@@ -89,7 +89,7 @@ const powerUps = {
}
} 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
- mech.energy = mech.fieldEnergyMax;
+ if (mech.energy < mech.maxEnergy) mech.energy = mech.maxEnergy;
if (!game.lastLogTime) game.makeTextLog("+energy", 300);
}
}
@@ -110,17 +110,18 @@ const powerUps = {
}
let choice1 = pick(mech.fieldUpgrades)
- let choice2 = pick(mech.fieldUpgrades, choice1)
+ let choice2 = -1
let choice3 = -1
if (choice1 > -1) {
let text = `