speed up player movement and gravity

This commit is contained in:
landgreen
2020-02-16 05:01:47 -08:00
parent 749fd0f797
commit 7510fb3f45
6 changed files with 37 additions and 40 deletions

View File

@@ -89,8 +89,8 @@ const b = {
b.isModEnergyRecovery = false; b.isModEnergyRecovery = false;
b.isModHealthRecovery = false; b.isModHealthRecovery = false;
mech.fieldRange = 175; mech.fieldRange = 175;
mech.Fx = 0.015; mech.Fx = 0.016; //if this changes update the values in definePlayerMass
mech.jumpForce = 0.38; mech.jumpForce = 0.42; //was 0.38 at 0.0019 gravity
mech.maxHealth = 1; mech.maxHealth = 1;
mech.fieldEnergyMax = 1; mech.fieldEnergyMax = 1;
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is flak for (i = 0, len = b.guns.length; i < len; i++) { //find which gun is flak
@@ -312,11 +312,11 @@ const b = {
}, },
{ {
name: "field superposition", name: "field superposition",
description: "increase your field <strong>radius</strong> by <strong>40%</strong>", description: "increase your <strong>field radius</strong> by <strong>40%</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return b.modBlockDmg > 0 return mech.fieldUpgrades[mech.fieldMode].name !== "time dilation field" && mech.fieldUpgrades[mech.fieldMode].name !== "phase decoherence field"
}, },
effect() { effect() {
mech.fieldRange = 175 * 1.4 //175 is default mech.fieldRange = 175 * 1.4 //175 is default
@@ -368,7 +368,7 @@ const b = {
}, },
effect() { // good with melee builds, content skipping builds effect() { // good with melee builds, content skipping builds
b.modSquirrelFx += 0.2; b.modSquirrelFx += 0.2;
mech.Fx = 0.015 * b.modSquirrelFx; mech.Fx = 0.016 * b.modSquirrelFx;
mech.jumpForce += 0.038; mech.jumpForce += 0.038;
} }
}, },

View File

