diff --git a/index.html b/index.html index 7711ac1..98b08ff 100644 --- a/index.html +++ b/index.html @@ -87,7 +87,7 @@
- + custom diff --git a/js/bullet.js b/js/bullet.js index a2b4cc8..7633432 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -559,7 +559,7 @@ const b = { bulletType: "mine", collisionFilter: { category: cat.bullet, - mask: cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield | cat.bullet + mask: cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield // | cat.bullet //doesn't collide with other bullets until it lands (was crashing into bots) }, minDmgSpeed: 5, stillCount: 0, @@ -629,6 +629,7 @@ const b = { } }, sentry() { + this.collisionFilter.mask = cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield | cat.bullet //can now collide with other bullets this.lookFrequency = game.cycle + 60 this.endCycle = game.cycle + 1080 this.do = function() { //overwrite the do method for this bullet @@ -655,6 +656,7 @@ const b = { } }, arm() { + this.collisionFilter.mask = cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield | cat.bullet //can now collide with other bullets this.lookFrequency = game.cycle + 60 this.do = function() { //overwrite the do method for this bullet this.force.y += this.mass * 0.002; //extra gravity @@ -1954,11 +1956,54 @@ const b = { } b.muzzleFlash(35); - if (mod.isIncendiary) { + + if (mod.isSlugShot) { + const me = bullet.length; + const dir = mech.angle + 0.02 * (Math.random() - 0.5) + bullet[me] = Bodies.rectangle(mech.pos.x + 35 * Math.cos(mech.angle), mech.pos.y + 35 * Math.sin(mech.angle), 45, 20, b.fireAttributes(dir)); + Matter.Body.setDensity(bullet[me], 0.0022); + World.add(engine.world, bullet[me]); //add bullet to world + const SPEED = (mech.crouch ? 52 : 43) + Math.random() * 7 + Matter.Body.setVelocity(bullet[me], { + x: SPEED * Math.cos(dir), + y: SPEED * Math.sin(dir) + }); + if (mod.isIncendiary) { + bullet[me].endCycle = game.cycle + 60 + bullet[me].onEnd = function() { + b.explosion(this.position, 250 + (Math.random() - 0.5) * 60); //makes bullet do explosive damage at end + } + bullet[me].beforeDmg = function() { + this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion + }; + } else { + bullet[me].endCycle = game.cycle + 180 + } + bullet[me].minDmgSpeed = 15 + // bullet[me].restitution = 0.4 + bullet[me].frictionAir = 0.006; + bullet[me].do = function() { + this.force.y += this.mass * 0.002 + + //rotates bullet to face current velocity? + if (this.speed > 6) { + const facing = { + x: Math.cos(this.angle), + y: Math.sin(this.angle) + } + const mag = 0.0033 + if (Vector.cross(Vector.normalise(this.velocity), facing) < 0) { + this.torque += mag + } else { + this.torque -= mag + } + } + }; + } else if (mod.isIncendiary) { const SPEED = mech.crouch ? 35 : 25 const END = Math.floor(mech.crouch ? 9 : 6); const totalBullets = 8 - const angleStep = (mech.crouch ? 0.1 : 0.33) / totalBullets + const angleStep = (mech.crouch ? 0.15 : 0.4) / totalBullets let dir = mech.angle - angleStep * totalBullets / 2; for (let i = 0; i < totalBullets; i++) { //5 -> 7 dir += angleStep @@ -1973,7 +2018,7 @@ const b = { y: speed * Math.sin(dirOff) }); bullet[me].onEnd = function() { - b.explosion(this.position, 60 + (Math.random() - 0.5) * 40); //makes bullet do explosive damage at end + b.explosion(this.position, 80 + (Math.random() - 0.5) * 30); //makes bullet do explosive damage at end } bullet[me].beforeDmg = function() { this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion @@ -1981,29 +2026,6 @@ const b = { bullet[me].do = function() {} World.add(engine.world, bullet[me]); //add bullet to world } - // for (let i = 0; i < totalBullets; i++) { //5 -> 7 - // 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), 17, 4, b.fireAttributes(dir)); - // World.add(engine.world, bullet[me]); //add bullet to world - // Matter.Body.setVelocity(bullet[me], { - // x: (SPEED + 15 * Math.random() - 2 * i) * Math.cos(dir), - // y: (SPEED + 15 * Math.random() - 2 * i) * Math.sin(dir) - // }); - // bullet[me].endCycle = 2 * i + END - // bullet[me].restitution = 0; - // bullet[me].friction = 1; - // bullet[me].onEnd = function() { - // b.explosion(this.position, (mech.crouch ? 95 : 75) + (Math.random() - 0.5) * 50); //makes bullet do explosive damage at end - // } - // bullet[me].beforeDmg = function() { - // this.endCycle = 0; //bullet ends cycle after hitting a mob and triggers explosion - // }; - // bullet[me].do = function() { - // // this.force.y += this.mass * 0.0004; - // } - // } - } else if (mod.isNailShot) { for (let i = 0; i < 14; i++) { const dir = mech.angle + (Math.random() - 0.5) * spread * 0.2 diff --git a/js/index.js b/js/index.js index 6ef4f43..c07f963 100644 --- a/js/index.js +++ b/js/index.js @@ -183,8 +183,8 @@ const build = { text += `
damage increase: ${((mod.damageFromMods()-1)*100).toFixed(0)}%
harm reduction: ${((1-mech.harmReduction())*100).toFixed(0)}% -
fire delay decrease: ${((1-b.fireCD)*100).toFixed(0)}% -
duplication chance: ${(Math.min(1,mod.duplicationChance())*100).toFixed(0)}% +
fire delay decrease: ${((1-b.fireCD)*100).toFixed(0)}% +
duplication chance: ${(Math.min(1,mod.duplicationChance())*100).toFixed(0)}%

rerolls: ${powerUps.reroll.rerolls}
health: (${(mech.health*100).toFixed(0)} / ${(mech.maxHealth*100).toFixed(0)})   energy: (${(mech.energy*100).toFixed(0)} / ${(mech.maxEnergy*100).toFixed(0)}) diff --git a/js/level.js b/js/level.js index 1c128ac..a9f091c 100644 --- a/js/level.js +++ b/js/level.js @@ -13,13 +13,14 @@ const level = { start() { if (level.levelsCleared === 0) { //this code only runs on the first level // game.enableConstructMode() //used to build maps in testing mode - // level.difficultyIncrease(89) + // level.difficultyIncrease(29) // game.zoomScale = 1000; // game.setZoom(); // mech.setField("wormhole") - // b.giveGuns("laser") + // b.giveGuns("shotgun") + // mod.isIncendiary = true // mod.is3Missiles = true - // mod.giveMod("reallocation") + // mod.giveMod("shotgun slug") // mod.giveMod("diffuse beam") level.intro(); //starting level @@ -154,7 +155,7 @@ const level = { spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump // spawn.boost(1500, 0, 900); - spawn.starter(1900, -500, 20) + spawn.starter(1900, -500, 320) // spawn.sucker(2900, -500) // spawn.launcherBoss(1200, -500) // spawn.laserTargetingBoss(1600, -400) diff --git a/js/mods.js b/js/mods.js index 9735465..37e7e2b 100644 --- a/js/mods.js +++ b/js/mods.js @@ -270,7 +270,7 @@ const mod = { }, { name: "electrostatic discharge", - description: "increase damage by 20%
20% increased delay after firing", + description: "increase damage by 20%
20% increased delay after firing", maxCount: 1, count: 0, allowed() { @@ -287,7 +287,7 @@ const mod = { }, { name: "Ψ(t) collapse", - description: "66% decreased delay after firing
if you have no rerolls", + description: "66% decreased delay after firing
if you have no rerolls", maxCount: 1, count: 0, allowed() { @@ -307,7 +307,7 @@ const mod = { }, { name: "auto-loading heuristics", - description: "30% decreased delay after firing", + description: "30% decreased delay after firing", maxCount: 9, count: 0, allowed() { @@ -747,7 +747,7 @@ const mod = { }, { name: "bot replication", - description: "duplicate your permanent bots
remove all of your guns", + description: "duplicate your permanent bots
remove all of your guns", maxCount: 1, count: 0, // isNonRefundable: true, @@ -848,9 +848,9 @@ const mod = { maxCount: 1, count: 0, allowed() { - return mech.Fx > 0.016 + return mech.Fx > 0.016 && !mod.isEnergyHealth }, - requires: "speed increase", + requires: "speed increase, not mass-energy equivalence", effect() { mod.isSpeedHarm = true }, @@ -1061,9 +1061,9 @@ const mod = { maxCount: 1, count: 0, allowed() { - return !mod.isPiezo && !mod.isTimeAvoidDeath + return !mod.isPiezo && !mod.isTimeAvoidDeath && !mod.isSpeedHarm && mech.fieldUpgrades[mech.fieldMode].name !== "negative mass field" }, - requires: "not piezoelectricity
or acute stress response", + requires: "not piezoelectricity, acute stress response, 1st law, negative mass field", effect: () => { mech.health = 0 // mech.displayHealth(); @@ -1306,7 +1306,7 @@ const mod = { }, { name: "Bayesian statistics", - description: "16% chance to duplicate spawned power ups
after a collision, eject one of your mods", + description: "16% chance to duplicate spawned power ups
after a collision, eject one of your mods", maxCount: 1, count: 0, allowed() { @@ -1324,7 +1324,7 @@ const mod = { }, { name: "stimulated emission", - description: "7% chance to duplicate spawned power ups", + description: "7% chance to duplicate spawned power ups", maxCount: 9, count: 0, allowed() { @@ -1342,7 +1342,7 @@ const mod = { }, { name: "futures exchange", - description: "clicking X to cancel a mod, field, or gun
increases power up duplication chance by 4%", + description: "clicking × to cancel a mod, field, or gun
increases power up duplication chance by 4%", maxCount: 1, count: 0, allowed() { @@ -1362,7 +1362,7 @@ const mod = { }, { name: "commodities exchange", - description: "clicking X to cancel a mod, field, or gun
spawns 6 heals, ammo, or rerolls", + description: "clicking × to cancel a mod, field, or gun
spawns 6 heals, ammo, or rerolls", maxCount: 1, count: 0, allowed() { @@ -1437,7 +1437,7 @@ const mod = { }, { name: "exchange symmetry", - description: `spawn 1 mod
with double your normal chance for power up duplication`, + description: `spawn 1 mod
with double your normal chance for power up duplication`, maxCount: 1, count: 0, isNonRefundable: true, @@ -1905,7 +1905,7 @@ const mod = { }, { name: "pneumatic actuator", - description: "nail gun takes 45% less time to ramp up
to it's shortest delay after firing", + description: "nail gun takes 45% less time to ramp up
to it's shortest delay after firing", maxCount: 1, count: 0, allowed() { @@ -1975,11 +1975,11 @@ const mod = { }, { name: "nailshot", - description: "the shotgun fires nails
effective at a distance", + description: "the shotgun fires a burst of nails", maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("shotgun") && !mod.isIncendiary + return mod.haveGunCheck("shotgun") && !mod.isIncendiary && !mod.isSlugShot }, requires: "shotgun", effect() { @@ -1989,9 +1989,25 @@ const mod = { mod.isNailShot = false; } }, + { + name: "shotgun slug", + description: "the shotgun fires 1 large bullet", + maxCount: 1, + count: 0, + allowed() { + return mod.haveGunCheck("shotgun") && !mod.isNailShot + }, + requires: "shotgun", + effect() { + mod.isSlugShot = true; + }, + remove() { + mod.isSlugShot = false; + } + }, { name: "Newton's 3rd law", - description: "the shotgun fires 66% faster
recoil is greatly increased", + description: "the shotgun fire delay is 66% faster
recoil is greatly increased", maxCount: 1, count: 0, allowed() { @@ -2247,7 +2263,7 @@ const mod = { }, { name: "MIRV", - description: "launch 3 small missiles instead of 1
1.5x increase in delay after firing", + description: "launch 3 small missiles instead of 1
1.5x increase in delay after firing", maxCount: 1, count: 0, allowed() { @@ -2898,7 +2914,7 @@ const mod = { }, { name: "neocognitron", - description: "pulse automatically aims at a nearby mob
50% decreased delay after firing", + description: "pulse automatically aims at a nearby mob
50% decreased delay after firing", maxCount: 1, count: 0, allowed() { @@ -3237,7 +3253,7 @@ const mod = { }, { name: "discrete optimization", - description: "increase damage by 50%
50% increased delay after firing", + description: "increase damage by 50%
50% increased delay after firing", maxCount: 1, count: 0, allowed() { diff --git a/js/powerup.js b/js/powerup.js index 8f2af9f..abd4222 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -93,9 +93,7 @@ const powerUps = { if (mod.isDeathAvoid && document.getElementById("mod-anthropic")) { document.getElementById("mod-anthropic").innerHTML = `-${powerUps.reroll.rerolls}` } - if (mod.renormalization && Math.random() < 0.37 && amount < 0) { - powerUps.spawn(mech.pos.x, mech.pos.y, "reroll"); - } + if (mod.renormalization && Math.random() < 0.37 && amount < 0) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll"); if (mod.isRerollHaste) { if (powerUps.reroll.rerolls === 0) { mod.rerollHaste = 0.66; diff --git a/js/spawn.js b/js/spawn.js index 423d3ca..f443321 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -94,7 +94,7 @@ const spawn = { me.frictionAir = 0.01; me.memory = Infinity; me.locatePlayer(); - const density = 0.95 + const density = 0.9 Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger // spawn.shield(me, x, y, 1); me.onDeath = function() { diff --git a/style.css b/style.css index 0a74cca..ca62443 100644 --- a/style.css +++ b/style.css @@ -90,7 +90,7 @@ summary { } .SVG-button { - border: 2px #333 solid; + border: 1.5px #333 solid; border-radius: 9px; background-color: #fff; } @@ -208,7 +208,7 @@ summary { padding: 10px; line-height: 170%; /* border-radius: 6px; */ - border: 2px #333 solid; + border: 1px #333 solid; background-color: #fff; font-size: 0.65em; } @@ -239,7 +239,7 @@ summary { padding: 10px; line-height: 170%; /* border-radius: 6px; */ - border: 2px #333 solid; + border: 1px #17263b solid; background-color: #fff; line-height: 170%; @@ -281,12 +281,15 @@ summary { } .build-grid-disabled { - opacity: 0.5; - color: #ccc; + /* opacity: 0.5; */ + background-color: var(--build-bg-color); + color: rgba(0, 0, 0, 0.2); + /* transition: background-color 1s, color 1s; */ } .build-grid-disabled:hover { - background-color: #fff; + /* background-color: #fff; */ + background-color: var(--build-bg-color); } #info { @@ -483,6 +486,14 @@ em { letter-spacing: 1px; } +.color-dup { + /* color: hsl(243, 100%, 38%); */ + font-variant: small-caps; + letter-spacing: 1px; + text-shadow: 1.5px -1.5px hsla(243, 100%, 38%, 0.2); + /* text-decoration: underline; */ +} + .color-cloaked { opacity: 0.25; letter-spacing: 1px; @@ -571,7 +582,7 @@ em { } .grey { - background: #ccc; + background: #afb6c2; } .gun { diff --git a/todo.txt b/todo.txt index 03fbea7..83fbf90 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,8 @@ *********** NEXT PATCH *********** -balance: perimeter defense - 3% harm reduction for each bot (was 5%) -mod: network effect - 2% damage for each bot -mod: commodities exchange - canceling a power up gives 6 rerolls, ammo, or heals +custom and pause menu style update (mostly just thinner lines between blocks) + +mod: shotgun slug - fire a big bullet ************** BUGS ************** @@ -11,7 +11,9 @@ mod: commodities exchange - canceling a power up gives 6 rerolls, ammo, or heals (4+ reports before potential fix) bug - crouch and worm hole? -> crouch locked in players have extra gravity might be from the short jump code - add in a check every 5 seconds to try and fix it + add in a check every 7 seconds to try and fix it + this fix was added and it is working + maybe move the fix to once a second? (intermittent, but almost every time) bug - capping the fps causes random slow downs, that can be fixed with pause @@ -24,6 +26,12 @@ mod: commodities exchange - canceling a power up gives 6 rerolls, ammo, or heals ************** TODO ************** +bullet mechanic - a bullet that swims through the air + rotate the velocity vector towards the normalized facing vector + use the cross product > 0 to determine which direction to rotate the velocity + +lower recoil on nail shot gun + in custom make a top bar that is fixed use media rules to make the layout look nice