diff --git a/js/bullets.js b/js/bullets.js
index 3b3367e..1fa9dac 100644
--- a/js/bullets.js
+++ b/js/bullets.js
@@ -34,6 +34,7 @@ const b = {
modBlockDmg: null,
isModPiezo: null,
isModFastDrones: null,
+ isModStomp: null,
setModDefaults() {
b.modCount = 0;
b.modFireRate = 1;
@@ -66,6 +67,7 @@ const b = {
b.modCollisionImmuneCycles = 30;
b.modBlockDmg = 0;
b.isModPiezo = false;
+ b.isModStomp = false;
mech.Fx = 0.015;
mech.jumpForce = 0.38;
mech.maxHealth = 1;
@@ -84,7 +86,7 @@ const b = {
}
},
mods: [{
- name: "depleted uranium rounds", //0
+ name: "depleted uranium rounds",
description: `your bullets are +13% larger
increased mass and physical damage`,
count: 0,
maxCount: 9,
@@ -96,7 +98,7 @@ const b = {
}
},
{
- name: "fluoroantimonic acid", //1
+ name: "fluoroantimonic acid",
description: "each bullet does extra chemical damage
only active when you are above 90% health",
maxCount: 1,
count: 0,
@@ -109,7 +111,7 @@ const b = {
}
},
{
- name: "fracture analysis", //2
+ name: "fracture analysis",
description: "5x physical damage to unaware enemies
unaware enemies don't have a health bar",
maxCount: 1,
count: 0,
@@ -121,7 +123,7 @@ const b = {
}
},
{
- name: "kinetic bombardment", //3
+ name: "kinetic bombardment",
description: "do up to 33% more damage at a distance
increase maxes out at about 40 steps away",
maxCount: 1,
count: 0,
@@ -133,7 +135,7 @@ const b = {
}
},
{
- name: "quasistatic equilibrium", //4
+ name: "quasistatic equilibrium",
description: "do extra damage at low health
up to 50% increase when near death",
maxCount: 1,
count: 0,
@@ -145,7 +147,7 @@ const b = {
}
},
{
- name: "high explosives", //15
+ name: "high explosives",
description: "the radius of explosions are +25% larger",
maxCount: 3,
count: 0,
@@ -157,7 +159,7 @@ const b = {
}
},
{
- name: "electric reactive armour", //15
+ name: "electric reactive armour",
description: "explosions drain energy instead of doing harm",
maxCount: 1,
count: 0,
@@ -169,7 +171,7 @@ const b = {
}
},
{
- name: "auto-loading heuristics", //5
+ name: "auto-loading heuristics",
description: "your delay after firing is +14% shorter",
maxCount: 3,
count: 0,
@@ -181,7 +183,7 @@ const b = {
}
},
{
- name: "desublimated ammunition", //6
+ name: "desublimated ammunition",
description: "use 50% less ammo when crouching",
maxCount: 1,
count: 0,
@@ -193,7 +195,7 @@ const b = {
}
},
{
- name: "Lorentzian topology", //7
+ name: "Lorentzian topology",
description: "your bullets last +33% longer",
maxCount: 3,
count: 0,
@@ -205,7 +207,7 @@ const b = {
}
},
{
- name: "zoospore vector", //8
+ name: "zoospore vector",
description: "enemies discharge spores on death
+11% chance",
maxCount: 9,
count: 0,
@@ -220,7 +222,7 @@ const b = {
}
},
{
- name: "laser-bot", //10
+ name: "laser-bot",
description: "a bot defends the space around you
uses a short range laser that drains energy",
maxCount: 9,
count: 0,
@@ -233,7 +235,7 @@ const b = {
}
},
{
- name: "nail-bot", //11
+ name: "nail-bot",
description: "a bot fires nails at targets in line of sight",
maxCount: 9,
count: 0,
@@ -246,7 +248,7 @@ const b = {
}
},
{
- name: "ablative synthesis", //9
+ name: "ablative synthesis",
description: "rebuild your broken parts as drones
chance to occur after being harmed",
maxCount: 1,
count: 0,
@@ -261,7 +263,7 @@ const b = {
}
},
{
- name: "bremsstrahlung radiation", //13
+ name: "bremsstrahlung radiation",
description: "when your field blocks it also does damage",
maxCount: 9,
count: 0,
@@ -273,7 +275,7 @@ const b = {
}
},
{
- name: "entanglement", //16
+ name: "entanglement",
description: "using your first gun reduces harm
scales by 10% for each gun in your inventory",
maxCount: 1,
count: 0,
@@ -285,7 +287,7 @@ const b = {
}
},
{
- name: "squirrel-cage rotor", //27
+ name: "squirrel-cage rotor",
description: "jump higher and move faster
reduced harm from falling ",
maxCount: 1,
count: 0,
@@ -298,8 +300,20 @@ const b = {
mech.jumpForce = 0.38 * 1.1;
}
},
+ // {
+ // name: "ground stomp",
+ // description: "hard landings release spores",
+ // maxCount: 1,
+ // count: 0,
+ // allowed() {
+ // return b.modSquirrelFx === 1.2 ? true : false;
+ // },
+ // effect() {
+ // b.isModStomp = true
+ // }
+ // },
{
- name: "Pauli exclusion", //12
+ name: "Pauli exclusion",
description: "unable to collide with enemies for +2 second
activates after being harmed from a collision",
maxCount: 9,
count: 0,
@@ -312,7 +326,7 @@ const b = {
}
},
{
- name: "annihilation", //14
+ name: "annihilation",
description: "after touching enemies, they are annihilated",
maxCount: 1,
count: 0,
@@ -324,7 +338,7 @@ const b = {
}
},
{
- name: "piezoelectricity", //17
+ name: "piezoelectricity",
description: "colliding with enemies fills your energy",
maxCount: 1,
count: 0,
@@ -337,7 +351,7 @@ const b = {
}
},
{
- name: "energy conservation", //18
+ name: "energy conservation",
description: "gain energy proportional to damage done",
maxCount: 3,
count: 0,
@@ -350,7 +364,7 @@ const b = {
}
},
{
- name: "entropy exchange", //19
+ name: "entropy exchange",
description: "heal proportional to damage done",
maxCount: 3,
count: 0,
@@ -362,7 +376,7 @@ const b = {
}
},
{
- name: "overcharge", //20
+ name: "overcharge",
description: "charge energy +33% beyond your maximum",
maxCount: 9,
count: 0,
@@ -375,7 +389,7 @@ const b = {
}
},
{
- name: "supersaturation", //21
+ name: "supersaturation",
description: "heal +33% beyond your max health",
maxCount: 9,
count: 0,
@@ -388,7 +402,7 @@ const b = {
}
},
{
- name: "recursive healing", //22
+ name: "recursive healing",
description: "healing power ups trigger one extra time.",
maxCount: 9,
count: 0,
@@ -400,7 +414,7 @@ const b = {
}
},
{
- name: "mass-energy equivalence", //23
+ name: "mass-energy equivalence",
description: "power ups fill your energy and heal for +5%",
maxCount: 1,
count: 0,
@@ -413,7 +427,7 @@ const b = {
}
},
{
- name: "quantum immortality", //28
+ name: "quantum immortality",
description: "after dying, continue in an alternate reality
guns, ammo, field, and mods are randomized",
maxCount: 1,
count: 0,
@@ -425,7 +439,7 @@ const b = {
}
},
{
- name: "Bayesian inference", //25
+ name: "Bayesian inference",
description: "20% chance for double power ups to drop
one fewer choice when selecting power ups",
maxCount: 1,
count: 0,
@@ -437,7 +451,7 @@ const b = {
}
},
{
- name: "+1 cardinality", //24
+ name: "+1 cardinality",
description: "one extra choice when selecting power ups",
maxCount: 1,
count: 0,
@@ -449,7 +463,7 @@ const b = {
}
},
{
- name: "Born rule", //26
+ name: "Born rule",
description: "remove all current mods
spawn new mods to replace them",
maxCount: 1,
count: 0,
@@ -465,7 +479,7 @@ const b = {
}
},
{
- name: "brushless motors", //7
+ name: "brushless motors",
description: "your drones accelerate 40% faster",
maxCount: 1,
count: 0,
@@ -491,6 +505,12 @@ const b = {
b.giveMod(newMod)
}
} else {
+ if (isNaN(index)) { //find index by name
+ for (let i = 0; i < b.mods.length; i++) {
+ if (index === b.mods[i].name) index = i
+ }
+ }
+
b.mods[index].effect(); //give specific mod
b.mods[index].count++
b.modCount++ //used in power up randomization
@@ -1246,6 +1266,12 @@ const b = {
b.guns[i].ammo = Math.floor(b.guns[i].ammoPack * ammoPacks);
}
} else {
+ if (isNaN(gun)) { //find gun by name
+ for (let i = 0; i < b.guns.length; i++) {
+ if (gun === b.guns[i].name) gun = i
+ }
+ }
+
if (!b.guns[gun].have) b.inventory.push(gun);
if (b.activeGun === null) b.activeGun = gun //if no active gun switch to new gun
b.guns[gun].have = true;
diff --git a/js/level.js b/js/level.js
index 9d802b0..8475dea 100644
--- a/js/level.js
+++ b/js/level.js
@@ -13,15 +13,15 @@ const level = {
levelsCleared: 0,
start() {
if (level.levelsCleared === 0) {
- level.difficultyIncrease(7)
- // b.giveGuns(0)
- // mech.setField(3)
- // b.giveMod(0);
+ // level.difficultyIncrease(7)
+ // b.giveGuns("flak")
+ // mech.setField("phase decoherence field")
+ // b.giveMod("ground stomp");
- // level.intro(); //starting level
+ level.intro(); //starting level
// level.testingMap();
// level.bosses();
- level.satellite();
+ // level.satellite();
// level.skyscrapers();
// level.aerie();
// level.rooftops();
diff --git a/js/mobs.js b/js/mobs.js
index 5e0d2e4..0fa6a0c 100644
--- a/js/mobs.js
+++ b/js/mobs.js
@@ -125,13 +125,10 @@ const mobs = {
if (this.seePlayer.recall < 0) this.seePlayer.recall = 0;
},
memory: 120, //default time to remember player's location
- locatePlayer() {
- if (!mech.isStealth) {
- // updates mob's memory of player location
- this.seePlayer.recall = this.memory + Math.round(this.memory * Math.random()); //seconds before mob falls a sleep
- this.seePlayer.position.x = player.position.x;
- this.seePlayer.position.y = player.position.y;
- }
+ locatePlayer() { // updates mob's memory of player location
+ this.seePlayer.recall = this.memory + Math.round(this.memory * Math.random()); //seconds before mob falls a sleep
+ this.seePlayer.position.x = player.position.x;
+ this.seePlayer.position.y = player.position.y
},
// locatePlayerByDist() {
// if (this.distanceToPlayer2() < this.locateRange) {
@@ -143,7 +140,8 @@ const mobs = {
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
- Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0
+ Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
+ !mech.isStealth
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -153,7 +151,7 @@ const mobs = {
},
seePlayerCheckByDistance() {
if (!(game.cycle % this.seePlayerFreq)) {
- if (this.distanceToPlayer2() < this.seeAtDistance2) {
+ if (this.distanceToPlayer2() < this.seeAtDistance2 && !mech.isStealth) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
this.lostPlayer();
@@ -163,8 +161,8 @@ const mobs = {
seePlayerByDistOrLOS() {
if (!(game.cycle % this.seePlayerFreq)) {
if (
- this.distanceToPlayer2() < this.seeAtDistance2 ||
- (Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0)
+ (this.distanceToPlayer2() < this.seeAtDistance2 || (Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0)) &&
+ !mech.isStealth
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -176,7 +174,9 @@ const mobs = {
if (!(game.cycle % this.seePlayerFreq)) {
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
- (Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0)
+ Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
+ Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
+ !mech.isStealth
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -207,7 +207,8 @@ const mobs = {
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
- Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0
+ Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
+ !mech.isStealth
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -391,7 +392,8 @@ const mobs = {
(this.seePlayer.recall || this.isLookingAtPlayer(this.lookRange)) &&
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, player.position).length === 0 &&
- Matter.Query.ray(body, this.position, player.position).length === 0
+ Matter.Query.ray(body, this.position, player.position).length === 0 &&
+ !mech.isStealth
) {
this.foundPlayer();
if (!(game.cycle % (this.seePlayerFreq * 2))) {
diff --git a/js/player.js b/js/player.js
index 87e36e2..cff8914 100644
--- a/js/player.js
+++ b/js/player.js
@@ -206,7 +206,12 @@ const mech = {
mech.yOff = mech.yOffWhen.jump;
mech.hardLandCD = mech.cycle + Math.min(momentum / 6 - 6, 40)
- if (game.isBodyDamage && player.velocity.y > 26 && momentum > 165 * b.modSquirrelFx) { //falling damage
+ if (b.isModStomp) {
+ // const len = Math.min(10, momentum * 0.03)
+ // for (let i = 0; i < 10; i++) {
+ // b.spore(player) //spawn drone
+ // }
+ } else if (game.isBodyDamage && player.velocity.y > 26 && momentum > 165 * b.modSquirrelFx) { //falling damage
let dmg = Math.sqrt(momentum - 165) * 0.01
dmg = Math.min(Math.max(dmg, 0.02), 0.20);
mech.damage(dmg);
@@ -268,7 +273,6 @@ const mech = {
y: player.velocity.y * stoppingFriction
});
}
-
} else { // in air **********************************
//check for short jumps
if (
@@ -288,6 +292,15 @@ const mech = {
} else if (keys[68] || keys[39]) {
if (player.velocity.x < limit) player.force.x += mech.FxAir; //move player right / d
}
+ // if ((keys[83] || keys[40])) { //ground stomp when pressing down
+ // player.force.y += 0.1;
+ // if (player.velocity.y > 50) {
+ // Matter.Body.setVelocity(player, {
+ // x: 0,
+ // y: 50
+ // });
+ // }
+ // }
}
//smoothly move leg height towards height goal
@@ -1069,6 +1082,12 @@ const mech = {
},
hold() {},
setField(index) {
+ if (isNaN(index)) { //find index by name
+ for (let i = 0; i < mech.fieldUpgrades.length; i++) {
+ if (index === mech.fieldUpgrades[i].name) index = i
+ }
+ }
+
mech.fieldMode = index;
document.getElementById("field").innerHTML = mech.fieldUpgrades[index].name
mech.setHoldDefaults();
@@ -1494,7 +1513,7 @@ const mech = {
effect: () => {
// mech.grabRange = 230
mech.hold = function () {
- mech.isStealth = false //isStealth is checked in mob foundPlayer()
+ mech.isStealth = false //isStealth disables most uses of foundPlayer()
player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield //normal collisions
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
@@ -1505,7 +1524,7 @@ const mech = {
if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN;
- mech.isStealth = true //isStealth is checked in mob foundPlayer()
+ mech.isStealth = true //isStealth disables most uses of foundPlayer()
player.collisionFilter.mask = cat.map
ctx.beginPath();
diff --git a/js/spawn.js b/js/spawn.js
index 536e34a..0b646d1 100644
--- a/js/spawn.js
+++ b/js/spawn.js
@@ -676,7 +676,7 @@ const spawn = {
me.frictionAir = 0.03;
me.torque -= me.inertia * 0.002
Matter.Body.rotate(me, 0.25);
- Matter.Body.setDensity(me, 0.04 * (1 + Math.sqrt(game.difficulty))); //extra dense //normal is 0.001 //makes effective life much larger
+ Matter.Body.setDensity(me, 0.03); //extra dense //normal is 0.001 //makes effective life much larger
// spawn.shield(me, x, y, 1); //not working, not sure why
me.onDeath = function () {
powerUps.spawnBossPowerUp(this.position.x, this.position.y)