foam gun, mods: overcharge, supersaturate, many background adjustments

This commit is contained in:
landgreen
2019-12-15 07:43:34 -08:00
committed by GitHub
parent 320f0ef28c
commit 66479c9b82
8 changed files with 216 additions and 207 deletions

View File

@@ -71,7 +71,7 @@ const b = {
{
name: "fluoroantimonic acid",
description: "each bullet does extra chemical <strong class='color-d'>damage</strong><br>instant damage, unaffected by momentum",
have: false, //11
have: false, //1
effect: () => { //good with guns that fire many bullets at low speeds, minigun, drones, junk-bots, shotgun, superballs, wavebeam
b.modExtraDmg = 0.1
}
@@ -79,7 +79,7 @@ const b = {
{
name: "fracture analysis",
description: "<strong>5x</strong> physical <strong class='color-d'>damage</strong> to unaware enemies<br><em>unaware enemies don't have a health bar</em>",
have: false, //16
have: false, //2
effect: () => { // good with high damage guns that strike from a distance: rail gun, drones, flechettes, spores, grenade, vacuum bomb
b.modIsCrit = true;
}
@@ -87,7 +87,7 @@ const b = {
{
name: "kinetic bombardment",
description: "do extra <strong class='color-d'>damage</strong> from a distance<br><em>up to 50% increase at about 30 steps away</em>",
have: false, //17
have: false, //3
effect: () => { // good with annihilation, melee builds
b.isModFarAwayDmg = true; //used in mob.damage()
}
@@ -95,7 +95,7 @@ const b = {
{
name: "quasistatic equilibrium",
description: "do extra <strong class='color-d'>damage</strong> at low health<br><em>up to 50% increase when near death</em>",
have: false, //18
have: false, //4
effect: () => { // good with annihilation, melee builds
b.isModLowHealthDmg = true; //used in mob.damage()
}
@@ -103,7 +103,7 @@ const b = {
{
name: "auto-loading heuristics",
description: "your <strong>delay</strong> after firing is 15% <strong>shorter</strong>",
have: false, //1
have: false, //5
effect: () => { //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls
b.modFireRate = 0.85
}
@@ -111,7 +111,7 @@ const b = {
{
name: "desublimated ammunition",
description: "use 50% less <strong>ammo</strong> when <strong>crouching</strong>",
have: false, //2
have: false, //6
effect: () => { //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray
b.modNoAmmo = 1
}
@@ -119,7 +119,7 @@ const b = {
{
name: "Lorentzian topology",
description: "your <strong>bullets</strong> last 40% <strong>longer</strong>",
have: false, //3
have: false, //7
effect: () => { //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
b.isModBulletsLastLonger = 1.40
}
@@ -127,7 +127,7 @@ const b = {
{
name: "zoospore vector",
description: "enemies can discharge <strong style='letter-spacing: 2px;'>spores</strong> on <strong>death</strong><br><strong style='letter-spacing: 2px;'>spores</strong> seek out enemies",
have: false, //7
have: false, //8
effect: () => { //good late game maybe?
b.modSpores = 0.20;
}
@@ -135,7 +135,7 @@ const b = {
{
name: "ablative synthesis",
description: "rebuild your broken parts as <strong>drones</strong><br>chance to occur after taking <strong class='color-d'>damage</strong>",
have: false, //6
have: false, //9
effect: () => { //makes dangerous situations more survivable
b.isModDroneOnDamage = true;
}
@@ -143,15 +143,15 @@ const b = {
{
name: "annihilation",
description: "after <strong>touching</strong> enemies, they are annihilated<br><em>doesn't trigger health or energy transfer</em>",
have: false, //12
have: false, //10
effect: () => { //good with mods that heal: superconductive healing, entropy transfer
b.modAnnihilation = true
}
},
{
name: "anti-matter cores",
description: "the <strong>radius</strong> of your <strong class='color-e'>explosions</strong> is doubled<br><strong style='opacity:0.3;'>be careful</strong>",
have: false, //4
description: "the <strong>radius</strong> of your <strong class='color-e'>explosions</strong> is doubled<br><em>be careful</em>",
have: false, //11
effect: () => { //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage
//testing at 1.3: grenade(+0.3), missiles, flak, M80
b.modExplosionRadius = 1.8; //good for guns with explosions
@@ -160,15 +160,79 @@ const b = {
{
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> and lasers",
have: false, //5
have: false, //12
effect: () => {
b.isModTempResist = true; //good for guns with explosions
}
},
{
name: "Gauss rifle",
description: "<strong>launch blocks</strong> at much higher speeds<br>hold onto larger blocks even after getting hit",
name: "entanglement",
description: "using your first gun reduces <strong class='color-d'>damage</strong> taken<br><em>scales by <strong>7%</strong> for each gun in your inventory</em>",
have: false, //13
effect: () => { // good with laser-bots
b.isModMonogamy = true
}
},
{
name: "energy transfer",
description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done",
have: false, //14
effect: () => { //good with laser, and all fields
b.modEnergySiphon = 0.2;
}
},
{
name: "entropy transfer",
description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done",
have: false, //15
effect: () => { //good with guns that overkill: one shot, grenade
b.modHealthDrain = 0.015;
}
},
{
name: "overcharge",
description: "charge <strong class='color-f'>energy</strong> <strong>25%</strong> beyond your <strong>maximum</strong>",
have: false, //16
effect: () => {
mech.fieldEnergyMax = 1.25
}
},
{
name: "supersaturation",
description: "<strong class='color-h'>heal</strong> <strong>25%</strong> beyond your <strong>max health</strong>",
have: false, //17
effect: () => {
mech.maxHealth = 1.25
}
},
{
name: "recursive healing",
description: "<strong class='color-h'>healing</strong> power ups bring you to <strong>max health</strong>",
have: false, //18
effect: () => { // good with ablative synthesis, melee builds
b.isModFullHeal = true
}
},
{
name: "mass-energy equivalence",
description: "convert the mass of <strong>power ups</strong> into <strong class='color-f'>energy</strong><br>power ups fill your <strong class='color-f'>energy</strong> and <strong class='color-h'>heal</strong> for +3%",
have: false, //19
effect: () => {
b.isModMassEnergy = true // used in mech.usePowerUp
}
},
{
name: "Bayesian inference",
description: "<strong>20%</strong> chance for double <strong>power ups</strong> to drop",
have: false, //20
effect: () => { // good with long term planning
b.modMoreDrops = 0.20;
}
},
{
name: "Gauss rifle",
description: "<strong>launch blocks</strong> at much higher speeds<br><em>hold onto larger blocks even after getting hit</em>",
have: false, //21
effect: () => { // good with guns that run out of ammo
mech.throwChargeRate = 4;
mech.throwChargeMax = 150;
@@ -178,73 +242,17 @@ const b = {
{
name: "squirrel-cage rotor",
description: "<strong>jump</strong> higher and <strong>move</strong> faster<br>reduced <strong>falling</strong> <strong class='color-d'>damage</strong>",
have: false, //15
have: false, //22
effect: () => { // good with melee builds, content skipping builds
b.modSquirrelFx = 1.2;
mech.Fx = 0.015 * b.modSquirrelFx;
mech.jumpForce = 0.38 * 1.1;
}
},
{
name: "energy transfer",
description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done",
have: false, //8
effect: () => { //good with laser, and all fields
b.modEnergySiphon = 0.2;
}
},
{
name: "entropy transfer",
description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done",
have: false, //9
effect: () => { //good with guns that overkill: one shot, grenade
b.modHealthDrain = 0.015;
}
},
{
name: "entanglement",
description: "using your first gun reduces <strong class='color-d'>damage</strong> taken<br><em>scales by <strong>7%</strong> for each gun in your inventory</em>",
have: false, //20
effect: () => { // good with laser-bots
b.isModMonogamy = true
}
},
{
name: "Bayesian inference",
description: "<strong>20%</strong> chance for double <strong>power ups</strong> to drop",
have: false, //19
effect: () => { // good with long term planning
b.modMoreDrops = 0.20;
}
},
{
name: "mass-energy equivalence",
description: "change the mass of <strong>power ups</strong> into <strong class='color-f'>energy</strong><br>power ups fill your <strong class='color-f'>energy</strong> and <strong class='color-h'>heal</strong> for +3%",
have: false, //21
effect: () => {
b.isModMassEnergy = true // used in mech.usePowerUp
}
},
{
name: "supersaturation",
description: "<strong class='color-h'>heal</strong> <strong>25%</strong> beyond your max health",
have: false, //22
effect: () => {
mech.maxHealth = 1.25
}
},
{
name: "recursive healing",
description: "<strong class='color-h'>healing</strong> power ups bring you to <strong>full health</strong>",
have: false, //13
effect: () => { // good with ablative synthesis, melee builds
b.isModFullHeal = true
}
},
{
name: "quantum immortality",
description: "after <strong>dying</strong>, continue in an <em>alternate reality</em><br>guns, ammo, and field are randomized",
have: false, //10
description: "after <strong>dying</strong>, continue in an <strong>alternate reality</strong><br><em>guns, ammo, and field are randomized</em>",
have: false, //23
effect: () => {
b.modIsImmortal = true;
}
@@ -301,18 +309,10 @@ const b = {
}
}
},
draw() {
ctx.beginPath();
bulletActions() {
//remove bullet if at end cycle for that bullet
let i = bullet.length;
while (i--) {
//draw
let vertices = bullet[i].vertices;
ctx.moveTo(vertices[0].x, vertices[0].y);
for (let j = 1; j < vertices.length; j += 1) {
ctx.lineTo(vertices[j].x, vertices[j].y);
}
ctx.lineTo(vertices[0].x, vertices[0].y);
//remove bullet if at end cycle for that bullet
if (bullet[i].endCycle < game.cycle) {
bullet[i].onEnd(i); //some bullets do stuff on end
if (bullet[i]) {
@@ -323,9 +323,21 @@ const b = {
}
}
}
//draw
ctx.beginPath();
for (let i = 0, len = bullet.length; i < len; i++) {
let vertices = bullet[i].vertices;
ctx.moveTo(vertices[0].x, vertices[0].y);
for (let j = 1; j < vertices.length; j += 1) {
ctx.lineTo(vertices[j].x, vertices[j].y);
}
ctx.lineTo(vertices[0].x, vertices[0].y);
}
ctx.fillStyle = "#000";
ctx.fill();
//do things
//do bullet things
for (let i = 0, len = bullet.length; i < len; i++) {
bullet[i].do();
}
@@ -380,16 +392,6 @@ const b = {
ctx.arc(mech.pos.x + 35 * Math.cos(mech.angle), mech.pos.y + 35 * Math.sin(mech.angle), radius, 0, 2 * Math.PI);
ctx.fill();
},
drawOneBullet(vertices) {
ctx.beginPath();
ctx.moveTo(vertices[0].x, vertices[0].y);
for (let j = 1; j < vertices.length; j += 1) {
ctx.lineTo(vertices[j].x, vertices[j].y);
}
ctx.lineTo(vertices[0].x, vertices[0].y);
ctx.fillStyle = "#000";
ctx.fill();
},
removeConsBB(me) {
for (let i = 0, len = consBB.length; i < len; ++i) {
if (consBB[i].bodyA === me) {
@@ -567,7 +569,7 @@ const b = {
},
guns: [{
name: "laser", //0
description: "emit a beam of <strong class='color-d'>damaging</strong> coherent light<br>uses <strong class='color-f'>energy</strong> instead of ammunition",
description: "emit a beam of collimation coherent light<br>uses <strong class='color-f'>energy</strong> instead of ammunition",
ammo: 0,
// ammoPack: 350,
ammoPack: Infinity,
@@ -1102,7 +1104,6 @@ const b = {
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(dir), mech.pos.y + 40 * Math.sin(dir), 32 * size * b.modBulletSize, 0.8 * size * b.modBulletSize, b.fireAttributes(dir));
bullet[me].endCycle = game.cycle + Math.floor(180 * b.isModBulletsLastLonger);
bullet[me].dmg = 0.15 * size + b.modExtraDmg;
b.drawOneBullet(bullet[me].vertices);
bullet[me].do = function () {
this.force.y += this.mass * 0.0002; //low gravity
};
@@ -1140,7 +1141,6 @@ const b = {
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle) - 3, 30 * b.modBulletSize, 4 * b.modBulletSize, b.fireAttributes(dir));
b.fireProps(mech.crouch ? 70 : 30, -3 * (0.5 - Math.random()) + (mech.crouch ? 25 : -8), dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
// Matter.Body.setDensity(bullet[me], 0.01) //doesn't help with reducing explosion knock backs
bullet[me].force.y += 0.00045; //a small push down at first to make it seem like the missile is briefly falling
bullet[me].frictionAir = 0
@@ -1284,7 +1284,6 @@ const b = {
const dir = mech.angle; // + Math.random() * 0.05;
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 15 * b.modBulletSize, b.fireAttributes(dir, false));
b.fireProps(mech.crouch ? 40 : 20, mech.crouch ? 43 : 32, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
// Matter.Body.setDensity(bullet[me], 0.000001);
bullet[me].totalCycles = 100;
bullet[me].endCycle = game.cycle + Math.floor((mech.crouch ? 120 : 60) * b.isModBulletsLastLonger);
@@ -1315,7 +1314,6 @@ const b = {
bullet[me].radius = 22; //used from drawing timer
b.fireProps(10, mech.crouch ? 42 : 26, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
bullet[me].endCycle = Infinity
// bullet[me].restitution = 0.3;
// bullet[me].frictionAir = 0.01;
@@ -1423,7 +1421,6 @@ const b = {
const dir = mech.angle;
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 15 * b.modBulletSize, b.fireAttributes(dir, false));
b.fireProps(mech.crouch ? 40 : 30, mech.crouch ? 34 : 22, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
bullet[me].endCycle = game.cycle + Math.floor(60 * b.isModBulletsLastLonger);
bullet[me].restitution = 0.3;
// bullet[me].frictionAir = 0.01;
@@ -1494,7 +1491,6 @@ const b = {
const dir = mech.angle;
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 20, 4.5, b.fireAttributes(dir, false));
b.fireProps(mech.crouch ? 75 : 55, mech.crouch ? 25 : 14, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
Matter.Body.setDensity(bullet[me], 0.000001);
bullet[me].endCycle = game.cycle + 100;
bullet[me].frictionAir = 0;
@@ -1687,7 +1683,6 @@ const b = {
}
})
b.fireProps(mech.crouch ? 14 : 10, mech.crouch ? 40 : 1, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
}
},
{
@@ -1788,83 +1783,90 @@ const b = {
}
})
b.fireProps(mech.crouch ? 60 : 30, 15, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices);
}
},
{
name: "chronon", //15
description: "fire a bubble of null time<br>enemies are frozen for 5 seconds",
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",
ammo: 0,
ammoPack: 80,
have: false,
isStarterGun: true,
fire() {
const me = bullet.length;
const dir = mech.angle
const RADIUS = 23 + 45 * Math.random()
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 0, RADIUS, {
density: 0.0001, // 0.1 normal density to keep damage consistent
frictionAir: 0,
restitution: 0.3,
const dir = mech.angle + 0.1 * (Math.random() - 0.5)
const RADIUS = (9 + 12 * Math.random()) * b.modBulletSize
bullet[me] = Bodies.polygon(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 25, RADIUS, {
angle: dir,
friction: 0,
density: 0.000001, // 0.001 is normal density
inertia: Infinity,
frictionAir: 0,
dmg: 0.5 + b.modExtraDmg, //damage done in addition to the damage from momentum
friction: 0.2,
restitution: 0.2,
dmg: b.modExtraDmg, //damage done in addition to the damage from momentum
classType: "bullet",
collisionFilter: {
category: 0x000100,
mask: 0x010011 //mask: 0x000101, //for self collision
mask: 0x010011
},
minDmgSpeed: 0,
endCycle: Infinity, //game.cycle + Math.floor(265 * b.isModBulletsLastLonger),
count: 0,
radius: RADIUS,
target: null,
onDmg(who) {
this.endCycle = 0; //bullet ends cycle after doing damage // also triggers explosion
if (!who.isSleeping) {
const sleep = function (who) {
if (who) {
who.storeVelocity = who.velocity
who.storeAngularVelocity = who.angularVelocity
Matter.Sleeping.set(who, true)
}
};
setTimeout(sleep, 1, who);
const awake = function (who) {
if (who) {
Matter.Sleeping.set(who, false)
if (who.storeVelocity) {
Matter.Body.setVelocity(who, {
x: who.storeVelocity.x,
y: who.storeVelocity.y
})
Matter.Body.setAngularVelocity(who, who.storeAngularVelocity)
}
}
};
setTimeout(awake, 5000, who);
if (!this.target && who.alive) {
this.target = who;
this.collisionFilter.category = 0x000000;
}
},
onEnd() {},
do() {
//shrink
const SCALE = 0.994
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
if (this.radius < 5) this.endCycle = 0;
this.force.y += this.mass * 0.00005;
//draw white circle
ctx.beginPath()
ctx.arc(this.position.x, this.position.y, this.radius - 2, 0, 2 * Math.PI);
ctx.arc(this.position.x, this.position.y, this.radius * 0.97 - 1.6, 0, 2 * Math.PI);
ctx.fillStyle = "#fff"
ctx.fill()
if (!mech.isBodiesAsleep) { //if time dilation isn't active
if (this.count < 17) {
this.count++
//grow
const SCALE = 1.1
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
} else {
//shrink
const SCALE = 1 - 0.006 / b.isModBulletsLastLonger
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
if (this.radius < 11) this.endCycle = 0;
}
if (this.target && this.target.alive) {
Matter.Body.setPosition(this, this.target.position)
Matter.Body.setVelocity(this.target, Matter.Vector.mult(this.target.velocity, 0.95))
Matter.Body.setAngularVelocity(this.target, this.target.angularVelocity * 0.96)
this.target.damage(b.dmgScale * 0.0035);
} else {
//look for a new target
this.target = null
this.collisionFilter.category = 0x000100;
}
}
}
});
World.add(engine.world, bullet[me]); //add bullet to world
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 13 : 7) * b.modFireRate); // cool down
const SPEED = mech.crouch ? 9 : 5;
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 15 : 3) * b.modFireRate); // cool down
const SPEED = mech.crouch ? 25 : 16 - RADIUS * 0.25;
Matter.Body.setVelocity(bullet[me], {
x: mech.Vx / 2 + SPEED * Math.cos(dir),
y: mech.Vy / 2 + SPEED * Math.sin(dir)
x: SPEED * Math.cos(dir),
y: SPEED * Math.sin(dir)
});
bullet[me].direction = Matter.Vector.perp(bullet[me].velocity)
}
@@ -2010,7 +2012,6 @@ const b = {
// })
// b.fireProps(mech.crouch ? 19 : 15, mech.crouch ? 45 : 30, dir, me); //cd , speed
// b.drawOneBullet(bullet[me].vertices);
// //find mob targets
// let closeDist = Infinity;

View File

@@ -43,8 +43,9 @@ const game = {
mech.hold();
level.drawFills();
game.draw.drawMapPath();
b.draw();
b.fire();
b.bulletActions();
mobs.healthBar();
game.drawCircle();
ctx.restore();
}
@@ -415,6 +416,8 @@ const game = {
b.activeGun = null;
b.setModDefaults(); //remove mods
game.updateModHUD();
mech.fieldEnergyMax = 1
mech.maxHealth = 1
mech.fieldUpgrades[0].effect(); //set to default field
game.paused = false;
build.isShowingBuilds = false
@@ -873,7 +876,7 @@ const game = {
for (let i = 0, len = body.length; i < len; ++i) {
let vertices = body[i].vertices;
ctx.moveTo(vertices[0].x, vertices[0].y);
for (let j = 1; j < vertices.length; j += 1) {
for (let j = 1; j < vertices.length; j++) {
ctx.lineTo(vertices[j].x, vertices[j].y);
}
ctx.lineTo(vertices[0].x, vertices[0].y);

View File

@@ -187,17 +187,17 @@ document.getElementById("build-button").addEventListener("click", () => {
</g>
</svg>
</div>
<div class="build-grid-module" style="font-size: 0.85em; line-height: 170%;">
<div class="build-grid-module" style="font-size: 1.05em; line-height: 170%;">
Choose five power ups.<br>Click start to begin.
</div>`
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="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[i].name}</div> ${mech.fieldUpgrades[i].description}</div>`
}
for (let i = 0, len = b.guns.length; i < len; i++) {
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="circle-grid gun"></div> &nbsp; <strong style='font-size:1.3em;'>${b.guns[i].name}</strong><br> ${b.guns[i].description}</div>`
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="grid-title"><div class="circle-grid gun"></div> &nbsp; ${b.guns[i].name}</div> ${b.guns[i].description}</div>`
}
for (let i = 0, len = b.mods.length; i < len; i++) {
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="circle-grid mod"></div> &nbsp; <strong style='font-size:1.3em;'>${b.mods[i].name}</strong><br> ${b.mods[i].description}</div>`
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
}
el.innerHTML = text
el.style.display = "grid"

View File

@@ -14,12 +14,12 @@ const level = {
start() {
if (level.levelsCleared === 0) {
// game.difficulty = 6; //for testing to simulate possible mobs spawns
b.giveGuns(15)
mech.fieldUpgrades[1].effect();
// b.giveMod(2)
// b.giveGuns(15)
// mech.fieldUpgrades[1].effect();
// b.giveMod(21)
// this.intro(); //starting level
this.testingMap();
this.intro(); //starting level
// this.testingMap();
// this.bosses();
// this.aerie();
// this.rooftops();

View File

@@ -29,6 +29,20 @@ const mobs = {
ctx.stroke();
}
},
healthBar() {
for (let i = 0, len = mob.length; i < len; i++) {
if (mob[i].seePlayer.recall && mob[i].showHealthBar) {
const h = mob[i].radius * 0.3;
const w = mob[i].radius * 2;
const x = mob[i].position.x - w / 2;
const y = mob[i].position.y - w * 0.7;
ctx.fillStyle = "rgba(100, 100, 100, 0.3)";
ctx.fillRect(x, y, w, h);
ctx.fillStyle = "rgba(255,0,0,0.7)";
ctx.fillRect(x, y, w * mob[i].health, h);
}
}
},
// alert(range) {
// range = range * range;
// for (let i = 0; i < mob.length; i++) {
@@ -64,6 +78,7 @@ const mobs = {
alive: true,
index: i,
health: 1,
showHealthBar: true,
accelMag: 0.001,
cd: 0, //game cycle when cooldown will be over
delay: 60, //static: time between cooldowns
@@ -914,10 +929,8 @@ const mobs = {
}
}
},
healthBar() {
//draw health bar
healthBar() { //draw health by mob //most health bars are drawn in mobs.healthbar();
if (this.seePlayer.recall) {
// && this.health < 1
const h = this.radius * 0.3;
const w = this.radius * 2;
const x = this.position.x - w / 2;

View File

@@ -519,7 +519,7 @@ const mech = {
Matter.World.remove(engine.world, powerUp[i]);
powerUp.splice(i, 1);
if (b.isModMassEnergy) {
mech.fieldMeter = 1;
mech.fieldMeter = mech.fieldEnergyMax;
mech.addHealth(0.03);
}
},
@@ -626,6 +626,7 @@ const mech = {
fireCDcycle: 0,
fieldCDcycle: 0,
fieldMode: 0, //basic field mode before upgrades
fieldEnergyMax: 1, //can be increased by a mod
// these values are set on reset by setHoldDefaults()
fieldMeter: 0,
fieldRegen: 0,
@@ -643,7 +644,7 @@ const mech = {
this.fieldThreshold = Math.cos(this.fieldArc * Math.PI)
},
setHoldDefaults() {
this.fieldMeter = 1;
this.fieldMeter = this.fieldEnergyMax;
this.fieldRegen = 0.001;
this.fieldFire = false;
this.fieldCDcycle = 0;
@@ -660,14 +661,14 @@ const mech = {
// this.phaseBlocks(0x011111)
},
drawFieldMeter(range = 60) {
if (this.fieldMeter < 1) {
if (this.fieldMeter < this.fieldEnergyMax) {
mech.fieldMeter += mech.fieldRegen;
ctx.fillStyle = "rgba(0, 0, 0, 0.4)";
ctx.fillRect(this.pos.x - this.radius, this.pos.y - 50, range, 10);
ctx.fillStyle = "#0cf";
ctx.fillRect(this.pos.x - this.radius, this.pos.y - 50, range * this.fieldMeter, 10);
} else {
mech.fieldMeter = 1
mech.fieldMeter = this.fieldEnergyMax
}
},
lookingAt(who) {
@@ -1094,7 +1095,6 @@ const mech = {
mech.fieldMeter -= DRAIN;
//draw field everywhere
ctx.globalCompositeOperation = "saturation"
// ctx.fillStyle = "rgba(100,200,230," + (0.25 + 0.06 * Math.random()) + ")";
ctx.fillStyle = "#ccc";
@@ -1138,11 +1138,7 @@ const mech = {
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
}
mech.drawFieldMeter()
if (mech.fieldMode !== 1) {
//wake up if this is no longer the current field mode, like after a new power up
mech.wakeCheck();
}
if (mech.fieldMode !== 1) mech.wakeCheck(); //wake up if this is no longer the current field mode, like after a new power up
}
}
},
@@ -1456,7 +1452,7 @@ const mech = {
mech.setHoldDefaults();
mech.fieldRegen *= 3;
mech.hold = function () {
if (mech.fieldMeter === 1) {
if (mech.fieldMeter === mech.fieldEnergyMax) {
mech.fieldMeter -= 0.43;
b.guns[gunIndex].fire() //spawn drone
mech.fireCDcycle = mech.cycle + 25; // set fire cool down to prevent +energy from making huge numbers of drones

View File

@@ -99,7 +99,6 @@ const spawn = {
this.gravity();
if (this.seePlayer.recall) {
this.seePlayerByDistAndLOS();
this.healthBar();
this.attraction();
//tether to other blocks
ctx.beginPath();
@@ -135,7 +134,6 @@ const spawn = {
Matter.Body.setDensity(me, 0.0005) // normal density is 0.001 // this reduces life by half and decreases knockback
me.do = function () {
this.healthBar();
this.seePlayerByLookingAt();
this.attraction();
};
@@ -151,7 +149,6 @@ const spawn = {
// Matter.Body.setDensity(me, 0.003) // normal density is 0.001
// me.do = function () {
// this.healthBar();
// if (!(game.cycle % this.lookFrequency)) {
// //slow self heal
@@ -237,7 +234,6 @@ const spawn = {
me.memory = 50;
if (Math.random() < Math.min((game.difficulty - 1) * 0.1, 0.7)) spawn.shield(me, x, y);
me.do = function () {
this.healthBar();
this.gravity();
this.seePlayerCheck();
this.attraction();
@@ -249,7 +245,6 @@ const spawn = {
me.big = false; //required for grow
me.accelMag = 0.00045 * game.accelScale;
me.do = function () {
this.healthBar();
this.seePlayerByLookingAt();
this.attraction();
this.grow();
@@ -299,7 +294,6 @@ const spawn = {
};
if (Math.random() < Math.min((game.difficulty - 1) * 0.1, 0.7)) spawn.shield(me, x, y);
me.do = function () {
this.healthBar();
this.gravity();
this.searchSpring();
};
@@ -319,7 +313,6 @@ const spawn = {
// this.zoomMode = 150;
// };
// me.do = function () {
// this.healthBar();
// this.seePlayerByDistAndLOS();
// this.zoom();
// this.gravity();
@@ -336,7 +329,6 @@ const spawn = {
me.randomHopFrequency = 50 + Math.floor(Math.random() * 1000);
me.randomHopCD = game.cycle + me.randomHopFrequency;
me.do = function () {
this.healthBar();
this.gravity();
this.seePlayerCheck();
this.hop();
@@ -369,7 +361,6 @@ const spawn = {
me.lookTorque = 0.0000014;
me.restitution = 0;
me.do = function () {
this.healthBar();
this.seePlayerByLookingAt();
//accelerate towards the player after a delay
if (this.seePlayer.recall) {
@@ -450,7 +441,6 @@ const spawn = {
ctx.fillStyle = "rgba(0,0,0,0.1)";
ctx.fill();
this.healthBar();
//when player is inside event horizon
if (Matter.Vector.magnitude(Matter.Vector.sub(this.position, player.position)) < eventHorizon && !mech.isStealth) {
mech.damage(0.00015 * game.dmgScale);
@@ -560,7 +550,6 @@ const spawn = {
ctx.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill();
}
this.healthBar();
this.curl(eventHorizon);
}
}
@@ -575,7 +564,6 @@ const spawn = {
me.friction = 0;
if (Math.random() < Math.min(0.2 + (game.difficulty - 1) * 0.1, 0.7)) spawn.shield(me, x, y);
me.do = function () {
this.healthBar();
this.seePlayerByLookingAt();
this.attraction();
this.repulsion();
@@ -599,7 +587,6 @@ const spawn = {
};
// if (Math.random() < Math.min(0.2 + game.difficulty * 0.1, 0.7)) spawn.shield(me, x, y);
me.do = function () {
this.healthBar();
if (!this.isSleeping) {
this.seePlayerByLookingAt();
const dist2 = this.distanceToPlayer2();
@@ -659,7 +646,6 @@ const spawn = {
this.explode();
};
me.do = function () {
this.healthBar();
this.seePlayerByLookingAt();
this.attraction();
this.laser();
@@ -678,7 +664,6 @@ const spawn = {
this.cd = game.cycle + this.delay;
};
me.do = function () {
this.healthBar();
this.seePlayerCheck();
this.attraction();
this.gravity();
@@ -696,6 +681,7 @@ const spawn = {
// me.leaveBody = false;
me.canTouchPlayer = false; //used in drawSneaker
me.collisionFilter.mask = 0x010111; //can't touch player
me.showHealthBar = false;
// me.memory = 420;
me.do = function () {
@@ -747,6 +733,7 @@ const spawn = {
me.canTouchPlayer = false; //used in drawGhost
// me.leaveBody = false;
me.collisionFilter.mask = 0x000100; //move through walls and player
me.showHealthBar = false;
me.memory = 480;
me.do = function () {
//cap max speed
@@ -810,7 +797,6 @@ const spawn = {
// }
// };
// me.do = function () {
// this.healthBar();
// this.seePlayerCheck();
// this.blink();
// //strike by expanding
@@ -855,7 +841,6 @@ const spawn = {
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
};
me.do = function () {
this.healthBar();
this.seePlayerCheckByDistance();
this.hoverOverPlayer();
this.bomb();
@@ -879,7 +864,6 @@ const spawn = {
};
if (Math.random() < Math.min(0.15 + (game.difficulty - 1) * 0.1, 0.7)) spawn.shield(me, x, y);
me.do = function () {
this.healthBar();
this.seePlayerByLookingAt();
this.fire();
};
@@ -906,7 +890,6 @@ const spawn = {
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
};
me.do = function () {
this.healthBar();
this.seePlayerByLookingAt();
this.fire();
};
@@ -926,6 +909,7 @@ const spawn = {
me.restitution = 0.8;
me.leaveBody = false;
me.dropPowerUp = false;
me.showHealthBar = false;
me.collisionFilter.category = 0x000010;
me.collisionFilter.mask = 0x011101;
me.do = function () {
@@ -950,7 +934,6 @@ const spawn = {
};
if (Math.random() < Math.min((game.difficulty - 1) * 0.1, 0.5)) spawn.shield(me, x, y);
me.do = function () {
this.healthBar();
this.gravity();
this.seePlayerCheck();
this.attraction();
@@ -970,7 +953,6 @@ const spawn = {
me.seePlayerFreq = Math.round((80 + 50 * Math.random()) * game.lookFreqScale);
me.frictionAir = 0.002;
me.do = function () {
this.healthBar();
this.gravity();
this.seePlayerCheck();
this.attraction();
@@ -985,7 +967,6 @@ const spawn = {
};
me.g = 0.0004; //required if using 'gravity'
me.do = function () {
this.healthBar();
this.gravity();
this.seePlayerCheck();
this.attraction();
@@ -1005,7 +986,6 @@ const spawn = {
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
};
me.do = function () {
this.healthBar();
this.seePlayerCheck();
this.attraction();
this.laserBeam();
@@ -1049,7 +1029,6 @@ const spawn = {
this.removeCons(); //remove constraint
};
me.do = function () {
this.healthBar();
this.gravity();
this.seePlayerCheck();
this.attraction();
@@ -1076,6 +1055,7 @@ const spawn = {
};
me.leaveBody = false;
me.dropPowerUp = false;
me.showHealthBar = false;
//swap order of shield and mob, so that mob is behind shield graphically
mob[mob.length - 1] = mob[mob.length - 2];
mob[mob.length - 2] = me;
@@ -1105,6 +1085,7 @@ const spawn = {
};
me.leaveBody = false;
me.dropPowerUp = false;
me.showHealthBar = false;
mob[mob.length - 1] = mob[mob.length - 1 - nodes];
mob[mob.length - 1 - nodes] = me;
me.do = function () {};
@@ -1254,6 +1235,8 @@ const spawn = {
me.frictionStatic = 1;
me.friction = 1;
me.frictionAir = 0.01;
me.dropPowerUp = false;
me.showHealthBar = false;
me.do = function () {
let wireX = -50;
@@ -1319,6 +1302,8 @@ const spawn = {
me.frictionStatic = 1;
me.friction = 1;
me.frictionAir = 0.01;
me.dropPowerUp = false;
me.showHealthBar = false;
me.do = function () {
let wireX = -50 - 20;
@@ -1367,6 +1352,8 @@ const spawn = {
me.frictionStatic = 1;
me.friction = 1;
me.frictionAir = 0.01;
me.dropPowerUp = false;
me.showHealthBar = false;
me.do = function () {
let wireX = -50 - 35;
@@ -1414,6 +1401,8 @@ const spawn = {
// me.frictionStatic = 1;
// me.friction = 1;
me.frictionAir = 0.01;
me.dropPowerUp = false;
me.showHealthBar = false;
me.do = function () {
let wireX = -50 + 16;
@@ -1461,6 +1450,8 @@ const spawn = {
// me.frictionStatic = 1;
// me.friction = 1;
me.frictionAir = 0.01;
me.dropPowerUp = false;
me.showHealthBar = false;
me.do = function () {
let wireX = -50 + 26;

View File

@@ -61,7 +61,7 @@ summary {
}
#build-grid {
padding: 10px;
padding: 16px;
margin: 0px;
border: 0px;
/* border-radius: 8px; */
@@ -70,9 +70,9 @@ summary {
display: none;
/* display: grid; */
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(305px, 1fr));
grid-auto-rows: minmax(auto, auto);
grid-gap: 15px;
grid-gap: 16px;
position: relative;
bottom: 0px;
@@ -83,14 +83,19 @@ summary {
.build-grid-module {
/* box-shadow: 0px 1px 4px #234; */
padding: 7px;
padding: 10px;
/* margin: 4px; */
line-height: 150%;
line-height: 170%;
border-radius: 6px;
background: #fff;
font-size: 0.65em;
/* display: flex; */
}
.grid-title {
padding-bottom: 6px;
font-size:1.3em;
font-weight: 600;
}
.build-grid-module:hover {
background-color: #efeff5;
@@ -321,11 +326,11 @@ em {
}
.circle-grid {
width: 20px;
height: 20px;
width: 23px;
height: 23px;
border-radius: 50%;
display: inline-block;
margin-bottom: -4px;
margin-bottom: -5px;
}
.field {