game balance - foam,harmonic field, laser mob

This commit is contained in:
landgreen
2019-12-20 06:15:32 -08:00
parent 48819459da
commit 0855064363
5 changed files with 32 additions and 51 deletions

View File

@@ -94,8 +94,6 @@
</g> </g>
</svg> </svg>
<div id="settings"> <div id="settings">
<details> <details>
<summary>settings</summary> <summary>settings</summary>

View File

@@ -1731,7 +1731,7 @@ const b = {
name: "foam", //15 name: "foam", //15
description: "spray bubbly foam that <strong>sticks</strong> to enemies<br>does <strong class='color-d'>damage</strong> over time and <strong>slows</strong> movement", description: "spray bubbly foam that <strong>sticks</strong> to enemies<br>does <strong class='color-d'>damage</strong> over time and <strong>slows</strong> movement",
ammo: 0, ammo: 0,
ammoPack: 95, ammoPack: 90,
have: false, have: false,
isStarterGun: true, isStarterGun: true,
fire() { fire() {
@@ -1788,22 +1788,22 @@ const b = {
if (this.count < 17) { if (this.count < 17) {
this.count++ this.count++
//grow //grow
const SCALE = 1.1 const SCALE = 1.08
Matter.Body.scale(this, SCALE, SCALE); Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE; this.radius *= SCALE;
} else { } else {
//shrink //shrink
const SCALE = 1 - 0.006 / b.isModBulletsLastLonger const SCALE = 1 - 0.0035 / b.isModBulletsLastLonger
Matter.Body.scale(this, SCALE, SCALE); Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE; this.radius *= SCALE;
if (this.radius < 11) this.endCycle = 0; if (this.radius < 14) this.endCycle = 0;
} }
if (this.target && this.target.alive) { //if stuck to a target if (this.target && this.target.alive) { //if stuck to a target
Matter.Body.setPosition(this, this.target.vertices[this.targetVertex]) Matter.Body.setPosition(this, this.target.vertices[this.targetVertex])
Matter.Body.setVelocity(this.target, Matter.Vector.mult(this.target.velocity, 0.94)) Matter.Body.setVelocity(this.target, Matter.Vector.mult(this.target.velocity, 0.94))
Matter.Body.setAngularVelocity(this.target, this.target.angularVelocity * 0.94) Matter.Body.setAngularVelocity(this.target, this.target.angularVelocity * 0.94)
this.target.damage(b.dmgScale * 0.0025); this.target.damage(b.dmgScale * 0.004);
} else if (this.target !== null) { //look for a new target } else if (this.target !== null) { //look for a new target
this.target = null this.target = null
this.collisionFilter.category = cat.bullet; this.collisionFilter.category = cat.bullet;
@@ -1813,8 +1813,8 @@ const b = {
} }
}); });
World.add(engine.world, bullet[me]); //add bullet to world World.add(engine.world, bullet[me]); //add bullet to world
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 15 : 4) * b.modFireRate); // cool down mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 12 : 4) * b.modFireRate); // cool down
const SPEED = mech.crouch ? 20 : 14 - RADIUS * 0.25; const SPEED = mech.crouch ? 22 : 12 - RADIUS * 0.25;
Matter.Body.setVelocity(bullet[me], { Matter.Body.setVelocity(bullet[me], {
x: SPEED * Math.cos(dir), x: SPEED * Math.cos(dir),
y: SPEED * Math.sin(dir) y: SPEED * Math.sin(dir)

View File

@@ -98,21 +98,6 @@ game mechanics
low friction ground low friction ground
bouncy ground bouncy ground
// collision info:
category mask
powerUp: 0x100000 0x100001
body: 0x010000 0x011111
player: 0x001000 0x010011
bullet: 0x000100 0x010011
mob: 0x000010 0x011111
mobBullet: 0x000010 0x011101
mobShield: 0x000010 0x001100
map: 0x000001 0x111111
*/ */
//collision groups //collision groups
// cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet | cat.mobShield // cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet | cat.mobShield

View File

@@ -362,9 +362,9 @@ const mobs = {
// hitting player // hitting player
if (best.who === player) { if (best.who === player) {
if (b.isModTempResist) { if (b.isModTempResist) {
dmg = 0.0008 * game.dmgScale; dmg = 0.0004 * game.dmgScale;
} else { } else {
dmg = 0.004 * game.dmgScale; dmg = 0.002 * game.dmgScale;
} }
mech.damage(dmg); mech.damage(dmg);

View File

@@ -849,7 +849,6 @@ const mech = {
ctx.stroke(); ctx.stroke();
}, },
grabPowerUp() { //look for power ups to grab with field grabPowerUp() { //look for power ups to grab with field
if (mech.fieldCDcycle < mech.cycle) {
const grabPowerUpRange2 = (mech.grabRange + 220) * (mech.grabRange + 220) const grabPowerUpRange2 = (mech.grabRange + 220) * (mech.grabRange + 220)
for (let i = 0, len = powerUp.length; i < len; ++i) { for (let i = 0, len = powerUp.length; i < len; ++i) {
const dxP = mech.pos.x - powerUp[i].position.x; const dxP = mech.pos.x - powerUp[i].position.x;
@@ -875,7 +874,6 @@ const mech = {
}); });
} }
} }
}
}, },
pushMass(who) { pushMass(who) {
const speed = Matter.Vector.magnitude(Matter.Vector.sub(who.velocity, player.velocity)) const speed = Matter.Vector.magnitude(Matter.Vector.sub(who.velocity, player.velocity))
@@ -1056,7 +1054,7 @@ const mech = {
mech.drawHold(mech.holdingTarget); mech.drawHold(mech.holdingTarget);
mech.holding(); mech.holding();
mech.throw(); mech.throw();
} else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.1 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed } else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.05 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
mech.drawField(); mech.drawField();
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
@@ -1402,7 +1400,7 @@ const mech = {
mech.fieldMode = 4; mech.fieldMode = 4;
mech.fieldText(); mech.fieldText();
mech.setHoldDefaults(); mech.setHoldDefaults();
mech.fieldRegen *= 0.5; mech.fieldRegen *= 0.6;
mech.fieldShieldingScale = 1.5; mech.fieldShieldingScale = 1.5;
mech.hold = function () { mech.hold = function () {