negative mass field flying buff

harmonic field now has no cooldown after blocking
negative mass field accelerates slower, but with a higher top speed
negative mass field harm reduction is now 60% and always on
mod degenerate matter increases the damage reduction from 60% to 80%

falling damage and damage from blocks have been removed
(I'm trying it out, let me know if you want it back)
This commit is contained in:
landgreen
2020-05-28 16:07:09 -07:00
parent ff78c731fc
commit 7a89051384
9 changed files with 208 additions and 237 deletions

View File

@@ -241,8 +241,8 @@ const b = {
knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 50); knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 50);
mob[i].force.x += knock.x; mob[i].force.x += knock.x;
mob[i].force.y += knock.y; mob[i].force.y += knock.y;
radius *= 0.93 //reduced range for each additional explosion target radius *= 0.95 //reduced range for each additional explosion target
damageScale *= 0.8 //reduced damage for each additional explosion target damageScale *= 0.85 //reduced damage for each additional explosion target
} else if (!mob[i].seePlayer.recall && dist < alertRange) { } else if (!mob[i].seePlayer.recall && dist < alertRange) {
mob[i].locatePlayer(); mob[i].locatePlayer();
knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 80); knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 80);
@@ -618,9 +618,9 @@ const b = {
friction: 0.05, friction: 0.05,
frictionAir: FRICTION, frictionAir: FRICTION,
restitution: 1, restitution: 1,
dmg: 0.23, //damage done in addition to the damage from momentum dmg: 0.28, //damage done in addition to the damage from momentum
lookFrequency: 100 + Math.floor(23 * Math.random()), lookFrequency: 100 + Math.floor(23 * Math.random()),
endCycle: game.cycle + Math.floor((1200 + 420 * Math.random()) * mod.isBulletsLastLonger), endCycle: game.cycle + Math.floor((1100 + 420 * Math.random()) * mod.isBulletsLastLonger),
classType: "bullet", classType: "bullet",
collisionFilter: { collisionFilter: {
category: cat.bullet, category: cat.bullet,
@@ -1192,16 +1192,18 @@ const b = {
let knock, spread let knock, spread
if (mech.crouch) { if (mech.crouch) {
mech.fireCDcycle = mech.cycle + Math.floor(55 * mod.fireRate); // cool down mech.fireCDcycle = mech.cycle + Math.floor(55 * mod.fireRate); // cool down
if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + Math.floor(55 * mod.fireRate); //player is immune to collision damage for 30 cycles
spread = 0.75 spread = 0.75
knock = 0.01 * mod.bulletSize * mod.bulletSize knock = 0.01 * mod.bulletSize * mod.bulletSize
} else { } else {
mech.fireCDcycle = mech.cycle + Math.floor(45 * mod.fireRate); // cool down mech.fireCDcycle = mech.cycle + Math.floor(45 * mod.fireRate); // cool down
if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + Math.floor(45 * mod.fireRate); //player is immune to collision damage for 30 cycles
spread = 1.3 spread = 1.3
knock = 0.08 * mod.bulletSize * mod.bulletSize knock = 0.08 * mod.bulletSize * mod.bulletSize
} }
player.force.x -= knock * Math.cos(mech.angle) player.force.x -= knock * Math.cos(mech.angle)
player.force.y -= knock * Math.sin(mech.angle) * 0.3 //reduce knock back in vertical direction to stop super jumps player.force.y -= knock * Math.sin(mech.angle) * 0.3 //reduce knock back in vertical direction to stop super jumps
if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + 60; //player is immune to collision damage for 30 cycles
b.muzzleFlash(35); b.muzzleFlash(35);
if (mod.isNailShot) { if (mod.isNailShot) {
for (let i = 0; i < 15; i++) { for (let i = 0; i < 15; i++) {
@@ -2074,7 +2076,7 @@ const b = {
name: "drones", name: "drones",
description: "deploy drones that <strong>crash</strong> into mobs<br>collisions reduce their <strong>lifespan</strong> by 1 second", description: "deploy drones that <strong>crash</strong> into mobs<br>collisions reduce their <strong>lifespan</strong> by 1 second",
ammo: 0, ammo: 0,
ammoPack: 15, ammoPack: 14,
have: false, have: false,
isStarterGun: true, isStarterGun: true,
isEasyToAim: true, isEasyToAim: true,

View File

@@ -87,40 +87,40 @@ function collisionChecks(event) {
//body + player collision //body + player collision
if (game.isBodyDamage) { // if (game.isBodyDamage) {
if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) { // if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) {
collidePlayer(pairs[i].bodyB) // collidePlayer(pairs[i].bodyB)
} else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) { // } else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) {
collidePlayer(pairs[i].bodyA) // collidePlayer(pairs[i].bodyA)
} // }
} // }
function collidePlayer(obj) { // function collidePlayer(obj) {
//player dmg from hitting a body // //player dmg from hitting a body
if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) { // if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) {
const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26) // const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26)
if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference // if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference
const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity)) // const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity))
if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold) // if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold)
} else { //block is below player only look at horizontal momentum difference // } else { //block is below player only look at horizontal momentum difference
const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x) // const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x)
if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold) // if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold)
} // }
function hit(dmg) { // function hit(dmg) {
mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles // mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15); // dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15);
mech.damage(dmg); // mech.damage(dmg);
game.drawList.push({ //add dmg to draw queue // game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x, // x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y, // y: pairs[i].activeContacts[0].vertex.y,
radius: dmg * 500, // radius: dmg * 500,
color: game.mobDmgColor, // color: game.mobDmgColor,
time: game.drawTime // time: game.drawTime
}); // });
} // }
} // }
} // }
//mob + (player,bullet,body) collisions //mob + (player,bullet,body) collisions
for (let k = 0; k < mob.length; k++) { for (let k = 0; k < mob.length; k++) {

View File

@@ -7,7 +7,11 @@ const game = {
Engine.update(engine, game.delta); Engine.update(engine, game.delta);
game.wipe(); game.wipe();
game.textLog(); game.textLog();
mech.keyMove(); if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
level.checkZones(); level.checkZones();
level.checkQuery(); level.checkQuery();
mech.move(); mech.move();
@@ -30,7 +34,11 @@ const game = {
Engine.update(engine, game.delta); Engine.update(engine, game.delta);
game.wipe(); game.wipe();
game.textLog(); game.textLog();
mech.keyMove(); if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
level.checkZones(); level.checkZones();
level.checkQuery(); level.checkQuery();
mech.move(); mech.move();
@@ -69,7 +77,11 @@ const game = {
mech.cycle++; mech.cycle++;
game.gravity(); game.gravity();
Engine.update(engine, game.delta); Engine.update(engine, game.delta);
mech.keyMove(); if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
level.checkZones(); level.checkZones();
level.checkQuery(); level.checkQuery();
@@ -741,7 +753,7 @@ const game = {
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
if (mod.isEnergyRecovery) { if (mod.isEnergyRecovery) {
mech.energy += mech.maxEnergy * 0.07 mech.energy += mech.maxEnergy * 0.06
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy; if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
} }
if (mod.isHealthRecovery) mech.addHealth(0.01) if (mod.isHealthRecovery) mech.addHealth(0.01)

View File

@@ -184,9 +184,9 @@ const level = {
// spawn.bomberBoss(2900, -500) // spawn.bomberBoss(2900, -500)
// spawn.launcherBoss(1200, -500) // spawn.launcherBoss(1200, -500)
spawn.laserTargetingBoss(1600, -400) // spawn.laserTargetingBoss(1600, -400)
// spawn.sneaker(1600, -500) // spawn.spawner(1600, -500)
// spawn.sniper(1700, -120) spawn.sniper(1700, -120)
// spawn.cellBossCulture(1600, -500) // spawn.cellBossCulture(1600, -500)
// spawn.shooter(1600, -500) // spawn.shooter(1600, -500)
// spawn.striker(1600, -500) // spawn.striker(1600, -500)

View File

@@ -342,18 +342,20 @@ const mod = {
}, },
{ {
name: "self-replication", name: "self-replication",
description: "<strong>duplicate</strong> your permanent <strong>bots</strong><br>remove all your <strong>ammo</strong>", description: "<strong>duplicate</strong> your permanent <strong>bots</strong><br>remove <strong>80%</strong> of your <strong>ammo</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
isNonRefundable: true, isNonRefundable: true,
allowed() { allowed() {
return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 1 return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 2
}, },
requires: "2 or more bots", requires: "3 or more bots",
effect() { effect() {
//remove ammo //remove ammo
for (let i = 0, len = b.guns.length; i < len; ++i) { for (let i = 0, len = b.guns.length; i < len; ++i) {
if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0; if (b.guns[i].ammo != Infinity) {
b.guns[i].ammo = Math.floor(b.guns[i].ammo * 0.2);
}
} }
//double bots //double bots
@@ -499,7 +501,7 @@ const mod = {
}, },
{ {
name: "waste energy recovery", name: "waste energy recovery",
description: "regen <strong>7%</strong> of max <strong class='color-f'>energy</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>", description: "regen <strong>6%</strong> of max <strong class='color-f'>energy</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -648,7 +650,7 @@ const mod = {
}, },
{ {
name: "energy conservation", name: "energy conservation",
description: "<strong>+15%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>", description: "<strong>+13%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -656,8 +658,7 @@ const mod = {
}, },
requires: "", requires: "",
effect() { effect() {
mod.energySiphon += 0.15; mod.energySiphon += 0.13;
mech.energy = mech.maxEnergy
}, },
remove() { remove() {
mod.energySiphon = 0; mod.energySiphon = 0;
@@ -1032,7 +1033,7 @@ const mod = {
}, },
{ {
name: "shotgun spin-statistics", name: "shotgun spin-statistics",
description: "firing the <strong>shotgun</strong> makes you <br><strong>immune</strong> to <strong>harm</strong> for <strong>1 second</strong>", description: "firing the <strong>shotgun</strong> makes you <br><strong>immune</strong> to <strong>harm</strong> while on cooldown",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1591,7 +1592,7 @@ const mod = {
}, },
{ {
name: "degenerate matter", name: "degenerate matter",
description: "<strong>2x</strong> <strong class='color-f'>energy</strong> drain for <strong>negative mass field</strong><br>increase <strong>harm</strong> reduction to <strong>90%</strong>", description: "<strong>negative mass field</strong><br><strong>harm</strong> reduction is increased to <strong>80%</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1600,9 +1601,11 @@ const mod = {
requires: "negative mass field", requires: "negative mass field",
effect() { effect() {
mod.isHarmReduce = true mod.isHarmReduce = true
mech.fieldHarmReduction = 0.2;
}, },
remove() { remove() {
mod.isHarmReduce = false; mod.isHarmReduce = false;
if (mech.fieldUpgrades[mech.fieldMode].name === "negative mass field") mech.setField("negative mass field") //reset harm reduction
} }
}, },
{ {
@@ -1655,7 +1658,7 @@ const mod = {
}, },
{ {
name: "frequency resonance", name: "frequency resonance",
description: "<strong>standing wave harmonics</strong> shield is retuned<br>increase <strong>size</strong> and <strong>blocking</strong> efficiency by <strong>30%</strong>", description: "<strong>standing wave harmonics</strong> shield is retuned<br>increase <strong>size</strong> and <strong>blocking</strong> efficiency by <strong>40%</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -1663,8 +1666,8 @@ const mod = {
}, },
requires: "standing wave harmonics", requires: "standing wave harmonics",
effect() { effect() {
mech.fieldRange += 175 * 0.2 mech.fieldRange += 175 * 0.21
mech.fieldShieldingScale *= 0.7 mech.fieldShieldingScale *= 0.6
}, },
remove() { remove() {
mech.fieldRange = 175; mech.fieldRange = 175;

View File

@@ -69,7 +69,7 @@ const mech = {
mass: 5, mass: 5,
FxNotHolding: 0.015, FxNotHolding: 0.015,
Fx: 0.015, //run Force on ground // Fx: 0.015, //run Force on ground //
FxAir: 0.016, //run Force in Air FxAir: 0.016, // 0.4/5/5 run Force in Air
yOff: 70, yOff: 70,
yOffGoal: 70, yOffGoal: 70,
onGround: false, //checks if on ground or in air onGround: false, //checks if on ground or in air
@@ -112,6 +112,7 @@ const mech = {
ground: 0.01, ground: 0.01,
air: 0.0025 air: 0.0025
}, },
airSpeedLimit: 125, // 125/mass/mass = 5
angle: 0, angle: 0,
walk_cycle: 0, walk_cycle: 0,
stepSize: 0, stepSize: 0,
@@ -208,152 +209,101 @@ const mech = {
} }
} else { } else {
//sets a hard land where player stays in a crouch for a bit and can't jump //sets a hard land where player stays in a crouch for a bit and can't jump
//crouch is forced in keyMove() on ground section below //crouch is forced in groundControl below
const momentum = player.velocity.y * player.mass //player mass is 5 so this triggers at 26 down velocity, unless the player is holding something const momentum = player.velocity.y * player.mass //player mass is 5 so this triggers at 26 down velocity, unless the player is holding something
if (momentum > 130) { if (momentum > 130) {
mech.doCrouch(); mech.doCrouch();
mech.yOff = mech.yOffWhen.jump; mech.yOff = mech.yOffWhen.jump;
mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40) mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40)
if (mod.isStomp) { // if (mod.isStomp) {
const len = Math.min(25, (momentum - 120) * 0.1) // const len = Math.min(25, (momentum - 120) * 0.1)
for (let i = 0; i < len; i++) { // for (let i = 0; i < len; i++) {
b.spore(player) //spawn drone // b.spore(player) //spawn drone
} // }
} else if (player.velocity.y > 27 && momentum > 180 * mod.squirrelFx) { //falling damage // } else if (player.velocity.y > 27 && momentum > 180 * mod.squirrelFx) { //falling damage
let dmg = Math.sqrt(momentum - 180) * 0.01 // let dmg = Math.sqrt(momentum - 180) * 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);
} // }
} else { } else {
mech.yOffGoal = mech.yOffWhen.stand; mech.yOffGoal = mech.yOffWhen.stand;
} }
} }
}, },
buttonCD_jump: 0, //cool down for player buttons buttonCD_jump: 0, //cool down for player buttons
keyMove() { groundControl() {
if (mech.onGround) { //on ground ********************** if (mech.crouch) {
if (mech.crouch) { if (!(keys[83] || keys[40]) && mech.checkHeadClear() && mech.hardLandCD < mech.cycle) mech.undoCrouch();
if (!(keys[83] || keys[40]) && mech.checkHeadClear() && mech.hardLandCD < mech.cycle) mech.undoCrouch(); } else if (keys[83] || keys[40] || mech.hardLandCD > mech.cycle) {
} else if (keys[83] || keys[40] || mech.hardLandCD > mech.cycle) { mech.doCrouch(); //on ground && not crouched and pressing s or down
mech.doCrouch(); //on ground && not crouched and pressing s or down } else if ((keys[87] || keys[38]) && mech.buttonCD_jump + 20 < mech.cycle && mech.yOffWhen.stand > 23) {
} else if ((keys[87] || keys[38]) && mech.buttonCD_jump + 20 < mech.cycle && mech.yOffWhen.stand > 23) { mech.buttonCD_jump = mech.cycle; //can't jump again until 20 cycles pass
mech.buttonCD_jump = mech.cycle; //can't jump again until 20 cycles pass
//apply a fraction of the jump force to the body the player is jumping off of //apply a fraction of the jump force to the body the player is jumping off of
Matter.Body.applyForce(mech.standingOn, mech.pos, { Matter.Body.applyForce(mech.standingOn, mech.pos, {
x: 0, x: 0,
y: mech.jumpForce * 0.12 * Math.min(mech.standingOn.mass, 5) y: mech.jumpForce * 0.12 * Math.min(mech.standingOn.mass, 5)
}); });
player.force.y = -mech.jumpForce; //player jump force player.force.y = -mech.jumpForce; //player jump force
Matter.Body.setVelocity(player, { //zero player y-velocity for consistent jumps Matter.Body.setVelocity(player, { //zero player y-velocity for consistent jumps
x: player.velocity.x, x: player.velocity.x,
y: 0 y: 0
}); });
}
//horizontal move on ground
// function blink(dir) {
// dir *= 6
// mech.fieldCDcycle = mech.cycle + 15;
// for (let i = 0; i < 100; i++) {
// Matter.Body.setPosition(player, {
// x: player.position.x + dir,
// y: player.position.y
// });
// const bounds = {
// min: {
// x: player.bounds.min.x,
// y: player.bounds.min.y
// },
// max: {
// x: player.bounds.max.x,
// y: player.bounds.max.y - 30
// }
// }
// if (Matter.Query.region(map, bounds).length !== 0 || Matter.Query.region(body, bounds).length !== 0) {
// Matter.Body.setPosition(player, {
// x: player.position.x - dir,
// y: player.position.y
// });
// break;
// }
// }
// }
//apply a force to move
if (keys[65] || keys[37]) { //left / a
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(-1)
// } else {
if (player.velocity.x > -2) {
player.force.x -= mech.Fx * 1.5
} else {
player.force.x -= mech.Fx
}
// }
} else if (keys[68] || keys[39]) { //right / d
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(1)
// } else {
if (player.velocity.x < 2) {
player.force.x += mech.Fx * 1.5
} else {
player.force.x += mech.Fx
}
// }
} else {
const stoppingFriction = 0.92;
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
//come to a stop if fast or if no move key is pressed
if (player.speed > 4) {
const stoppingFriction = (mech.crouch) ? 0.65 : 0.89; // this controls speed when crouched
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
} else { // in air **********************************
//check for short jumps
if (
mech.buttonCD_jump + 60 > mech.cycle && //just pressed jump
!(keys[87] || keys[38]) && //but not pressing jump key
mech.Vy < 0 //moving up
) {
Matter.Body.setVelocity(player, {
//reduce player y-velocity every cycle
x: player.velocity.x,
y: player.velocity.y * 0.94
});
}
const limit = 125 / player.mass / player.mass
if (keys[65] || keys[37]) {
if (player.velocity.x > -limit) player.force.x -= mech.FxAir; // move player left / a
} 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 if (keys[65] || keys[37]) { //left / a
mech.yOff = mech.yOff * 0.85 + mech.yOffGoal * 0.15; // if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(-1)
// } else {
if (player.velocity.x > -2) {
player.force.x -= mech.Fx * 1.5
} else {
player.force.x -= mech.Fx
}
// }
} else if (keys[68] || keys[39]) { //right / d
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(1)
// } else {
if (player.velocity.x < 2) {
player.force.x += mech.Fx * 1.5
} else {
player.force.x += mech.Fx
}
// }
} else {
const stoppingFriction = 0.92;
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
//come to a stop if fast or if no move key is pressed
if (player.speed > 4) {
const stoppingFriction = (mech.crouch) ? 0.65 : 0.89; // this controls speed when crouched
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
},
airControl() {
//check for short jumps //moving up //recently pressed jump //but not pressing jump key now
if (mech.buttonCD_jump + 60 > mech.cycle && !(keys[87] || keys[38]) && mech.Vy < 0) {
Matter.Body.setVelocity(player, {
//reduce player y-velocity every cycle
x: player.velocity.x,
y: player.velocity.y * 0.94
});
}
if (keys[65] || keys[37]) {
if (player.velocity.x > -mech.airSpeedLimit / player.mass / player.mass) player.force.x -= mech.FxAir; // move player left / a
} else if (keys[68] || keys[39]) {
if (player.velocity.x < mech.airSpeedLimit / player.mass / player.mass) player.force.x += mech.FxAir; //move player right / d
}
}, },
alive: false, alive: false,
death() { death() {
@@ -374,6 +324,7 @@ const mech = {
if (mod.mods[i].count < mod.mods[i].maxCount && if (mod.mods[i].count < mod.mods[i].maxCount &&
!mod.mods[i].isNonRefundable && !mod.mods[i].isNonRefundable &&
mod.mods[i].name !== "quantum immortality" && mod.mods[i].name !== "quantum immortality" &&
mod.mods[i].name !== "determinism" &&
mod.mods[i].allowed() mod.mods[i].allowed()
) options.push(i); ) options.push(i);
} }
@@ -507,7 +458,7 @@ const mech = {
immuneCycle: 0, //used in engine immuneCycle: 0, //used in engine
harmReduction() { harmReduction() {
let dmg = 1 let dmg = 1
dmg *= mech.fieldDamageResistance dmg *= mech.fieldHarmReduction
dmg *= mod.isSlowFPS ? 0.85 : 1 dmg *= mod.isSlowFPS ? 0.85 : 1
if (mod.energyRegen === 0) dmg *= 0.5 //0.22 + 0.78 * mech.energy //77% damage reduction at zero energy if (mod.energyRegen === 0) dmg *= 0.5 //0.22 + 0.78 * mech.energy //77% damage reduction at zero energy
if (mod.isEntanglement && b.inventory[0] === b.activeGun) { if (mod.isEntanglement && b.inventory[0] === b.activeGun) {
@@ -539,7 +490,7 @@ const mech = {
dmg *= mech.harmReduction() dmg *= mech.harmReduction()
if (mod.isEnergyHealth) { if (mod.isEnergyHealth) {
mech.energy -= dmg; mech.energy -= dmg * 1.25; //energy takes an extra 25% damage for balancing purposes
if (mech.energy < 0 || isNaN(mech.energy)) { if (mech.energy < 0 || isNaN(mech.energy)) {
if (mod.isDeathAvoid && powerUps.reroll.rerolls) { //&& Math.random() < 0.5 if (mod.isDeathAvoid && powerUps.reroll.rerolls) { //&& Math.random() < 0.5
powerUps.reroll.changeRerolls(-1) powerUps.reroll.changeRerolls(-1)
@@ -730,6 +681,7 @@ const mech = {
// ctx.fillStyle = '#9cf' //'#0cf'; // ctx.fillStyle = '#9cf' //'#0cf';
// ctx.fill() // ctx.fill()
ctx.restore(); ctx.restore();
mech.yOff = mech.yOff * 0.85 + mech.yOffGoal * 0.15; //smoothly move leg height towards height goal
}, },
// ********************************************* // *********************************************
// **************** fields ********************* // **************** fields *********************
@@ -754,7 +706,7 @@ const mech = {
fieldRegen: 0, fieldRegen: 0,
fieldMode: 0, fieldMode: 0,
fieldFire: false, fieldFire: false,
fieldDamageResistance: 1, fieldHarmReduction: 1,
holdingMassScale: 0, holdingMassScale: 0,
fieldArc: 0, fieldArc: 0,
fieldThreshold: 0, fieldThreshold: 0,
@@ -766,14 +718,18 @@ const mech = {
mech.fieldRegen = mod.energyRegen; //0.001 mech.fieldRegen = mod.energyRegen; //0.001
mech.fieldMeterColor = "#0cf" mech.fieldMeterColor = "#0cf"
mech.fieldShieldingScale = 1; mech.fieldShieldingScale = 1;
mech.fieldBlockCD = 10;
game.isBodyDamage = true; game.isBodyDamage = true;
mech.fieldDamageResistance = 1; mech.fieldHarmReduction = 1;
mech.fieldRange = 155; mech.fieldRange = 155;
mech.fieldFire = false; mech.fieldFire = false;
mech.fieldCDcycle = 0; mech.fieldCDcycle = 0;
mech.isStealth = false; mech.isStealth = false;
player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield
mech.airSpeedLimit = 125
mech.drop();
mech.holdingMassScale = 0.5; mech.holdingMassScale = 0.5;
mech.fieldArc = 0.2; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob) mech.fieldArc = 0.2; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
mech.calculateFieldThreshold(); //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob) mech.calculateFieldThreshold(); //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
mech.isBodiesAsleep = true; mech.isBodiesAsleep = true;
@@ -1059,7 +1015,7 @@ const mech = {
x: player.velocity.x - (15 * unit.x) / massRoot, x: player.velocity.x - (15 * unit.x) / massRoot,
y: player.velocity.y - (15 * unit.y) / massRoot y: player.velocity.y - (15 * unit.y) / massRoot
}); });
mech.fieldCDcycle = mech.cycle + 10; mech.fieldCDcycle = mech.cycle + mech.fieldBlockCD;
if (mech.crouch) { if (mech.crouch) {
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x + 0.4 * unit.x * massRoot, x: player.velocity.x + 0.4 * unit.x * massRoot,
@@ -1267,6 +1223,7 @@ const mech = {
description: "three oscillating <strong>shields</strong> are permanently active<br><strong class='color-f'>energy</strong> regenerates while field is active", description: "three oscillating <strong>shields</strong> are permanently active<br><strong class='color-f'>energy</strong> regenerates while field is active",
isEasyToAim: true, isEasyToAim: true,
effect: () => { effect: () => {
mech.fieldBlockCD = 0;
mech.hold = function () { mech.hold = function () {
if (mech.isHolding) { if (mech.isHolding) {
mech.drawHold(mech.holdingTarget); mech.drawHold(mech.holdingTarget);
@@ -1281,9 +1238,9 @@ 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) 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 > 0.1 && mech.fieldCDcycle < mech.cycle) { if (mech.energy > 0.1 && mech.fieldCDcycle < mech.cycle) {
const fieldRange1 = (0.6 + 0.35 * Math.sin(mech.cycle / 23)) * mech.fieldRange const fieldRange1 = (0.7 + 0.3 * Math.sin(mech.cycle / 23)) * mech.fieldRange
const fieldRange2 = (0.55 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange const fieldRange2 = (0.6 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange
const fieldRange3 = (0.5 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange const fieldRange3 = (0.55 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange
const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3) const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3)
ctx.fillStyle = "rgba(110,170,200," + (0.04 + mech.energy * (0.12 + 0.13 * Math.random())) + ")"; ctx.fillStyle = "rgba(110,170,200," + (0.04 + mech.energy * (0.12 + 0.13 * Math.random())) + ")";
ctx.beginPath(); ctx.beginPath();
@@ -1419,16 +1376,21 @@ const mech = {
}, },
{ {
name: "negative mass field", name: "negative mass field",
description: "use <strong class='color-f'>energy</strong> to nullify &nbsp; <strong style='letter-spacing: 12px;'>gravity</strong><br>reduce <strong>harm</strong> by <strong>80%</strong> while field is active", description: "use <strong class='color-f'>energy</strong> to nullify &nbsp; <strong style='letter-spacing: 12px;'>gravity</strong><br>reduce <strong>harm</strong> by <strong>60%</strong>",
fieldDrawRadius: 0, fieldDrawRadius: 0,
isEasyToAim: true, isEasyToAim: true,
effect: () => { effect: () => {
mech.fieldFire = true; mech.fieldFire = true;
mech.holdingMassScale = 0.03; //can hold heavier blocks with lower cost to jumping mech.holdingMassScale = 0.03; //can hold heavier blocks with lower cost to jumping
mech.fieldMeterColor = "#000" mech.fieldMeterColor = "#000"
if (mod.isHarmReduce) {
mech.fieldHarmReduction = 0.2;
} else {
mech.fieldHarmReduction = 0.4;
}
mech.hold = function () { mech.hold = function () {
mech.fieldDamageResistance = 1; mech.airSpeedLimit = 125 //5 * player.mass * player.mass
mech.FxAir = 0.016
if (mech.isHolding) { if (mech.isHolding) {
mech.drawHold(mech.holdingTarget); mech.drawHold(mech.holdingTarget);
mech.holding(); mech.holding();
@@ -1436,16 +1398,10 @@ const mech = {
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
let DRAIN = 0.00105; const DRAIN = 0.00035
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
if (mod.isHarmReduce) { mech.airSpeedLimit = 400 // 7* player.mass * player.mass
mech.fieldDamageResistance = 0.1; // 1 - 0.9 mech.FxAir = 0.005
DRAIN = 0.0007 //2x energy drain
} else {
mech.fieldDamageResistance = 0.2; // 1 - 0.8
DRAIN = 0.00035
}
// mech.pushMobs360(); // mech.pushMobs360();
//repulse mobs //repulse mobs
@@ -1499,12 +1455,12 @@ const mech = {
if (keys[65] || keys[68] || keys[37] || keys[39]) { if (keys[65] || keys[68] || keys[37] || keys[39]) {
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x * 0.99, x: player.velocity.x * 0.99,
y: player.velocity.y * 0.97 y: player.velocity.y * 0.98
}); });
} else { //slow rise and fall } else { //slow rise and fall
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x, x: player.velocity.x * 0.99,
y: player.velocity.y * 0.97 y: player.velocity.y * 0.98
}); });
} }
@@ -1554,11 +1510,11 @@ 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>reduce <strong>harm</strong> by <strong>33%</strong>", description: "use <strong class='color-f'>energy</strong> to emit <strong class='color-d'>damaging</strong> plasma<br>reduce <strong>harm</strong> by <strong>20%</strong>",
isEasyToAim: false, isEasyToAim: false,
effect: () => { effect: () => {
mech.fieldMeterColor = "#f0f" mech.fieldMeterColor = "#f0f"
mech.fieldDamageResistance = 0.67; //reduce harm by 33% mech.fieldHarmReduction = 0.80;
mech.hold = function () { mech.hold = function () {
if (mech.isHolding) { if (mech.isHolding) {
@@ -1568,7 +1524,7 @@ const mech = {
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
const DRAIN = 0.001 const DRAIN = 0.0013
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
if (mech.energy < 0) { if (mech.energy < 0) {
@@ -2065,7 +2021,7 @@ const mech = {
for (let i = 0, len = body.length; i < len; ++i) { for (let i = 0, len = body.length; i < len; ++i) {
if (Vector.magnitude(Vector.sub(body[i].position, mech.fieldPosition)) < mech.fieldRadius) { if (Vector.magnitude(Vector.sub(body[i].position, mech.fieldPosition)) < mech.fieldRadius) {
const DRAIN = speed * body[i].mass * 0.000022 const DRAIN = speed * body[i].mass * 0.000018
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
Matter.Body.setVelocity(body[i], velocity); //give block mouse velocity Matter.Body.setVelocity(body[i], velocity); //give block mouse velocity

View File

@@ -391,7 +391,7 @@ const powerUps = {
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
if (game.difficultyMode > 1 || Math.random() < 0.66) { //easy and normal have only a 66% chance for a power up if (game.difficultyMode > 1 || Math.random() < 0.66) { //easy and normal have only a 66% chance for a power up
spawnPowerUps() spawnPowerUps()
if (game.difficultyMode > 2 && Math.random() < 0.33) spawnPowerUps() //why? has a 33% chance for an extra power up if (game.difficultyMode > 2 && level.levelsCleared % 2 == 0) spawnPowerUps() //why? has an extra power up on even numbered levels
} else { } else {
if (mech.health < 0.65 && !mod.isEnergyHealth) { if (mech.health < 0.65 && !mod.isEnergyHealth) {
powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal");
@@ -416,7 +416,7 @@ const powerUps = {
} else if (Math.random() < 0.5) { } else if (Math.random() < 0.5) {
powerUps.spawn(x, y, "gun") powerUps.spawn(x, y, "gun")
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "gun") if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "gun")
} else if (mech.health < 0.65 && !mod.isEnergyHealth) { } else if (mech.health < 0.65 && !mod.isEnergyHealth || mod.bayesian) {
powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal");
powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal");
powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal");
@@ -427,7 +427,7 @@ const powerUps = {
powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal");
powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal");
} }
} else if (!mod.bayesian) { } else {
powerUps.spawn(x, y, "ammo"); powerUps.spawn(x, y, "ammo");
powerUps.spawn(x, y, "ammo"); powerUps.spawn(x, y, "ammo");
powerUps.spawn(x, y, "ammo"); powerUps.spawn(x, y, "ammo");

View File

@@ -83,7 +83,8 @@ const spawn = {
}, },
randomLevelBoss(x, y) { randomLevelBoss(x, y) {
// other bosses: suckerBoss, laserBoss, tetherBoss, snakeBoss //all need a particular level to work so they are not included // other bosses: suckerBoss, laserBoss, tetherBoss, snakeBoss //all need a particular level to work so they are not included
const options = ["shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss"] // , "timeSkipBoss" // "shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss",
const options = ["laserTargetingBoss"] // , "timeSkipBoss"
spawn[options[Math.floor(Math.random() * options.length)]](x, y) spawn[options[Math.floor(Math.random() * options.length)]](x, y)
}, },
//mob templates ********************************************************************************************* //mob templates *********************************************************************************************

View File

@@ -1,25 +1,25 @@
mod: doubles current bots harmonic field now has no cooldown after blocking
mod: shotgun fires nails negative mass field accelerates slower, but with a higher top speed
difficulty mode why? now has 33% chance for a second boss power up negative mass field harm reduction is now 60% and always on
difficulty mode normal and easy now have a 33% lower chance for a boss power up mod degenerate matter increases the damage reduction from 60% to 80%
mob: sniper
mob boss: Laser Targeting (might need balancing)
falling damage and damage from blocks have been removed
(I'm trying it out, let me know if you want it back)
************** TODO - n-gon ************** ************** TODO - n-gon **************
maybe increase chance of boss power ups on why difficulty add air control check box
hard as well? set mech.airSpeedLimit to 0? to disable
mod - shotgun: fire nails instead of bullets on damage mines mod needs a nerf
gain range? spawns 2 mines every time... (from on dmg effects)
give rail gun projectile a trail
only draw above speed 5
track previous positions?
shielded mobs don't knock back the same as unshielded mobs shielded mobs don't knock back the same as unshielded mobs
buff harmonic field
cover legs?
no flicker after blocking?
movement fluidity movement fluidity
let legs jump on mobs, but player will still take damage let legs jump on mobs, but player will still take damage
like: ori and the blind forest, celeste like: ori and the blind forest, celeste
@@ -41,9 +41,6 @@ new type of mob vision that uses ray query with thickness
bug - mines spawn extra mines when fired at thin map wall while jumping bug - mines spawn extra mines when fired at thin map wall while jumping
mod - negative mass field move faster
less friction, more like flying?
what about a neutron bomb mod, that causes the bomb to activate right after you fire and slowly move forward with no gravity what about a neutron bomb mod, that causes the bomb to activate right after you fire and slowly move forward with no gravity
redblobgames.com/articles/visibility redblobgames.com/articles/visibility