added player history

balance: mod capacitor - gives 1% damage for every 7% energy (was 5.5%)
some fixes on community level detour
added a once every 7 second check to try to undo the crouch bug
  (I have no idea how to crouch bug is happening, so I can't even test this fix)

mod: slow light propagation - laser is divided into your past, and increase total damage by 200%
  let me know about balance (is this too strong or too weak)
This commit is contained in:
landgreen
2020-11-24 06:40:25 -08:00
parent 463bacc977
commit 313a9f861f
7 changed files with 319 additions and 128 deletions

View File

@@ -52,7 +52,7 @@ const mech = {
});
World.add(engine.world, mech.holdConstraint);
},
cycle: 0,
cycle: 300, //starts at 300 cycles instead of 0 to prevent bugs with mech.history
lastKillCycle: 0,
lastHarmCycle: 0,
width: 50,
@@ -65,7 +65,6 @@ const mech = {
light: 100,
},
setFillColors() {
// console.log(mech.color)
this.fillColor = `hsl(${mech.color.hue},${mech.color.sat}%,${mech.color.light}%)`
this.fillColorDark = `hsl(${mech.color.hue},${mech.color.sat}%,${mech.color.light-20}%)`
},
@@ -134,7 +133,26 @@ const mech = {
legLength2: 45,
transX: 0,
transY: 0,
history: [], //tracks the last second of player position
move() {
//tracks the last second of player information
// console.log(mech.history)
mech.history.splice(mech.cycle % 300, 1, {
position: {
x: mech.pos.x,
y: mech.pos.y,
},
velocity: {
x: player.velocity.x,
y: player.velocity.y
},
angle: mech.angle,
health: mech.health,
energy: mech.energy,
});
// const back = 59 // 59 looks at 1 second ago //29 looks at 1/2 a second ago
// historyIndex = (mech.cycle - back) % 60
mech.pos.x = player.position.x;
mech.pos.y = playerBody.position.y - mech.yOff;
mech.Vx = player.velocity.x;
@@ -1344,26 +1362,23 @@ const mech = {
mech.hold = function() {
if (mech.energy > mech.maxEnergy - 0.02 && mech.fieldCDcycle < mech.cycle && !input.field) {
if (mod.isSporeField) {
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
const len = Math.floor(5 + 5 * Math.random())
mech.energy -= len * 0.1;
const len = Math.floor(5 + 4 * Math.random())
mech.energy -= len * 0.105;
for (let i = 0; i < len; i++) {
b.spore(mech.pos)
}
} else if (mod.isMissileField) {
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
mech.energy -= 0.5;
mech.energy -= 0.55;
b.missile({ x: mech.pos.x, y: mech.pos.y - 40 }, -Math.PI / 2, 0, 1, mod.recursiveMissiles)
} else if (mod.isIceField) {
// mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
mech.energy -= 0.05;
mech.energy -= 0.057;
b.iceIX(1)
} else {
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
mech.energy -= 0.35;
mech.energy -= 0.4;
b.drone(1)
}
}
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();