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