diff --git a/js/bullets.js b/js/bullets.js index d76da67..49fc624 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -29,7 +29,7 @@ const b = { }, mods: [{ name: "depleted uranium rounds", - description: "your bullets are larger and do more physical damage", + description: "your bullets are larger and do more physical damage", have: false, effect: () => { //good for guns that do mostly projectile damage: @@ -41,7 +41,7 @@ const b = { }, { name: "auto-loading heuristics", - description: "your rate of fire is 15% faster", + description: "your rate of fire is 15% faster", have: false, effect: () => { //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls @@ -51,7 +51,7 @@ const b = { }, { name: "desublimated ammunition", - description: "use 50% less ammo when crouching", + description: "use 50% less ammo when crouching", have: false, effect: () => { //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray @@ -60,7 +60,7 @@ const b = { }, { name: "corrosion resistant topology", - description: "your bullets last 40% longer", + description: "your bullets last 40% longer", have: false, effect: () => { //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range) @@ -69,7 +69,7 @@ const b = { }, { name: "anti-matter cores", - description: "the radius of your explosions is doubled", + description: "the radius of your explosions is doubled
be careful", have: false, effect: () => { //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage @@ -79,16 +79,16 @@ const b = { }, { name: "energy siphon", - description: "regenerate energy proportional to your damage done", + description: "regenerate energy proportional to your damage done", have: false, effect: () => { //good with laser, and all fields - b.modEnergySiphon = 0.25; + b.modEnergySiphon = 0.2; } }, { name: "entropy transfer", - description: "heal proportional to your damage done", + description: "heal proportional to your damage done", have: false, effect: () => { //good with guns that overkill: one shot, grenade @@ -97,7 +97,7 @@ const b = { }, { name: "quantum immortality", - description: "after you die continue in an alternate reality with randomized abilities", + description: "after you die continue in an alternate reality
guns, ammo, and field are randomized", have: false, effect: () => { b.modIsImmortal = true; @@ -105,7 +105,7 @@ const b = { }, { name: "zoospore vector", - description: "when an enemy dies it has a 20% chance to release spores", + description: "when an enemy dies it has a 20% chance to release spores", have: false, effect: () => { b.modSpores = 0.20; //good late game maybe? @@ -128,6 +128,7 @@ const b = { giveGuns(gun = "all", ammoPacks = 2) { if (gun === "all") { b.activeGun = 0; + b.inventoryGun = 0; for (let i = 0; i < b.guns.length; i++) { b.guns[i].have = true; b.guns[i].ammo = b.guns[i].ammoPack * ammoPacks; @@ -277,7 +278,7 @@ const b = { x: bullet[me].position.x, y: bullet[me].position.y, radius: radius, - color: "rgba(255,0,0,0.4)", + color: "rgba(255,25,0,0.6)", time: game.drawTime }); let dist, sub, knock; @@ -297,7 +298,7 @@ const b = { sub = Matter.Vector.sub(bullet[me].position, player.position); dist = Matter.Vector.magnitude(sub); if (dist < radius) { - mech.damage(radius * 0.00035); + mech.damage(radius * 0.0002); knock = Matter.Vector.mult(Matter.Vector.normalise(sub), -Math.sqrt(dmg) * player.mass / 30); player.force.x += knock.x; player.force.y += knock.y; @@ -309,7 +310,6 @@ const b = { mech.drop(); } - //body knock backs for (let i = 0, len = body.length; i < len; ++i) { sub = Matter.Vector.sub(bullet[me].position, body[i].position); @@ -340,54 +340,6 @@ const b = { } } - // bullet knock backs (not working: no effect for drones, crash for superballs) - // for (let i = 0, len = bullet.length; i < len; ++i) { - // if (me !== i) { - // sub = Matter.Vector.sub(bullet[me].position, bullet[i].position); - // dist = Matter.Vector.magnitude(sub); - // if (dist < radius) { - // knock = Matter.Vector.mult(Matter.Vector.normalise(sub), (-Math.sqrt(dmg) * bullet[i].mass) / 10); - // bullet[i].force.x += knock.x; - // bullet[i].force.y += knock.y; - // console.log(sub, dist, knock) - // } else if (dist < alertRange) { - // knock = Matter.Vector.mult(Matter.Vector.normalise(sub), (-Math.sqrt(dmg) * bullet[i].mass) / 20); - // bullet[i].force.x += knock.x; - // bullet[i].force.y += knock.y; - // } - // } - // } - - //destroy all bullets in range - // for (let i = 0, len = bullet.length; i < len; ++i) { - // if (me != i) { - // sub = Matter.Vector.sub(bullet[me].position, bullet[i].position); - // dist = Matter.Vector.magnitude(sub); - // if (dist < radius) { - // bullet[i].endCycle = mech.cycle; - // } - // } - // } - - //mob damage and knock back with no alert - // for (let i = 0, len = mob.length; i < len; ++i) { - // if (mob[i].alive) { - // let vertices = mob[i].vertices; - // for (let j = 0, len = vertices.length; j < len; j++) { - // sub = Matter.Vector.sub(bullet[me].position, vertices[j]); - // dist = Matter.Vector.magnitude(sub); - // if (dist < radius) { - // mob[i].damage(dmg); - // mob[i].locatePlayer(); - // knock = Matter.Vector.mult(Matter.Vector.normalise(sub), -Math.sqrt(dmg) * mob[i].mass / 18); - // mob[i].force.x += knock.x; - // mob[i].force.y += knock.y; - // break; - // } - // } - // } - // } - //mob damage and knock back with alert let damageScale = 1; // reduce dmg for each new target to limit total AOE damage for (let i = 0, len = mob.length; i < len; ++i) { @@ -475,7 +427,7 @@ const b = { }, guns: [{ name: "laser", - description: "fire a beam of coherent light
reflects off walls at 75% intensity
uses energy instead of ammunition", + description: "fire a beam of coherent light
reflects off walls at 75% intensity
uses energy instead of ammunition", ammo: 0, // ammoPack: 350, ammoPack: Infinity, @@ -633,132 +585,9 @@ const b = { ctx.globalAlpha = 1; } } - // }, { - // name: "entropic beam", - // description: "steal entropy to heal
reflects off walls at 75% intensity
uses energy instead of ammunition", - // ammo: 0, - // // ammoPack: 350, - // ammoPack: Infinity, - // have: false, - // fire() { - // // mech.fireCDcycle = mech.cycle + 1 - // //laser drains energy as well as bullets - // const FIELD_DRAIN = 0.0001 //should be 0.001 - // if (mech.fieldMeter < FIELD_DRAIN) { - // mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy - // } else { - // mech.fieldMeter -= mech.fieldRegen + FIELD_DRAIN - // let best; - // const color = "#a0a"; - // const range = 600; - // const path = [{ - // x: mech.pos.x + 20 * Math.cos(mech.angle), - // y: mech.pos.y + 20 * Math.sin(mech.angle) - // }, - // { - // x: mech.pos.x + range * Math.cos(mech.angle), - // y: mech.pos.y + range * Math.sin(mech.angle) - // } - // ]; - // const vertexCollision = function (v1, v1End, domain) { - // for (let i = 0; i < domain.length; ++i) { - // let vertices = domain[i].vertices; - // const len = vertices.length - 1; - // for (let j = 0; j < len; j++) { - // results = game.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]); - // if (results.onLine1 && results.onLine2) { - // const dx = v1.x - results.x; - // const dy = v1.y - results.y; - // const dist2 = dx * dx + dy * dy; - // if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) { - // best = { - // x: results.x, - // y: results.y, - // dist2: dist2, - // who: domain[i], - // v1: vertices[j], - // v2: vertices[j + 1] - // }; - // } - // } - // } - // results = game.checkLineIntersection(v1, v1End, vertices[0], vertices[len]); - // if (results.onLine1 && results.onLine2) { - // const dx = v1.x - results.x; - // const dy = v1.y - results.y; - // const dist2 = dx * dx + dy * dy; - // if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) { - // best = { - // x: results.x, - // y: results.y, - // dist2: dist2, - // who: domain[i], - // v1: vertices[0], - // v2: vertices[len] - // }; - // } - // } - // } - // }; - // const checkforCollisions = function () { - // best = { - // x: null, - // y: null, - // dist2: Infinity, - // who: null, - // v1: null, - // v2: null - // }; - // vertexCollision(path[path.length - 2], path[path.length - 1], mob); - // vertexCollision(path[path.length - 2], path[path.length - 1], map); - // vertexCollision(path[path.length - 2], path[path.length - 1], body); - // }; - // const laserHitMob = function (dmg) { - // if (best.who.alive) { - // dmg *= b.dmgScale * 0.02; - // mech.addHealth(0.002) - // best.who.damage(dmg); - // best.who.locatePlayer(); - // //draw mob damage circle - // ctx.fillStyle = color; - // ctx.beginPath(); - // ctx.arc(path[path.length - 1].x, path[path.length - 1].y, Math.sqrt(dmg) * 100, 0, 2 * Math.PI); - // ctx.fill(); - // } - // }; - // checkforCollisions(); - // if (best.dist2 != Infinity) { - // //if hitting something - // path[path.length - 1] = { - // x: best.x, - // y: best.y - // }; - // laserHitMob(1); - // } - // ctx.fillStyle = color; - // ctx.strokeStyle = color; - // ctx.lineWidth = 4; - // for (let i = 1, len = path.length; i < len; ++i) { - // d = { - // x: path[i].x - path[i - 1].x, - // y: path[i].y - path[i - 1].y - // } - // const a = mech.cycle * 5 - // p1 = { - // x: d.x / 2 * Math.cos(a) - d.y / 2 * Math.sin(a), - // y: d.x / 2 * Math.sin(a) + d.y / 2 * Math.cos(a), - // } - // const wave = 300 / Math.sqrt(d.x * d.x + d.y * d.y) - // ctx.beginPath(); - // ctx.moveTo(path[i - 1].x, path[i - 1].y); - // ctx.bezierCurveTo(path[i - 1].x + p1.x * wave, path[i - 1].y + p1.y * wave, path[i].x + p1.x * wave, path[i].y + p1.y * wave, path[i].x, path[i].y); - // ctx.stroke(); - // } - // } - // } }, { name: "kinetic slugs", - description: "fire a huge rod with high recoil
effective at long distances", + description: "fire a large rod that does excessive physical damage
high recoil", ammo: 0, ammoPack: 5, have: false, @@ -782,7 +611,7 @@ const b = { }, { name: "minigun", - description: "fire a stream of bullets", + description: "rapidly fire a stream of small bullets", ammo: 0, ammoPack: 105, have: false, @@ -790,11 +619,11 @@ const b = { const me = bullet.length; b.muzzleFlash(15); // if (Math.random() > 0.2) mobs.alert(500); - const dir = mech.angle + (Math.random() - 0.5) * ((mech.crouch) ? 0.07 : 0.16); + const dir = mech.angle + (Math.random() - 0.5) * ((mech.crouch) ? 0.03 : 0.14); bullet[me] = Bodies.rectangle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 17 * b.modBulletSize, 5 * b.modBulletSize, b.fireAttributes(dir)); b.fireProps(mech.crouch ? 11 : 5, mech.crouch ? 44 : 36, dir, me); //cd , speed bullet[me].endCycle = game.cycle + Math.floor(65 * b.modBulletsLastLonger); - bullet[me].frictionAir = 0.01; + bullet[me].frictionAir = mech.crouch ? 0.007 : 0.01; bullet[me].do = function () { this.force.y += this.mass * 0.0005; }; @@ -802,7 +631,7 @@ const b = { }, { name: "wave beam", - description: "fire a stream of oscillating particles
propagates through solids
effective at close range", + description: "fire a stream of oscillating particles
propagates through solids", ammo: 0, ammoPack: 85, have: false, @@ -855,7 +684,7 @@ const b = { }, { name: "super balls", - description: "fire 3 very bouncy balls", + description: "fire 3 very bouncy balls", ammo: 0, ammoPack: 11, have: false, @@ -883,7 +712,7 @@ const b = { }, { name: "shotgun", - description: "fire a burst of bullets with high recoil
more effective at close range", + description: "fire a burst of bullets
high recoil", ammo: 0, ammoPack: 8, have: false, @@ -911,7 +740,7 @@ const b = { }, { name: "fléchettes", - description: "fire a narrow projectile
effective at long distances", + description: "fire an accurate high speed needle
", ammo: 0, ammoPack: 19, have: false, @@ -935,9 +764,9 @@ const b = { }, { name: "missiles", - description: "fire a missile that accelerates towards nearby targets
explodes when near target", + description: "fire a missile that accelerates towards nearby targets
explodes when near target", ammo: 0, - ammoPack: 9, + ammoPack: 8, have: false, fireCycle: 0, ammoLoaded: 0, @@ -953,7 +782,7 @@ const b = { 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 bullet[me].endCycle = game.cycle + Math.floor((265 + Math.random() * 20) * b.modBulletsLastLonger); - bullet[me].explodeRad = 150 + 40 * Math.random(); + bullet[me].explodeRad = 165 + 40 * Math.random(); bullet[me].lookFrequency = Math.floor(8 + Math.random() * 7); bullet[me].onEnd = b.explode; //makes bullet do explosive damage at end bullet[me].onDmg = function () { @@ -1040,7 +869,7 @@ const b = { }, { name: "flak", - description: "fire a cluster of explosive projectiles
explode on contact or after half a second", + description: "fire a cluster of short range projectiles
explode on contact or after half a second", ammo: 0, ammoPack: 20, have: false, @@ -1048,9 +877,9 @@ const b = { b.muzzleFlash(30); const totalBullets = 5 const angleStep = (mech.crouch ? 0.06 : 0.15) / totalBullets - const SPEED = mech.crouch ? 27 : 20 - const CD = mech.crouch ? 30 : 15 - const END = Math.floor((mech.crouch ? 27 : 18) * b.modBulletsLastLonger); + const SPEED = mech.crouch ? 30 : 25 + const CD = mech.crouch ? 45 : 11 + const END = Math.floor((mech.crouch ? 30 : 18) * b.modBulletsLastLonger); let dir = mech.angle - angleStep * totalBullets / 2; const side1 = 17 * b.modBulletSize const side2 = 4 * b.modBulletSize @@ -1059,13 +888,13 @@ const b = { dir += angleStep const me = bullet.length; bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), side1, side2, b.fireAttributes(dir)); - b.fireProps(CD, SPEED + 25 * Math.random() - i, dir, me); //cd , speed + b.fireProps(CD, SPEED + 15 * Math.random() - 2 * i, dir, me); //cd , speed // Matter.Body.setDensity(bullet[me], 0.005); - bullet[me].endCycle = i + game.cycle + END + bullet[me].endCycle = 2 * i + game.cycle + END bullet[me].restitution = 0; bullet[me].friction = 1; // bullet[me].dmg = 0.15; - bullet[me].explodeRad = 45 + (Math.random() - 0.5) * 50; + bullet[me].explodeRad = (mech.crouch ? 70 : 45) + (Math.random() - 0.5) * 50; bullet[me].onEnd = b.explode; bullet[me].onDmg = function () { this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion @@ -1083,50 +912,48 @@ const b = { }, { name: "grenades", - description: "fire a bomb that explodes on contact or after 1.6 seconds", + description: "fire a projectile that explodes on contact or after one second", ammo: 0, - ammoPack: 14, + ammoPack: 11, have: false, fire() { const me = bullet.length; 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 : 25, mech.crouch ? 41 : 32, dir, me); //cd , speed + 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(70 * b.modBulletsLastLonger); - bullet[me].restitution = 0.25; - bullet[me].explodeRad = 220; + bullet[me].endCycle = game.cycle + Math.floor((mech.crouch ? 120 : 60) * b.modBulletsLastLonger); + bullet[me].restitution = 0.5; + bullet[me].explodeRad = 210; bullet[me].onEnd = b.explode; //makes bullet do explosive damage before despawn bullet[me].minDmgSpeed = 1; - bullet[me].dmg = 0.5; bullet[me].onDmg = function () { - this.endCycle = 0; //bullet ends cycle after doing damage //this triggers explosion + this.endCycle = 0; //bullet ends cycle after doing damage //this also triggers explosion }; bullet[me].do = function () { //extra gravity for harder arcs - this.force.y += this.mass * 0.0022; + this.force.y += this.mass * 0.002; }; } }, { name: "vacuum bomb", - description: "fire a huge bomb that sucks before it explodes", + description: "fire a huge bomb that sucks before it explodes
click left mouse again to detonate", ammo: 0, - ammoPack: 5, + ammoPack: 4, have: false, fire() { const me = bullet.length; const dir = mech.angle; bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 26 * b.modBulletSize, b.fireAttributes(dir, false)); bullet[me].radius = 22; //used from drawing timer - b.fireProps(mech.crouch ? 80 : 50, mech.crouch ? 37 : 0, dir, me); //cd , speed + b.fireProps(10, mech.crouch ? 42 : 26, dir, me); //cd , speed b.drawOneBullet(bullet[me].vertices); - // Matter.Body.setDensity(bullet[me], 0.001); - bullet[me].endCycle = game.cycle + Math.floor((mech.crouch ? 100 : 150) * b.modBulletsLastLonger); - bullet[me].endCycleLength = bullet[me].endCycle - game.cycle + bullet[me].endCycle = Infinity + bullet[me].endCycle = Infinity // bullet[me].restitution = 0.3; // bullet[me].frictionAir = 0.01; // bullet[me].friction = 0.15; @@ -1140,78 +967,89 @@ const b = { bullet[me].onDmg = function () { // this.endCycle = 0; //bullet ends cycle after doing damage //this triggers explosion }; + bullet[me].isArmed = false; + bullet[me].isSucking = false; bullet[me].do = function () { //extra gravity for harder arcs this.force.y += this.mass * 0.0022; + mech.fireCDcycle = mech.cycle + 10 //can't fire until after the explosion - //before the explosion suck in stuff - if (game.cycle > this.endCycle - 35 && !mech.isBodiesAsleep) { - const that = this - let mag = 0.1 + //set armed and sucking status + if (!this.isArmed && !game.mouseDown) { + this.isArmed = true + } else if (this.isArmed && game.mouseDown && !this.isSucking) { + this.isSucking = true; + this.endCycle = game.cycle + 35; + } - function suck(who, radius = that.explodeRad * 2) { - for (i = 0, len = who.length; i < len; i++) { - const sub = Matter.Vector.sub(that.position, who[i].position); - const dist = Matter.Vector.magnitude(sub); - if (dist < radius && dist > 150) { - knock = Matter.Vector.mult(Matter.Vector.normalise(sub), mag * who[i].mass / Math.sqrt(dist)); - who[i].force.x += knock.x; - who[i].force.y += knock.y; + if (this.isSucking) { + if (!mech.isBodiesAsleep) { + const that = this + let mag = 0.1 + + function suck(who, radius = that.explodeRad * 2) { + for (i = 0, len = who.length; i < len; i++) { + const sub = Matter.Vector.sub(that.position, who[i].position); + const dist = Matter.Vector.magnitude(sub); + if (dist < radius && dist > 150) { + knock = Matter.Vector.mult(Matter.Vector.normalise(sub), mag * who[i].mass / Math.sqrt(dist)); + who[i].force.x += knock.x; + who[i].force.y += knock.y; + } } } + if (game.cycle > this.endCycle - 5) { + mag = -0.22 + suck(body) + suck(mob) + suck(powerUp) + suck([player]) + } else { + mag = 0.1 + suck(body) + suck(mob) + suck(powerUp) + suck([player]) + } + //keep bomb in place + Matter.Body.setVelocity(this, { + x: 0, + y: 0 + }); + //draw suck + const radius = 2.5 * this.explodeRad * (this.endCycle - game.cycle) / 35 + ctx.fillStyle = "rgba(0,0,0,0.1)"; + ctx.beginPath(); + ctx.arc(this.position.x, this.position.y, radius, 0, 2 * Math.PI); + ctx.fill(); } - if (game.cycle > this.endCycle - 5) { - mag = -0.22 - suck(body) - suck(mob) - suck(powerUp) - suck([player]) - } else { - mag = 0.1 - suck(body) - suck(mob) - suck(powerUp) - suck([player]) + } else { + // flashing lights to show armed + if (!(game.cycle % 10)) { + if (this.isFlashOn) { + this.isFlashOn = false; + } else { + this.isFlashOn = true; + } } - - //keep bomb in place - Matter.Body.setVelocity(this, { - x: 0, - y: 0 - }); - //draw suck - const radius = 9 * this.explodeRad * (this.endCycle - game.cycle) / this.endCycleLength - ctx.fillStyle = "rgba(0,0,0,0.1)"; - ctx.beginPath(); - ctx.arc(this.position.x, this.position.y, radius, 0, 2 * Math.PI); - ctx.fill(); - } - - //draw timer - if (!(game.cycle % 10)) { if (this.isFlashOn) { - this.isFlashOn = false; - } else { - this.isFlashOn = true; + ctx.fillStyle = "#000"; + ctx.beginPath(); + ctx.arc(this.position.x, this.position.y, this.radius, 0, 2 * Math.PI); + ctx.fill(); + //draw clock on timer + ctx.fillStyle = "#f04"; + ctx.beginPath(); + ctx.arc(this.position.x, this.position.y, this.radius * 0.5, 0, 2 * Math.PI); + ctx.fill(); } } - if (this.isFlashOn) { - ctx.fillStyle = "#000"; - ctx.beginPath(); - ctx.arc(this.position.x, this.position.y, this.radius, 0, 2 * Math.PI); - ctx.fill(); - //draw clock on timer - ctx.fillStyle = "#f12"; - ctx.beginPath(); - ctx.arc(this.position.x, this.position.y, this.radius * (1 - (this.endCycle - game.cycle) / this.endCycleLength), 0, 2 * Math.PI); - ctx.fill(); - } - }; + } } }, { name: "spores", - description: "release an orb that discharges spores after 2 seconds
spores seek out targets
spores can pass through blocks", + description: "release an orb that discharges spores after 2 seconds
spores seek out targets
spores can pass through blocks", ammo: 0, ammoPack: 5, have: false, @@ -1314,7 +1152,7 @@ const b = { }, { name: "drones", - description: "release drones that seek out targets
if no targets, drones move to mouse
", + description: "release drones that seek out targets
if no targets are found, drones move towards mouse
", ammo: 0, ammoPack: 20, have: false, diff --git a/js/game.js b/js/game.js index acd5d0d..9efffbd 100644 --- a/js/game.js +++ b/js/game.js @@ -1,6 +1,15 @@ // game Object ******************************************************** //********************************************************************* const game = { + // difficulty: { + // damageDone: 1, + // damageTaken: 1, + // mobQuickness: 1, + // powerUpDropRate: 1, + // fallingDamage: false, + // explosiveDamage: true, + // unlimitedAmmo: false, + // }, loop() { game.cycle++; //tracks game cycles mech.cycle++; //tracks player cycles //used to alow time to stop for everything, but the player @@ -710,13 +719,12 @@ const game = { } }, mapFill: "#444", - bodyFill: "#999", + bodyFill: "rgba(140,140,140,0.85)", //"#999", bodyStroke: "#222", drawMapPath() { ctx.fillStyle = this.mapFill; ctx.fill(this.mapPath); }, - seeEdges() { const eye = { x: mech.pos.x + 20 * Math.cos(mech.angle), diff --git a/js/index.js b/js/index.js index a50d567..4ff60d5 100644 --- a/js/index.js +++ b/js/index.js @@ -2,7 +2,19 @@ /* TODO: ******************************************* ***************************************************** -make power ups keep moving to player if the field is turned off +add Boss levels + + +add modular difficulty settings + take reduced dmg + slower mob look / CD + more drops + fewer mobs + make a new var to scale number of mobs and stop using levels cleared var + +get text output to show multiple notifications at once by queuing them vertically + +make power ups keep moving to player if the pickup field is turned off before they get picked up not sure how to do this without adding a constant check levels spawn by having the map aspects randomly fly into place diff --git a/js/level.js b/js/level.js index 59b8e31..cd7d819 100644 --- a/js/level.js +++ b/js/level.js @@ -14,7 +14,7 @@ const level = { if (game.levelsCleared === 0) { // game.levelsCleared = 16; //for testing to simulate possible mobs spawns // b.giveGuns("all", 1000) - // b.giveGuns(3) // set a starting gun for testing + // b.giveGuns(9) // set a starting gun for testing // mech.fieldUpgrades[2].effect(); //give a field power up for testing // b.giveMod(8) @@ -36,8 +36,8 @@ const level = { game.draw.setPaths(); }, difficultyIncrease() { - game.dmgScale += 0.35; //damage done by mobs increases each level - b.dmgScale *= 0.92; //damage done by player decreases each level + game.dmgScale += 0.3; //damage done by mobs increases each level + b.dmgScale *= 0.94; //damage done by player decreases each level game.accelScale *= 1.05 //mob acceleration increases each level game.lookFreqScale *= 0.95 //mob cycles between looks decreases each level game.CDScale *= 0.95 //mob CD time decreases each level @@ -122,7 +122,8 @@ const level = { // spawn.bodyRect(-45, -100, 40, 50); // spawn.focuser(800, -1150); // spawn.groupBoss(-600, -550); - spawn.starter(800, -150, 100); + spawn.striker(800, -150); + // spawn.beamer(800, -150); // spawn.grower(800, -250); // spawn.blinker(800, -250, 40); // spawn.groupBoss(900, -1070); @@ -797,7 +798,7 @@ const level = { spawn.mapRect(1600, -400, 1500, 500); //long center building spawn.mapRect(1345, -1100, 250, 25); //left platform spawn.mapRect(1755, -1100, 250, 25); //right platform - spawn.mapRect(1300, -1850, 750, 50); //left higher platform + spawn.mapRect(1300, -1850, 780, 50); //left higher platform spawn.mapRect(1300, -2150, 50, 350); //left higher platform left edge wall spawn.mapRect(1300, -2150, 450, 50); //left higher platform roof spawn.mapRect(1500, -1860, 100, 50); //ground bump wall @@ -1554,7 +1555,7 @@ const level = { }, levelAnnounce() { document.title = "n-gon: L" + (game.levelsCleared) + " " + level.levels[level.onLevel]; - game.makeTextLog(`
level ${game.levelsCleared}
${level.levels[level.onLevel]}
`, 300); + // game.makeTextLog(`
level ${game.levelsCleared}
${level.levels[level.onLevel]}
`, 300); // if (game.levelsCleared === 0) text = ""; // text = "Level " + (game.levelsCleared + 1) + ": " + spawn.pickList[0] + "s + " + spawn.pickList[1] + "s"; @@ -1572,7 +1573,7 @@ const level = { for (let i = 0; i < body.length; i++) { //body[i].collisionFilter.group = 0; body[i].collisionFilter.category = 0x010000; - body[i].collisionFilter.mask = 0x011111; + body[i].collisionFilter.mask = 0x111111; body[i].classType = "body"; World.add(engine.world, body[i]); //add to world } diff --git a/js/mobs.js b/js/mobs.js index 30cfd8a..268f92c 100644 --- a/js/mobs.js +++ b/js/mobs.js @@ -252,6 +252,8 @@ const mobs = { ctx.lineWidth = 1; ctx.stroke(); ctx.setLineDash([]); + ctx.fillStyle = "rgba(255,0,170,0.03)"; + ctx.fill(); } }, laser() { diff --git a/js/player.js b/js/player.js index 5fa1152..ab704f9 100644 --- a/js/player.js +++ b/js/player.js @@ -439,7 +439,7 @@ const mech = { document.getElementById("fade-out").style.opacity = 1; //slowly fades out setTimeout(function () { game.splashReturn(); - }, 5000); + }, 3000); } }, health: 0, @@ -912,12 +912,12 @@ const mech = { }, hold() {}, fieldText() { - game.makeTextLog(`${mech.fieldUpgrades[mech.fieldMode].name}
(right click or space bar)

${mech.fieldUpgrades[mech.fieldMode].description}

`, 1200); + game.makeTextLog(`${mech.fieldUpgrades[mech.fieldMode].name}
(right click or space bar)

${mech.fieldUpgrades[mech.fieldMode].description}`, 1000); document.getElementById("field").innerHTML = mech.fieldUpgrades[mech.fieldMode].name //add field }, fieldUpgrades: [{ name: "field emitter", - description: "lets you pick up and throw objects
shields you from damage", + description: "shields you from damage
lets you pick up and throw objects", effect: () => { mech.fieldMode = 0; mech.fieldText(); @@ -944,7 +944,7 @@ const mech = { }, { name: "time dilation field", - description: "stop time while field is active
can fire while field is active", + description: "stop time  while field is active
can fire while field is active", effect: () => { mech.fieldMode = 1; mech.fieldText(); @@ -1015,7 +1015,7 @@ const mech = { }, { name: "electrostatic field", - description: "field does damage on contact
blocks are thrown at a higher velocity
increased field regeneration", + description: "field does damage on contact
blocks are thrown at a higher velocity
increased field regeneration", effect: () => { mech.fieldMode = 2; mech.fieldText(); @@ -1088,7 +1088,7 @@ const mech = { }, { name: "negative mass field", - description: "field nullifies gravity
player can hold more massive objects
can fire while field is active", + description: "field nullifies  gravity
player can hold more massive objects
can fire while field is active", effect: () => { mech.fieldMode = 3; mech.fieldText(); @@ -1176,12 +1176,12 @@ const mech = { }, { name: "standing wave harmonics", - description: "oscillating shields always surround player
decreased field regeneration", + description: "you are surrounded by oscillating shields
decreased field regeneration", effect: () => { mech.fieldMode = 4; mech.fieldText(); mech.setHoldDefaults(); - mech.fieldRegen *= 0.25; + mech.fieldRegen *= 0.3; mech.hold = function () { if (mech.isHolding) { @@ -1219,7 +1219,7 @@ const mech = { }, { name: "nano-scale manufacturing", - description: "excess field energy used to build drones
increased field regeneration", + description: "excess field energy used to build drones
increased field regeneration", effect: () => { mech.fieldMode = 5; mech.fieldText(); @@ -1250,7 +1250,7 @@ const mech = { }, { name: "phase decoherence field", - description: "intangible while field is active
can't see or be seen outside field", + description: "intangible while field is active
can't see or be seen outside field", effect: () => { mech.fieldMode = 6; mech.fieldText(); diff --git a/js/powerups.js b/js/powerups.js index 9b80850..64ae5d6 100644 --- a/js/powerups.js +++ b/js/powerups.js @@ -11,7 +11,7 @@ const powerUps = { let heal = (this.size / 40) ** 2 heal = Math.min(1 - mech.health, heal) mech.addHealth(heal); - if (!game.lastLogTime && heal > 0) game.makeTextLog('heal for ' + (heal * 100).toFixed(0) + '%', 180) + if (!game.lastLogTime && heal > 0) game.makeTextLog(" heal " + (heal * 100).toFixed(0) + "%", 300) } }, ammo: { @@ -41,13 +41,13 @@ const powerUps = { } if (target.ammo === Infinity) { mech.fieldMeter = 1; - if (!game.lastLogTime) game.makeTextLog("+energy", 180); + if (!game.lastLogTime) game.makeTextLog("+energy", 300); } else { //ammo given scales as mobs take more hits to kill const ammo = Math.ceil((target.ammoPack * (0.6 + 0.04 * Math.random())) / b.dmgScale); target.ammo += ammo; game.updateGunHUD(); - if (!game.lastLogTime) game.makeTextLog("+" + ammo + " ammo: " + target.name, 180); + if (!game.lastLogTime) game.makeTextLog("+" + ammo + " ammo for " + target.name + "", 300); } } }, @@ -93,7 +93,7 @@ const powerUps = { if (options.length > 0) { let newMod = options[Math.floor(Math.random() * options.length)] b.giveMod(newMod) - game.makeTextLog(`${b.mods[newMod].name}

${b.mods[newMod].description}

`, 1200); + game.makeTextLog(`${b.mods[newMod].name}

${b.mods[newMod].description}`, 1000); if (options.length < 2) powerUps.haveAllMods = true } } @@ -117,12 +117,8 @@ const powerUps = { //give player a gun they don't already have if possible if (options.length > 0) { let newGun = options[Math.floor(Math.random() * options.length)]; - // newGun = 4; //makes every gun you pick up this type //enable for testing one gun - if (b.activeGun === null) { - b.activeGun = newGun //if no active gun switch to new gun - game.makeTextLog("Use left mouse to fire weapon.", Infinity); - } - game.makeTextLog(`${b.guns[newGun].name}
(left click)

${b.guns[newGun].description}

`, 1000); + if (b.activeGun === null) b.activeGun = newGun //if no active gun switch to new gun + game.makeTextLog(`${b.guns[newGun].name}
(left click)

${b.guns[newGun].description}`, 900); b.guns[newGun].have = true; b.inventory.push(newGun); b.guns[newGun].ammo += b.guns[newGun].ammoPack * 2; @@ -133,7 +129,7 @@ const powerUps = { const ammo = Math.ceil(b.guns[ammoTarget].ammoPack * 2); b.guns[ammoTarget].ammo += ammo; game.updateGunHUD(); - game.makeTextLog("+" + ammo + " ammo: " + b.guns[ammoTarget].name, 180); + game.makeTextLog("+" + ammo + " ammo for " + b.guns[ammoTarget].name + "", 300); } } }, diff --git a/style.css b/style.css index bd4e6e5..b538516 100644 --- a/style.css +++ b/style.css @@ -112,8 +112,8 @@ summary { width: 100%; height: 100%; background-color: #fff; - opacity: 0; - transition: opacity 5s; + opacity: 1; + transition: opacity 3s; pointer-events: none; } @@ -169,21 +169,64 @@ summary { } #text-log { - position: absolute; + /* position: absolute; top: 20px; left: 0; - width: 100%; - line-height: 150%; - text-align: center; + width: 100%; */ + z-index: 2; + position: absolute; + bottom: 20px; + left: 20px; + /* left: 50%; */ + /* transform: translate(-50%, 0); */ + + padding: 10px; + border-radius: 10px; + + /* text-align: center; */ + line-height: 150%; font-size: 1.25em; color: #000; + background-color: rgba(255, 255, 255, 0.23); + opacity: 0; transition: opacity 0.5s; pointer-events: none; user-select: none; } +.color-f { + color: #0bf; +} + +.color-b { + color: #023; +} + +.color-d { + color: #f05; +} + +.color-h { + color: #0d9; +} + +.color-e { + color: #a10; +} + +.color-s { + color: #066; + font-weight: 900; + letter-spacing: 2px; +} + +.faded { + opacity: 0.7; + font-size: 90%; +} + .box { padding: 3px 8px 3px 8px; border: 2px solid #444; @@ -191,10 +234,6 @@ summary { background-color: rgba(255, 255, 255, 0.5); } -.faded { - opacity: 0.5; - font-size: 85%; -} .wrapper { display: grid;