@@ -1756,16 +1756,24 @@ const level = {
}); });
target.torque = (Math.random() - 0.5) * 2 * target.mass; target.torque = (Math.random() - 0.5) * 2 * target.mass;
}, },
boost(target, info) { boost(target, yVelocity) {
// if (target.velocity.y < 0) { // if (target.velocity.y < 0) {
// mech.undoCrouch(); // mech.undoCrouch();
// mech.enterAir(); // mech.enterAir();
mech.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts mech.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts
mech.hardLandCD = 0 // disable hard landing mech.hardLandCD = 0 // disable hard landing
if (target.velocity.y > 30) {
Matter.Body.setVelocity(target, { Matter.Body.setVelocity(target, {
x: target.velocity.x + (Math.random() - 0.5) * 2, x: target.velocity.x + (Math.random() - 0.5) * 2,
y: info y: -23 //gentle bounce if coming down super fast
}); });
} else {
Matter.Body.setVelocity(target, {
x: target.velocity.x + (Math.random() - 0.5) * 2,
y: yVelocity
});
}
}, },
force(target, info) { force(target, info) {
if (target.velocity.y < 0) { if (target.velocity.y < 0) {

View File

@@ -614,8 +614,8 @@ const mobs = {
pullPlayer() { pullPlayer() {
if (this.seePlayer.yes && Vector.magnitudeSquared(Vector.sub(this.position, player.position)) < 1000000) { if (this.seePlayer.yes && Vector.magnitudeSquared(Vector.sub(this.position, player.position)) < 1000000) {
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= game.accelScale * 1.13 * Math.cos(angle) * (mech.onGround ? 2 * player.mass * game.g : player.mass * game.g); player.force.x -= game.accelScale * 0.00113 * player.mass * Math.cos(angle) * (mech.onGround ? 2 : 1);
player.force.y -= game.accelScale * 0.84 * player.mass * game.g * Math.sin(angle); player.force.y -= game.accelScale * 0.00084 * player.mass * Math.sin(angle);
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); ctx.moveTo(this.position.x, this.position.y);

View File

@@ -67,8 +67,8 @@ const mech = {
defaultMass: 5, defaultMass: 5,
mass: 5, mass: 5,
FxNotHolding: 0.015, FxNotHolding: 0.015,
Fx: 0.015, //run Force on ground //this is reset in b.setModDefaults() Fx: null, //run Force on ground //0.015 //this is set in b.setModDefaults()
FxAir: 0.015, //run Force in Air FxAir: 0.016, //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
@@ -105,8 +105,8 @@ const mech = {
Sy: 0, //adds a smoothing effect to vertical only Sy: 0, //adds a smoothing effect to vertical only
Vx: 0, Vx: 0,
Vy: 0, Vy: 0,
jumpForce: 0.38, //this is reset in b.setModDefaults() jumpForce: null, //0.38 //this is reset in b.setModDefaults()
gravity: 0.0019, gravity: 0.0024, //0.0019 //game.g is 0.001
friction: { friction: {
ground: 0.01, ground: 0.01,
air: 0.0025 air: 0.0025
@@ -202,21 +202,21 @@ const mech = {
//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 keyMove() on ground section below
const momentum = player.velocity.y * player.mass //player mass is 5 so this triggers at 20 down velocity, unless the player is holding something const momentum = player.velocity.y * player.mass //player mass is 5 so this triggers at 20 down velocity, unless the player is holding something
if (momentum > 120) { 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 - 6, 40) mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40)
// if (b.isModStompPauli) { // if (b.isModStompPauli) {
// mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles // mech.collisionImmune = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles
// } // }
if (b.isModStomp) { if (b.isModStomp) {
const len = Math.min(25, (momentum - 110) * 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 (game.isBodyDamage && player.velocity.y > 26 && momentum > 165 * b.modSquirrelFx) { //falling damage } else if (game.isBodyDamage && player.velocity.y > 27 && momentum > 180 * b.modSquirrelFx) { //falling damage
let dmg = Math.sqrt(momentum - 165) * 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);
} }
@@ -719,8 +719,8 @@ const mech = {
definePlayerMass(mass = mech.defaultMass) { definePlayerMass(mass = mech.defaultMass) {
Matter.Body.setMass(player, mass); Matter.Body.setMass(player, mass);
//reduce air and ground move forces //reduce air and ground move forces
mech.Fx = 0.075 / mass * b.modSquirrelFx mech.Fx = 0.08 / mass * b.modSquirrelFx //base player mass is 5
mech.FxAir = 0.375 / mass / mass mech.FxAir = 0.4 / mass / mass //base player mass is 5
//make player stand a bit lower when holding heavy masses //make player stand a bit lower when holding heavy masses
mech.yOffWhen.stand = Math.max(mech.yOffWhen.crouch, Math.min(49, 49 - (mass - 5) * 6)) mech.yOffWhen.stand = Math.max(mech.yOffWhen.crouch, Math.min(49, 49 - (mass - 5) * 6))
if (mech.onGround && !mech.crouch) mech.yOffGoal = mech.yOffWhen.stand; if (mech.onGround && !mech.crouch) mech.yOffGoal = mech.yOffWhen.stand;

View File

@@ -510,8 +510,8 @@ const spawn = {
mech.damage(0.0002 * game.dmgScale); mech.damage(0.0002 * game.dmgScale);
} }
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= 1.25 * Math.cos(angle) * player.mass * game.g * (mech.onGround ? 1.8 : 1); player.force.x -= 0.00125 * player.mass * Math.cos(angle) * (mech.onGround ? 1.8 : 1);
player.force.y -= 0.96 * player.mass * game.g * Math.sin(angle); player.force.y -= 0.0001 * player.mass * Math.sin(angle);
//draw line to player //draw line to player
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); ctx.moveTo(this.position.x, this.position.y);
@@ -608,8 +608,8 @@ const spawn = {
mech.damage(0.0003 * game.dmgScale); mech.damage(0.0003 * game.dmgScale);
} }
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= 1.3 * Math.cos(angle) * player.mass * game.g * (mech.onGround ? 1.7 : 1); player.force.x -= 0.0013 * Math.cos(angle) * player.mass * (mech.onGround ? 1.7 : 1);
player.force.y -= 1.2 * Math.sin(angle) * player.mass * game.g; player.force.y -= 0.0013 * Math.sin(angle) * player.mass;
//draw line to player //draw line to player
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); ctx.moveTo(this.position.x, this.position.y);
@@ -1713,7 +1713,7 @@ const spawn = {
// level.addZone(x, y, 100, 30, "fling", {Vx:Vx, Vy: Vy}); // level.addZone(x, y, 100, 30, "fling", {Vx:Vx, Vy: Vy});
level.addQueryRegion(x, y - 20, 100, 20, "boost", [ level.addQueryRegion(x, y - 20, 100, 20, "boost", [
[player], body, mob, powerUp, bullet [player], body, mob, powerUp, bullet
], -1.1 * Math.sqrt(Math.abs(height))); ], -1.21 * Math.sqrt(Math.abs(height)));
let color = "rgba(200,0,255,"; let color = "rgba(200,0,255,";
level.fillBG.push({ level.fillBG.push({
x: x, x: x,

13
todo.md
View File

@@ -1,5 +1,3 @@
<!--
mod - nano scale field makes spores instead of drones mod - nano scale field makes spores instead of drones
mod - mines - fire something instead of needles on activation mod - mines - fire something instead of needles on activation
@@ -33,20 +31,11 @@ mod: foam - does extra poison dmg (to get past shields)
mod: vacuum bomb - does a constant suck mod: vacuum bomb - does a constant suck
mod: shield harmonics - large field radius
mod: shotgun - fire extra shot mod: shotgun - fire extra shot
but also increase spread? but also increase spread?
speed up movement for all gameplay
higher gravity, larger jump force
faster horizontal acceleration
only increase top speed a bit
mob: targeting laser, then a high speed, no gravity bullet mob: targeting laser, then a high speed, no gravity bullet
add difficulty slider to custom?
add recursive mod counts to pause screen add recursive mod counts to pause screen
css transition for pause menu css transition for pause menu
@@ -150,4 +139,4 @@ game mechanics
map zones map zones
water water
low friction ground low friction ground
bouncy ground --> bouncy ground