laser boss

added laser boss, getting ready for new map
limit on born rule spawn
some gun balance
Pauli exclusion buff
This commit is contained in:
landgreen
2020-01-24 04:52:23 -08:00
parent 95c09efc5e
commit c7e85dcc02
8 changed files with 192 additions and 65 deletions

View File

@@ -865,39 +865,27 @@ const mech = {
const dyP = mech.pos.y - powerUp[i].position.y;
const dist2 = dxP * dxP + dyP * dyP;
// float towards player if looking at and in range or if very close to player
if (dist2 < grabPowerUpRange2 && (mech.lookingAt(powerUp[i]) || dist2 < 16000)) {
// mech.fieldMeter -= mech.fieldRegen * 0.5;
if (mech.health === mech.maxHealth && powerUp[i].name === "heal" && dist2 < 16000) {
mech.fieldCDcycle = mech.cycle + 30;
//push away
Matter.Body.setVelocity(powerUp[i], {
x: powerUp[i].velocity.x * 0,
y: powerUp[i].velocity.y * 0
});
powerUp[i].force.x -= 0.0005 * dxP * powerUp[i].mass;
powerUp[i].force.y -= 0.0005 * dyP * powerUp[i].mass;
} else {
powerUp[i].force.x += 7 * (dxP / dist2) * powerUp[i].mass;
powerUp[i].force.y += 7 * (dyP / dist2) * powerUp[i].mass - powerUp[i].mass * game.g; //negate gravity
//extra friction
Matter.Body.setVelocity(powerUp[i], {
x: powerUp[i].velocity.x * 0.11,
y: powerUp[i].velocity.y * 0.11
});
if (dist2 < 5000) { //use power up if it is close enough
if (b.isModMassEnergy) {
mech.fieldMeter = mech.fieldEnergyMax;
mech.addHealth(0.05);
}
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.3,
y: player.velocity.y + ((powerUp[i].velocity.y * powerUp[i].mass) / player.mass) * 0.3
});
powerUp[i].effect();
Matter.World.remove(engine.world, powerUp[i]);
powerUp.splice(i, 1);
return; //because the array order is messed up after splice
if (dist2 < grabPowerUpRange2 && (mech.lookingAt(powerUp[i]) || dist2 < 16000) && !(mech.health === mech.maxHealth && powerUp[i].name === "heal")) {
powerUp[i].force.x += 7 * (dxP / dist2) * powerUp[i].mass;
powerUp[i].force.y += 7 * (dyP / dist2) * powerUp[i].mass - powerUp[i].mass * game.g; //negate gravity
//extra friction
Matter.Body.setVelocity(powerUp[i], {
x: powerUp[i].velocity.x * 0.11,
y: powerUp[i].velocity.y * 0.11
});
if (dist2 < 5000) { //use power up if it is close enough
if (b.isModMassEnergy) {
mech.fieldMeter = mech.fieldEnergyMax;
mech.addHealth(0.05);
}
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up
x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.3,
y: player.velocity.y + ((powerUp[i].velocity.y * powerUp[i].mass) / player.mass) * 0.3
});
powerUp[i].effect();
Matter.World.remove(engine.world, powerUp[i]);
powerUp.splice(i, 1);
return; //because the array order is messed up after splice
}
}
}