diff --git a/.DS_Store b/.DS_Store index 2acac6e..a1ce397 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/index.html b/index.html index 37c1715..27630eb 100644 --- a/index.html +++ b/index.html @@ -112,14 +112,13 @@ --> classic n-gon: - + 9-6-2016 10-2-2016 7-1-2017 1-4-2018 7-11-2019 9-8-2019 - 3-13-2020 limit frames per second: @@ -155,10 +154,10 @@ GUNS Q / E / mouse wheel - + PAUSE P diff --git a/js/bullet.js b/js/bullet.js index 47bf92b..88383c7 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -797,7 +797,7 @@ const b = { }); }, foam(position, velocity, radius) { - radius *= Math.sqrt(mod.bulletSize) + // radius *= Math.sqrt(mod.bulletSize) const me = bullet.length; bullet[me] = Bodies.polygon(position.x, position.y, 20, radius, { // angle: 0, @@ -807,7 +807,7 @@ const b = { // friction: 0.2, // restitution: 0.2, dmg: mod.isFastFoam ? 0.02 : 0.0055, //damage done in addition to the damage from momentum - scale: 1 - 0.005 / mod.isBulletsLastLonger * (mod.isFastFoam ? 1.7 : 1), + scale: 1 - 0.005 / mod.isBulletsLastLonger * (mod.isFastFoam ? 1.6 : 1), classType: "bullet", collisionFilter: { category: cat.bullet, @@ -1534,56 +1534,78 @@ const b = { game.makeGunHUD(); }, guns: [{ - name: "minigun", - description: "rapidly fire a stream of small bulletsfire delay decreases as you shoot", + name: "nail gun", + description: "use compressed air to fire a stream of nailsdelay after firing decreases as you shoot", ammo: 0, - ammoPack: 65, - defaultAmmoPack: 65, + ammoPack: 60, + defaultAmmoPack: 60, recordedAmmo: 0, have: false, nextFireCycle: 0, //use to remember how longs its been since last fire, used to reset count startingHoldCycle: 0, fire() { - //fire delay decreases as you hold fire, down to 3 from 15 - const pos = { - x: mech.pos.x + 23 * Math.cos(mech.angle), - y: mech.pos.y + 23 * Math.sin(mech.angle) - } - if (mod.nailGun) { - mech.fireCDcycle = mech.cycle + Math.floor(2.1 * b.fireCD); // cool down - const speed = 33 + 10 * Math.random() - const angle = mech.angle + (Math.random() - 0.5) * (Math.random() - 0.5) * (mech.crouch ? 0.22 : 0.65) - const velocity = { - x: speed * Math.cos(angle), - y: speed * Math.sin(angle) + let CD + if (mod.nailFireRate) { //fire delay decreases as you hold fire, down to 3 from 15 + if (mod.nailInstantFireRate) { + CD = 2 + } else { + if (this.nextFireCycle + 1 < mech.cycle) this.startingHoldCycle = mech.cycle //reset if not constantly firing + CD = Math.max(5 - 0.06 * (mech.cycle - this.startingHoldCycle), 2) //CD scales with cycles fire is held down + this.nextFireCycle = mech.cycle + CD * b.fireCD //predict next fire cycle if the fire button is held down } - b.nail(pos, velocity, 1) //position, velocity, damage } else { if (this.nextFireCycle + 1 < mech.cycle) this.startingHoldCycle = mech.cycle //reset if not constantly firing - const CD = Math.max(11 - 0.06 * (mech.cycle - this.startingHoldCycle), 2) //CD scales with cycles fire is held down + CD = Math.max(11 - 0.06 * (mech.cycle - this.startingHoldCycle), 2) //CD scales with cycles fire is held down this.nextFireCycle = mech.cycle + CD * b.fireCD //predict next fire cycle if the fire button is held down - - const me = bullet.length; - const dir = mech.angle + (Math.random() - 0.5) * ((mech.crouch) ? 0.01 : 0.1); - bullet[me] = Bodies.rectangle(pos.x, pos.y, 20 * mod.bulletSize, 6 * mod.bulletSize, b.fireAttributes(dir)); - b.fireProps(CD, mech.crouch ? 38 : 34, dir, me); //cd , speed - - bullet[me].endCycle = game.cycle + 70; - bullet[me].dmg = 0.25; - bullet[me].frictionAir = mech.crouch ? 0.001 : 0.003; - if (mod.isIceCrystals) { - bullet[me].onDmg = function (who) { - mobs.statusSlow(who, 30) - }; - mech.energy -= mech.fieldRegen + 0.0075 - if (mech.energy < 0.02) { - mech.fireCDcycle = mech.cycle + 60; // cool down - } - } - bullet[me].do = function () { - this.force.y += this.mass * 0.0003; - }; } + mech.fireCDcycle = mech.cycle + Math.floor(CD * b.fireCD); // cool down + + const speed = 28 + 8 * Math.random() + 6 * mod.nailInstantFireRate + const angle = mech.angle + (Math.random() - 0.5) * (Math.random() - 0.5) * (mech.crouch ? 1.35 : 3.2) / CD + b.nail({ + x: mech.pos.x + 23 * Math.cos(mech.angle), + y: mech.pos.y + 23 * Math.sin(mech.angle) + }, { + x: mech.Vx / 2 + speed * Math.cos(angle), + y: mech.Vy / 2 + speed * Math.sin(angle) + }, 0.9) //position, velocity, damage + + if (mod.isIceCrystals) { + bullet[bullet.length - 1].onDmg = function (who) { + mobs.statusSlow(who, 30) + }; + mech.energy -= mech.fieldRegen + 0.008 + if (mech.energy < 0.02) mech.fireCDcycle = mech.cycle + 60; // cool down + } + + + + // } else { + // if (this.nextFireCycle + 1 < mech.cycle) this.startingHoldCycle = mech.cycle //reset if not constantly firing + // const CD = Math.max(11 - 0.06 * (mech.cycle - this.startingHoldCycle), 2) //CD scales with cycles fire is held down + // this.nextFireCycle = mech.cycle + CD * b.fireCD //predict next fire cycle if the fire button is held down + + // const me = bullet.length; + // const dir = mech.angle + (Math.random() - 0.5) * ((mech.crouch) ? 0.01 : 0.1); + // bullet[me] = Bodies.rectangle(pos.x, pos.y, 20 * mod.bulletSize, 6 * mod.bulletSize, b.fireAttributes(dir)); + // b.fireProps(CD, mech.crouch ? 38 : 34, dir, me); //cd , speed + + // bullet[me].endCycle = game.cycle + 70; + // bullet[me].dmg = 0.25; + // bullet[me].frictionAir = mech.crouch ? 0.001 : 0.003; + // if (mod.isIceCrystals) { + // bullet[me].onDmg = function (who) { + // mobs.statusSlow(who, 30) + // }; + // mech.energy -= mech.fieldRegen + 0.0075 + // if (mech.energy < 0.02) { + // mech.fireCDcycle = mech.cycle + 60; // cool down + // } + // } + // bullet[me].do = function () { + // this.force.y += this.mass * 0.0003; + // }; + // } } }, { @@ -1632,7 +1654,7 @@ const b = { b.nail(pos, velocity, 1) } } else { - const side = 21 * mod.bulletSize + const side = 21 for (let i = 0; i < 17; i++) { const me = bullet.length; const dir = mech.angle + (Math.random() - 0.5) * spread @@ -2559,7 +2581,7 @@ const b = { have: false, fire() { mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 20 : 6) * b.fireCD); // cool down - const radius = mech.crouch ? 10 + 7 * Math.random() : 4 + 6 * Math.random() //(4 + (mech.crouch ? 15 : 6) * Math.random()) + const radius = (mech.crouch ? 10 + 7 * Math.random() : 4 + 6 * Math.random()) const dir = mech.angle + 0.2 * (Math.random() - 0.5) const position = { x: mech.pos.x + 30 * Math.cos(mech.angle), diff --git a/js/game.js b/js/game.js index 453dc08..16d23bb 100644 --- a/js/game.js +++ b/js/game.js @@ -286,18 +286,6 @@ const game = { // mech.drop(); }, keyPress() { //runs on key down event - if (keys[189] || keys[79]) { - // - key - game.isAutoZoom = false; - game.zoomScale /= 0.9; - game.setZoom(); - } else if (keys[187] || keys[73]) { - // = key - game.isAutoZoom = false; - game.zoomScale *= 0.9; - game.setZoom(); - } - //full screen toggle // if (keys[13]) { // //enter key @@ -314,8 +302,6 @@ const game = { // } // setupCanvas(); // } - - if (keys[69]) { // e swap to next active gun game.nextGun(); } else if (keys[81]) { //q swap to previous active gun @@ -359,6 +345,19 @@ const game = { } //in testing mode if (game.testing) { + + if (keys[79]) { + // - key + game.isAutoZoom = false; + game.zoomScale /= 0.9; + game.setZoom(); + } else if (keys[73]) { + // = key + game.isAutoZoom = false; + game.zoomScale *= 0.9; + game.setZoom(); + } + if (keys[192]) { // ` powerUps.directSpawn(game.mouseInGame.x, game.mouseInGame.y, "reroll"); } else if (keys[49]) { // give power ups with 1 diff --git a/js/index.js b/js/index.js index d563b9c..497f4c4 100644 --- a/js/index.js +++ b/js/index.js @@ -445,7 +445,7 @@ if (localSettings) { isCommunityMaps: false, difficultyMode: '1', fpsCapDefault: 'max', - runCount: -1, + runCount: 0, }; localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage document.getElementById("community-maps").checked = localSettings.isCommunityMaps diff --git a/js/level.js b/js/level.js index 19bd41c..bdfaeb8 100644 --- a/js/level.js +++ b/js/level.js @@ -16,9 +16,9 @@ const level = { // game.zoomScale = 1000; // game.setZoom(); // mech.isStealth = true; - // b.giveGuns("minigun") + // b.giveGuns("nail gun") // mech.setField("standing wave harmonics") - // mod.giveMod("nail gun"); + // mod.giveMod("pneumatic actuator"); level.intro(); //starting level // level.testing(); //not in rotation diff --git a/js/mods.js b/js/mods.js index 04e8af2..68b2f48 100644 --- a/js/mods.js +++ b/js/mods.js @@ -67,7 +67,7 @@ const mod = { !build.isCustomSelection && b.inventory.length > 2 && name !== b.guns[b.activeGun].name && - Math.random() < -0.1 + 0.1 * (b.inventory.length + mod.isGunCycle * 2) //lower chance of mods specific to a gun if you have lots of guns + Math.random() > 2 / (b.inventory.length + mod.isGunCycle * 3) //lower chance of mods specific to a gun if you have lots of guns ) { return false } @@ -82,7 +82,7 @@ const mod = { if (mod.isDamageForGuns) dmg *= 1 + 0.07 * b.inventory.length if (mod.isLowHealthDmg) dmg *= 1 + 0.5 * Math.max(0, 1 - mech.health) if (mod.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 2; - if (mod.isEnergyLoss) dmg *= 1.33; + if (mod.isEnergyLoss) dmg *= 1.37; if (mod.isAcidDmg && mech.health > 1) dmg *= 1.4; if (mod.isRest && player.speed < 1) dmg *= 1.20; if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5; @@ -128,7 +128,7 @@ const mod = { }, { name: "acute stress response", - description: "increase damage by 33%if a mob dies drain stored energy by 25%", + description: "increase damage by 37%if a mob dies drain stored energy by 25%", maxCount: 1, count: 0, allowed() { @@ -557,7 +557,7 @@ const mod = { }, { name: "scrap bots", - description: "12% chance to build a bot after killing a mobthe bot only functions until the end of the level", + description: "11% chance to build a bot after killing a mobthe bot only functions until the end of the level", maxCount: 6, count: 0, allowed() { @@ -565,7 +565,7 @@ const mod = { }, requires: "a bot", effect() { - mod.isBotSpawner += 0.12; + mod.isBotSpawner += 0.11; }, remove() { mod.isBotSpawner = 0; @@ -1371,50 +1371,50 @@ const mod = { } }, { - name: "depleted uranium rounds", - description: `your bullets are 18% largerincreased mass and physical damage`, - count: 0, - maxCount: 9, - allowed() { - return (mod.haveGunCheck("minigun") && !mod.nailGun) || mod.haveGunCheck("shotgun") || mod.haveGunCheck("super balls") - }, - requires: "minigun, shotgun, super balls", - effect() { - mod.bulletSize += 0.18 - }, - remove() { - mod.bulletSize = 1; - } - }, - { - name: "nail gun", - description: "the minigun is modified to fire nailswith a short fire delay and a low precision", + name: "pneumatic actuator", + description: "nail gun takes 50% less time to ramp upto it's shortest delay after firing", maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("minigun") && !mod.isIceCrystals + return mod.haveGunCheck("nail gun") }, - requires: "minigun", + requires: "nail gun", effect() { - mod.nailGun = true + mod.nailFireRate = true }, remove() { - mod.nailGun = false + mod.nailFireRate = false + } + }, + { + name: "powder-actuated", + description: "nail gun takes no time to ramp upnails have a 20% faster muzzle speed", + maxCount: 1, + count: 0, + allowed() { + return mod.haveGunCheck("nail gun") && mod.nailFireRate && !mod.isIceCrystals + }, + requires: "nail gun", + effect() { + mod.nailInstantFireRate = true + }, + remove() { + mod.nailInstantFireRate = false } }, { name: "ice crystal nucleation", - description: "the minigun uses energy to condenseunlimited freezing bullets from water vapor", + description: "the nail gun uses energy to condenseunlimited freezing ice shards", maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("minigun") && !mod.nailGun + return mod.haveGunCheck("nail gun") && !mod.nailInstantFireRate }, - requires: "minigun", + requires: "nail gun", effect() { mod.isIceCrystals = true; for (i = 0, len = b.guns.length; i < len; i++) { //find which gun - if (b.guns[i].name === "minigun") { + if (b.guns[i].name === "nail gun") { b.guns[i].ammoPack = Infinity b.guns[i].recordedAmmo = b.guns[i].ammo b.guns[i].ammo = Infinity @@ -1426,7 +1426,7 @@ const mod = { remove() { mod.isIceCrystals = false; for (i = 0, len = b.guns.length; i < len; i++) { //find which gun - if (b.guns[i].name === "minigun") { + if (b.guns[i].name === "nail gun") { b.guns[i].ammoPack = b.guns[i].defaultAmmoPack; b.guns[i].ammo = b.guns[i].recordedAmmo game.updateGunHUD(); @@ -1527,6 +1527,22 @@ const mod = { mod.oneSuperBall = false; } }, + { + name: "super sized", + description: `your super balls are 22% largerincreased mass and physical damage`, + count: 0, + maxCount: 9, + allowed() { + return mod.haveGunCheck("super balls") + }, + requires: "super balls", + effect() { + mod.bulletSize += 0.22 + }, + remove() { + mod.bulletSize = 1; + } + }, { name: "flechettes cartridges", description: "flechettes release three needles in each shotammo cost are increases by 3x", @@ -1843,7 +1859,7 @@ const mod = { maxCount: 1, count: 0, allowed() { - return mod.nailBotCount + mod.grenadeFragments + mod.nailsDeathMob / 2 + (mod.haveGunCheck("mine") + mod.isRailNails + mod.isNailShot + mod.nailGun) * 2 > 1 + return mod.nailBotCount + mod.grenadeFragments + mod.nailsDeathMob / 2 + (mod.haveGunCheck("mine") + mod.isRailNails + mod.isNailShot + (mod.haveGunCheck("nail gun") && !mod.isIceCrystals)) * 2 > 1 }, requires: "nails", effect() { @@ -2016,7 +2032,7 @@ const mod = { }, { name: "colloidal foam", - description: "increase foam damage by 200%foam dissipates 50% faster", + description: "increase foam damage by 200%foam dissipates 40% faster", maxCount: 1, count: 0, allowed() { @@ -2030,6 +2046,22 @@ const mod = { mod.isFastFoam = false; } }, + // { + // name: "foam size", + // description: "increase foam damage by 200%foam dissipates 50% faster", + // maxCount: 1, + // count: 0, + // allowed() { + // return mod.haveGunCheck("foam") || mod.foamBotCount > 2 + // }, + // requires: "foam", + // effect() { + // mod.isLargeFoam = true + // }, + // remove() { + // mod.isLargeFoam = false; + // } + // }, { name: "frame-dragging", description: "slow time while charging the rail guncharging no longer drains energy", @@ -2651,5 +2683,6 @@ const mod = { isFastFoam: null, isSporeGrowth: null, isBayesian: null, - nailGun: null + nailGun: null, + nailInstantFireRate: null } \ No newline at end of file diff --git a/todo.txt b/todo.txt index b829eac..3562af9 100644 --- a/todo.txt +++ b/todo.txt @@ -1,29 +1,43 @@ -2x difficulty increases after clearing every level once -mod - minigun fires nails, nails are inaccurate, but fire rapidly -added an option to play older versions of n-gon in settings +zoom now only works in testing mode with keys: i / o + +minigun is now nailgun (higher damage, lower ammo) +mod: pneumatic actuator - nail gun's ramp up time is 50% shorter +mod: powder-actuated - removes ramp up time and increases nail speed + +removed mod depleted uranium +mod: super size - larger super balls ************** TODO - n-gon ************** +mod: railroad ties - nails are larger and do more damage + +foam needs a new mod + is the foam mod colloidal foam fun? + increase foam bullet size? + foam explodes when it runs out? + +removing supersaturation sets total health to 1 + this cancels the health benefits from crystallized armor + produce a method that calculates max health based on mods + player goes intangible while immune after getting hit? getting stuck above a mob can immobilize player add a minimum knock from player mob collisions? +use mac automator to speed up your n-gon -> git sync + +considering removing the perfect diamagnetism field from the game perfect diamagnetism be able to grab and launch mobs Gun: Launch yourself at high speed to the enemy, gaining temporary invincibility while in the air and for 3 seconds after landing. Upon impact, trigger a large explosion. -removing supersaturation sets total health to 1 - this cancels the health benefits from crystallized armor - produce a method that calculates max health based on mods - fix door.isOpen actually meaning isClosed mod - laser fires 3 beams after you die custom should be populated with your last build - -considering removing the perfect diamagnetism field from the game +also you should be able to share while paused use canvas pixel array effects for full screen graphics add some pixels after player gets hit?