minor bug fixes

This commit is contained in:
landgreen
2019-12-11 05:52:52 -08:00
committed by GitHub
parent e3022bea0c
commit 69c5a2bc33
4 changed files with 16 additions and 14 deletions

View File

@@ -102,7 +102,7 @@ const b = {
}, },
{ {
name: "ceramic plating", name: "ceramic plating",
description: "protection from to high <strong>temperatures</strong><br>5x less <strong class='color-d'>damage</strong> from <strong class='color-e'>explosions</strong>, lasers", description: "protection from to high <strong>temperatures</strong><br>5x less <strong class='color-d'>damage</strong> from <strong class='color-e'>explosions</strong> and lasers",
have: false, //5 have: false, //5
effect: () => { effect: () => {
b.isModTempResist = true; //good for guns with explosions b.isModTempResist = true; //good for guns with explosions
@@ -174,7 +174,7 @@ const b = {
}, },
{ {
name: "Gauss rifle", name: "Gauss rifle",
description: "<strong>launch blocks</strong> at much higher speeds<br>carry more massive blocks", description: "<strong>launch blocks</strong> at much higher speeds<br>hold onto larger blocks even after getting hit",
have: false, //14 have: false, //14
effect: () => { // good with guns that run out of ammo effect: () => { // good with guns that run out of ammo
mech.throwChargeRate = 4; mech.throwChargeRate = 4;
@@ -398,7 +398,7 @@ const b = {
}, },
explode(me) { explode(me) {
// typically explode is used for some bullets with .onEnd // typically explode is used for some bullets with .onEnd
const radius = bullet[me].explodeRad * b.modExplosionRadius let radius = bullet[me].explodeRad * b.modExplosionRadius
//add dmg to draw queue //add dmg to draw queue
game.drawList.push({ game.drawList.push({
x: bullet[me].position.x, x: bullet[me].position.x,
@@ -482,7 +482,8 @@ const b = {
knock = Matter.Vector.mult(Matter.Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 18); knock = Matter.Vector.mult(Matter.Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 18);
mob[i].force.x += knock.x; mob[i].force.x += knock.x;
mob[i].force.y += knock.y; mob[i].force.y += knock.y;
damageScale *= 0.8 //reduced damage for each additional explosion target radius *= 0.9 //reduced range for each additional explosion target
damageScale *= 0.9 //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 = Matter.Vector.mult(Matter.Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 35); knock = Matter.Vector.mult(Matter.Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 35);
@@ -1222,7 +1223,7 @@ const b = {
name: "flak", //8 name: "flak", //8
description: "fire a cluster of short range projectiles<br><strong class='color-e'>explodes</strong> on contact or after half a second", description: "fire a cluster of short range projectiles<br><strong class='color-e'>explodes</strong> on contact or after half a second",
ammo: 0, ammo: 0,
ammoPack: 20, ammoPack: 22,
have: false, have: false,
isStarterGun: true, isStarterGun: true,
fire() { fire() {
@@ -1265,7 +1266,7 @@ const b = {
name: "grenades", //9 name: "grenades", //9
description: "lob a single bouncy projectile<br><strong class='color-e'>explodes</strong> on contact or after one second", description: "lob a single bouncy projectile<br><strong class='color-e'>explodes</strong> on contact or after one second",
ammo: 0, ammo: 0,
ammoPack: 9, ammoPack: 10,
have: false, have: false,
isStarterGun: false, isStarterGun: false,
fire() { fire() {
@@ -1278,9 +1279,10 @@ const b = {
bullet[me].totalCycles = 100; bullet[me].totalCycles = 100;
bullet[me].endCycle = game.cycle + Math.floor((mech.crouch ? 120 : 60) * b.isModBulletsLastLonger); bullet[me].endCycle = game.cycle + Math.floor((mech.crouch ? 120 : 60) * b.isModBulletsLastLonger);
bullet[me].restitution = 0.5; bullet[me].restitution = 0.5;
bullet[me].explodeRad = 210; bullet[me].explodeRad = 270;
bullet[me].onEnd = b.explode; //makes bullet do explosive damage before despawn bullet[me].onEnd = b.explode; //makes bullet do explosive damage before despawn
bullet[me].minDmgSpeed = 1; bullet[me].minDmgSpeed = 1;
Matter.Body.setDensity(bullet[me], 0.0002);
bullet[me].onDmg = function () { bullet[me].onDmg = function () {
this.endCycle = 0; //bullet ends cycle after doing damage //this also triggers explosion this.endCycle = 0; //bullet ends cycle after doing damage //this also triggers explosion
}; };
@@ -1311,6 +1313,7 @@ const b = {
bullet[me].inertia = Infinity; //prevents rotation bullet[me].inertia = Infinity; //prevents rotation
bullet[me].restitution = 0; bullet[me].restitution = 0;
bullet[me].friction = 1; bullet[me].friction = 1;
Matter.Body.setDensity(bullet[me], 0.0002);
bullet[me].explodeRad = 380 + Math.floor(Math.random() * 60); bullet[me].explodeRad = 380 + Math.floor(Math.random() * 60);
bullet[me].onEnd = b.explode; //makes bullet do explosive damage before despawn bullet[me].onEnd = b.explode; //makes bullet do explosive damage before despawn
@@ -1724,9 +1727,8 @@ const b = {
} }
} }
const FIELD_DRAIN = 0.0016 if (this.lockedOn && this.lockedOn.alive && mech.fieldMeter > 0.15) { //hit target with laser
if (this.lockedOn && this.lockedOn.alive && mech.fieldMeter > FIELD_DRAIN) { //hit target with laser mech.fieldMeter -= 0.0016
mech.fieldMeter -= FIELD_DRAIN
//make sure you can still see target //make sure you can still see target
const DIST = Matter.Vector.magnitude(Matter.Vector.sub(this.vertices[0], this.lockedOn.position)); const DIST = Matter.Vector.magnitude(Matter.Vector.sub(this.vertices[0], this.lockedOn.position));

View File

@@ -187,8 +187,8 @@ document.getElementById("build-button").addEventListener("click", () => {
</g> </g>
</svg> </svg>
</div> </div>
<div class="build-grid-module" style="font-size: 19px; line-height: 110%;"> <div class="build-grid-module" style="font-size: 0.85em; line-height: 170%;">
Choose up to five power ups. Once you start, only health and ammo will drop, so pick carefully. Choose five power ups.<br>Click start to begin.
</div>` </div>`
for (let i = 1, len = mech.fieldUpgrades.length; i < len; i++) { for (let i = 1, len = mech.fieldUpgrades.length; i < len; i++) {
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'field')" ><div class="circle-grid field"></div> &nbsp; <strong style='font-size:1.3em;'>${mech.fieldUpgrades[i].name}</strong><br> ${mech.fieldUpgrades[i].description}</div>` text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'field')" ><div class="circle-grid field"></div> &nbsp; <strong style='font-size:1.3em;'>${mech.fieldUpgrades[i].name}</strong><br> ${mech.fieldUpgrades[i].description}</div>`

View File

@@ -461,7 +461,7 @@ const mech = {
// freeze game and display a full screen red color // freeze game and display a full screen red color
if (dmg > 0.05) { if (dmg > 0.05) {
this.drop(); //drop block if holding if (dmg > 0.07 && mech.holdingMassScale > 0.2) this.drop(); //drop block if holding
game.fpsCap = 4 //40 - Math.min(25, 100 * dmg) game.fpsCap = 4 //40 - Math.min(25, 100 * dmg)
game.fpsInterval = 1000 / game.fpsCap; game.fpsInterval = 1000 / game.fpsCap;
} else { } else {

View File

@@ -70,7 +70,7 @@ summary {
display: none; display: none;
/* display: grid; */ /* display: grid; */
grid-template-columns: repeat(auto-fit, minmax(292px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-auto-rows: minmax(auto, auto); grid-auto-rows: minmax(auto, auto);
grid-gap: 15px; grid-gap: 15px;