diff --git a/js/bullet.js b/js/bullet.js index ae44614..26e62b0 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -1545,14 +1545,16 @@ const b = { //find closest if (!(game.cycle % this.lookFrequency)) { this.lockedOn = null; - let closeDist = mod.isPlasmaRange * 1000; - for (let i = 0, len = mob.length; i < len; ++i) { - const DIST = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius; - if (DIST < closeDist && - Matter.Query.ray(map, this.position, mob[i].position).length === 0 && - Matter.Query.ray(body, this.position, mob[i].position).length === 0) { - closeDist = DIST; - this.lockedOn = mob[i] + if (!mech.isCloak) { + let closeDist = mod.isPlasmaRange * 1000; + for (let i = 0, len = mob.length; i < len; ++i) { + const DIST = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius; + if (DIST < closeDist && + Matter.Query.ray(map, this.position, mob[i].position).length === 0 && + Matter.Query.ray(body, this.position, mob[i].position).length === 0) { + closeDist = DIST; + this.lockedOn = mob[i] + } } } } @@ -3154,6 +3156,9 @@ const b = { have: false, nextFireCycle: 0, //use to remember how longs its been since last fire, used to reset count fire() { + + }, + fireLaser() { if (mech.energy < mod.laserFieldDrain) { mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy } else { @@ -3220,16 +3225,8 @@ const b = { b.laser() } } - } - }, - - { - name: "pulse", - description: "convert 25% of your energy into a pulsed laser
instantly initiates a fusion explosion", - ammo: 0, - ammoPack: Infinity, - have: false, - fire() { + }, + firePulse() { //calculate laser collision let best, energy, explosionRange; let range = 3000 @@ -3282,7 +3279,6 @@ const b = { } } }; - //check for collisions best = { x: null, @@ -3295,7 +3291,7 @@ const b = { if (mod.isPulseAim) { //find mobs in line of sight let dist = 2200 energy = 0.23 * Math.min(mech.energy, 1.5) - explosionRange = 1400 * energy + explosionRange = 1680 * energy for (let i = 0, len = mob.length; i < len; i++) { const newDist = Vector.magnitude(Vector.sub(path[0], mob[i].position)) if (explosionRange < newDist && @@ -3319,7 +3315,6 @@ const b = { }; } } - if (mod.isPulseAim) { mech.energy -= energy * mod.isLaserDiode if (best.who) b.explosion(path[1], explosionRange, true) @@ -3327,7 +3322,7 @@ const b = { } else { energy = 0.27 * Math.min(mech.energy, 1.5) mech.energy -= energy * mod.isLaserDiode - explosionRange = 1300 * energy + explosionRange = 1560 * energy if (best.who) b.explosion(path[1], explosionRange, true) mech.fireCDcycle = mech.cycle + Math.floor(50 * b.fireCD); // cool down } @@ -3340,7 +3335,6 @@ const b = { } } } - //draw laser beam ctx.beginPath(); ctx.moveTo(path[0].x, path[0].y); @@ -3368,136 +3362,18 @@ const b = { time: Math.floor(2 + 33 * Math.random() * Math.random()) }); } - } + }, }, + // { - // name: "maser", - // description: "emit a beam of collimated coherent light
drains energy instead of ammunition", + // name: "pulse", + // description: "convert 25% of your energy into a pulsed laser
instantly initiates a fusion explosion", // ammo: 0, // ammoPack: Infinity, // have: false, // fire() { - // if (mech.energy < 0.002) { - // mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy - // } else { - // // mech.energy -= mech.fieldRegen + 0.002 * mod.isLaserDiode - // let range = 2000 - // const looking = Vector.mult(Vector.rotate({ - // x: 1, - // y: 0 - // }, mech.angle), range) - // const endpoint = Matter.Vector.add(mech.pos, looking) - // const hits = Matter.Query.ray(body, mech.pos, endpoint, 100) - // for (let i = 0; i < hits.length; i++) { - - - // } - // // console.log(hits, target, range) - - - // //draw beam - // ctx.beginPath(); - // ctx.moveTo(mech.pos.x, mech.pos.y); - // ctx.lineTo(endpoint.x, endpoint.y); - // ctx.stroke(); - // } // } // }, - // { - // name: "dwarf star", //14 - // description: "drop a mine that gravitational pulls in matter", - // ammo: 0, - // ammoPack: 1000, - // have: false, - // isStarterGun: false, - // fire() { - // const me = bullet.length; - // const dir = mech.angle - // const TOTAL_CYCLES = 1020 - // bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(dir), mech.pos.y + 30 * Math.sin(dir), 3 , { - // density: 0.05, - // //frictionAir: 0.01, - // restitution: 0, - // angle: 0, - // friction: 1, - // // frictionAir: 1, - // endCycle: game.cycle + TOTAL_CYCLES, - // dmg: 0, //damage done in addition to the damage from momentum - // classType: "bullet", - // collisionFilter: { - // category: 0x000100, - // mask: 0x010011 //mask: 0x000101, //for self collision - // }, - // minDmgSpeed: 5, - // range: 0, - // beforeDmg() { - // this.endCycle = 0; - // }, //this.endCycle = 0 //triggers despawn - // onEnd() {}, - // do() { - // this.force.y += this.mass * 0.005; - // this.range += 0.5 - - // //damage nearby mobs - // const dmg = b.dmgScale * 0.02 - // for (let i = 0, len = mob.length; i < len; ++i) { - // if (mob[i].alive) { - // sub = Vector.sub(this.position, mob[i].position); - // dist = Vector.magnitude(sub) - mob[i].radius; - // if (dist < this.range) { - // mob[i].damage(dmg); - // mob[i].locatePlayer(); - // } - // } - // } - - // //pull in body, and power ups?, and bullets? - // for (let i = 0, len = body.length; i < len; ++i) { - // sub = Vector.sub(this.position, body[i].position); - // dist = Vector.magnitude(sub) - // if (dist < this.range) { - // this.range += body[i].mass * 2 - // Matter.World.remove(engine.world, body[i]); - // body.splice(i, 1); - // break; - // } - // } - - // //draw - // const opacity = (this.endCycle - game.cycle) / TOTAL_CYCLES - // ctx.fillStyle = `rgba(170,220,255,${opacity})`; - // ctx.beginPath(); - // ctx.arc(this.position.x, this.position.y, this.range, 0, 2 * Math.PI); - // ctx.fill(); - // } - // }); - // b.fireProps(60, 0, dir, me); //cd , speed - // } - // }, - // { - // name: "kinetic slugs", //1 - // description: "fire a large rod that does excessive physical damage
high recoil", - // ammo: 0, - // ammoPack: 5, - // have: false, - // - // fire() { - // b.muzzleFlash(45); - // // mobs.alert(800); - // const me = bullet.length; - // const dir = mech.angle; - // bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), 70 , 30 , b.fireAttributes(dir)); - // b.fireProps(mech.crouch ? 55 : 40, 50, dir, me); //cd , speed - // bullet[me].endCycle = game.cycle + Math.floor(180 * mod.isBulletsLastLonger); - // bullet[me].do = function () { - // this.force.y += this.mass * 0.0005; - // }; - - // //knock back - // const KNOCK = ((mech.crouch) ? 0.025 : 0.25) - // player.force.x -= KNOCK * Math.cos(dir) - // player.force.y -= KNOCK * Math.sin(dir) * 0.3 //reduce knock back in vertical direction to stop super jumps - // }, ] }; \ No newline at end of file diff --git a/js/index.js b/js/index.js index a80d1c6..3ca4d72 100644 --- a/js/index.js +++ b/js/index.js @@ -407,6 +407,7 @@ const build = { const levelsCleared = Math.abs(Number(document.getElementById("starting-level").value)) level.difficultyIncrease(Math.min(99, levelsCleared * game.difficultyMode)) //increase difficulty based on modes level.levelsCleared += levelsCleared; + game.isCheating = true; document.body.style.cursor = "none"; document.body.style.overflow = "hidden" document.getElementById("build-grid").style.display = "none" @@ -416,7 +417,6 @@ const build = { } function openCustomBuildMenu() { - game.isCheating = true; document.getElementById("build-button").style.display = "none"; const el = document.getElementById("build-grid") el.style.display = "grid" diff --git a/js/level.js b/js/level.js index 79d6609..4af04de 100644 --- a/js/level.js +++ b/js/level.js @@ -704,21 +704,15 @@ const level = { }); xLetter += 10 + width } - - level.setPosToSpawn(460, -100); //normal spawn level.enter.x = -1000000; //hide enter graphic for first level by moving to the far left level.exit.x = 2800; level.exit.y = -335; spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump - game.zoomScale = 1000 //1400 is normal level.defaultZoom = 1600 game.zoomTransition(level.defaultZoom, 1) - - document.body.style.backgroundColor = "#ddd"; - level.fill.push({ x: 2600, y: -600, @@ -733,7 +727,6 @@ const level = { height: 500, color: "#fff" }); - const lineColor = "#ccc" level.fillBG.push({ x: 1600, @@ -742,7 +735,6 @@ const level = { height: 100, color: lineColor }); - level.fillBG.push({ x: -55, y: -283, diff --git a/js/mob.js b/js/mob.js index 22b0244..ecf49d5 100644 --- a/js/mob.js +++ b/js/mob.js @@ -1045,7 +1045,7 @@ const mobs = { } if (Math.random() < mod.isBotSpawner) { b.randomBot(this.position, false) - bullet[bullet.length - 1].endCycle = game.cycle + 1500 + Math.floor(600 * Math.random()) + bullet[bullet.length - 1].endCycle = game.cycle + 1000 + Math.floor(400 * Math.random()) } if (mod.isExplodeMob) b.explosion(this.position, Math.min(550, Math.sqrt(this.mass + 2.5) * 50)) if (mod.nailsDeathMob) b.targetedNail(this.position, mod.nailsDeathMob, 40 + 7 * Math.random()) diff --git a/js/mods.js b/js/mods.js index faabb73..b49d3e5 100644 --- a/js/mods.js +++ b/js/mods.js @@ -137,7 +137,7 @@ const mod = { maxCount: 1, count: 0, allowed() { - return (mod.haveGunCheck("nail gun") && mod.isIceCrystals) || mod.haveGunCheck("laser") || mod.haveGunCheck("pulse") || mech.fieldUpgrades[mech.fieldMode].name === "plasma torch" || mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave" + return (mod.haveGunCheck("nail gun") && mod.isIceCrystals) || mod.haveGunCheck("laser") || mech.fieldUpgrades[mech.fieldMode].name === "plasma torch" || mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave" }, requires: "energy based damage", effect() { @@ -408,7 +408,7 @@ const mod = { maxCount: 9, count: 0, allowed() { - return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.haveGunCheck("pulse") || mod.isMissileField || mod.boomBotCount > 1 || mod.isFlechetteExplode + return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.isPulseLaser || mod.isMissileField || mod.boomBotCount > 1 || mod.isFlechetteExplode }, requires: "an explosive damage source", effect: () => { @@ -424,7 +424,7 @@ const mod = { maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.haveGunCheck("pulse") || mod.isMissileField || mod.boomBotCount > 1 || mod.isFlechetteExplode + return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.isPulseLaser || mod.isMissileField || mod.boomBotCount > 1 || mod.isFlechetteExplode }, requires: "an explosive damage source", effect: () => { @@ -440,7 +440,7 @@ const mod = { maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.haveGunCheck("pulse") || mod.isMissileField || mod.isFlechetteExplode + return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.isPulseLaser || mod.isMissileField || mod.isFlechetteExplode }, requires: "an explosive damage source", effect: () => { @@ -457,7 +457,7 @@ const mod = { maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.isMissileField || mod.isExplodeMob || mod.isFlechetteExplode + return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.isMissileField || mod.isExplodeMob || mod.isFlechetteExplode || mod.isPulseLaser }, requires: "an explosive damage source", effect: () => { @@ -469,7 +469,7 @@ const mod = { }, { name: "scrap bots", - description: "19% chance to build a bot after killing a mob
the bot last for about 30 seconds", + description: "20% chance to build a bot after killing a mob
the bot last for about 20 seconds", maxCount: 3, count: 0, allowed() { @@ -477,7 +477,7 @@ const mod = { }, requires: "a bot", effect() { - mod.isBotSpawner += 0.19; + mod.isBotSpawner += 0.20; }, remove() { mod.isBotSpawner = 0; @@ -2047,22 +2047,6 @@ const mod = { } } }, - // { - // name: "electromagnetic pulse", - // description: "vacuum bomb's explosion removes
80% of shields and 100% of energy", - // maxCount: 1, - // count: 0, - // allowed() { - // return mod.haveGunCheck("vacuum bomb") - // }, - // requires: "vacuum bomb", - // effect() { - // mod.isVacuumShield = true; - // }, - // remove() { - // mod.isVacuumShield = false; - // } - // }, { name: "water shielding", description: "increase neutron bomb's range by 20%
player is immune to its harmful effects", @@ -2404,11 +2388,11 @@ const mod = { }, { name: "laser diodes", - description: "lasers drain 37% less energy
effects laser gun, pulse gun, and laser-bot", + description: "lasers drain 37% less energy
effects laser-gun and laser-bot", maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("pulse") || mod.haveGunCheck("laser") || mod.laserBotCount > 1 + return mod.haveGunCheck("laser") || mod.laserBotCount > 1 }, requires: "laser", effect() { @@ -2424,7 +2408,7 @@ const mod = { maxCount: 9, count: 0, allowed() { - return mod.haveGunCheck("laser") && !mod.isWideLaser + return mod.haveGunCheck("laser") && !mod.isWideLaser && !mod.isPulseLaser }, requires: "laser, not wide beam", effect() { @@ -2444,7 +2428,7 @@ const mod = { maxCount: 9, count: 0, allowed() { - return mod.haveGunCheck("laser") && !mod.isWideLaser + return mod.haveGunCheck("laser") && !mod.isWideLaser && !mod.isPulseLaser }, requires: "laser, not specular reflection", effect() { @@ -2456,13 +2440,13 @@ const mod = { }, { name: "diffuse beam", - description: "laser beam is wider and doesn't reflect
increase laser damage by 100%", + description: "laser beam is wider and doesn't reflect
increase full beam damage by 175%", maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("laser") && mod.laserReflections < 3 && !mod.beamSplitter + return mod.haveGunCheck("laser") && mod.laserReflections < 3 && !mod.beamSplitter && !mod.isPulseLaser }, - requires: "laser, not specular reflection", + requires: "laser, not specular reflection
not beam splitter", effect() { if (mod.wideLaser === 0) mod.wideLaser = 3 mod.isWideLaser = true; @@ -2474,13 +2458,13 @@ const mod = { }, { name: "output coupler", - description: "diffuse laser beam is 30% wider
and the full beam does 30% more damage", + description: "widen diffuse laser beam by 40%
increase full beam damage by 40%", maxCount: 1, count: 0, allowed() { return mod.haveGunCheck("laser") && mod.isWideLaser }, - requires: "laser, not specular reflection", + requires: "laser, not specular reflection
not beam splitter", effect() { mod.wideLaser = 4 }, @@ -2492,29 +2476,35 @@ const mod = { } } }, - // { - // name: "waste heat recovery", - // description: "laser damage grows by 400% as you fire
but you periodically eject your health", - // maxCount: 1, - // count: 0, - // allowed() { - // return mod.haveGunCheck("laser") && !mod.isEnergyHealth - // }, - // requires: "laser
not mass-energy equivalence", - // effect() { - // mod.isLaserHealth = true; - // }, - // remove() { - // mod.isLaserHealth = false - // } - // }, + { + name: "pulse", + description: "convert 25% of your energy into a pulsed laser
instantly initiates a fusion explosion", + maxCount: 1, + count: 0, + allowed() { + return mod.haveGunCheck("laser") && mod.laserReflections < 3 && !mod.beamSplitter && !mod.isWideLaser + }, + requires: "laser, not specular reflection
not beam splitter, not diffuse", + effect() { + mod.isPulseLaser = true; + for (i = 0, len = b.guns.length; i < len; i++) { //find which gun + if (b.guns[i].name === "laser") b.guns[i].fire = b.guns[i].firePulse + } + }, + remove() { + mod.isPulseLaser = false; + for (i = 0, len = b.guns.length; i < len; i++) { //find which gun + if (b.guns[i].name === "laser") b.guns[i].fire = b.guns[i].fireLaser + } + } + }, { name: "shock wave", description: "mobs caught in pulse's explosion are stunned
for up to 2 seconds", maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("pulse") + return mod.isPulseLaser }, requires: "pulse", effect() { @@ -2524,14 +2514,13 @@ const mod = { mod.isPulseStun = false; } }, - { name: "neocognitron", description: "pulse automatically aims at a nearby mob
50% decreased delay after firing", maxCount: 1, count: 0, allowed() { - return mod.haveGunCheck("pulse") + return mod.isPulseLaser }, requires: "pulse", effect() { @@ -2725,7 +2714,7 @@ const mod = { }, requires: "standing wave harmonics", effect() { - mod.blockDmg += 0.66 //if you change this value also update the for loop in the electricity graphics in mech.pushMass + mod.blockDmg += 0.7 //if you change this value also update the for loop in the electricity graphics in mech.pushMass }, remove() { mod.blockDmg = 0; @@ -3188,5 +3177,6 @@ const mod = { isWormSpores: null, isWormBullets: null, isWideLaser: null, - wideLaser: null + wideLaser: null, + isPulseLaser: null } \ No newline at end of file diff --git a/js/player.js b/js/player.js index 65288d6..f295858 100644 --- a/js/player.js +++ b/js/player.js @@ -1273,9 +1273,9 @@ const mech = { }, { name: "standing wave harmonics", - description: "three oscillating shields are permanently active
blocking has no cool down
reduce harm by 20%", + description: "3 oscillating shields are permanently active
blocking drains energy
blocking has no cool down", effect: () => { - mech.fieldHarmReduction = 0.80; + // mech.fieldHarmReduction = 0.80; mech.fieldBlockCD = 0; mech.hold = function () { if (mech.isHolding) { @@ -1390,7 +1390,7 @@ const mech = { }, { name: "nano-scale manufacturing", - description: "excess energy used to build drones
increase energy regeneration by 100%", + description: "use energy to block mobs
excess energy used to build drones
increase energy regeneration by 100%", effect: () => { mech.hold = function () { if (mech.energy > mech.maxEnergy - 0.02 && mech.fieldCDcycle < mech.cycle) { @@ -1420,7 +1420,6 @@ const mech = { mech.energy -= 0.33; b.drone(1) } - } if (mech.isHolding) { mech.drawHold(mech.holdingTarget); @@ -1445,13 +1444,13 @@ const mech = { }, { name: "negative mass field", - description: "use energy to nullify  gravity
reduce harm by 45%
blocks held by the field have a lower mass", + description: "use energy to nullify  gravity
reduce harm by 40%
blocks held by the field have a lower mass", fieldDrawRadius: 0, effect: () => { mech.fieldFire = true; mech.holdingMassScale = 0.03; //can hold heavier blocks with lower cost to jumping mech.fieldMeterColor = "#000" - mech.fieldHarmReduction = 0.55; + mech.fieldHarmReduction = 0.6; mech.fieldDrawRadius = 0; mech.hold = function () { diff --git a/js/spawn.js b/js/spawn.js index ce3804c..4aa5e20 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -234,7 +234,7 @@ const spawn = { me.frictionAir = 0.01 me.seeAtDistance2 = 9000000; me.accelMag = 0.00062 * game.accelScale; - Matter.Body.setDensity(me, 0.001); //normal is 0.001 + Matter.Body.setDensity(me, 0.0006); //normal is 0.001 me.collisionFilter.mask = cat.bullet | cat.player me.memory = Infinity; me.seePlayerFreq = 60 diff --git a/todo.txt b/todo.txt index 276ad60..636ebb6 100644 --- a/todo.txt +++ b/todo.txt @@ -1,15 +1,33 @@ -gun: vacuum bomb is removed -mod: vacuum bomb - grenades fire slower, explode bigger and, suck everything towards them - -laser and diffuse laser graphics are better -mod: output coupler - diffuse laser beam is 30% wider and does 30% more damage - requires diffuse beam - -level number doesn't increase if you skip the boss (in the late game) +gun: pulse is now a mod for laser ************** TODO - n-gon ************** +optional setting for people with desktops that want double mobs + +hard mode should match the pace of why, but with less difficulty + 2x power up chances, same as why for all difficulties + adjust difficulty levels + easy: 1 + normal: 2 + hard: 3 + why: 4 + +combine more stuff? + ____ mod for ____ + flak -> missiles + neutron bomb -> mines + iceIX -> foam + flechettes -> nail gun + + +let beam splitter work with pulse + +neutron bomb as a mod for mines + +mod: stealth field - mark a mob, it you next kill is that mob get a bonus power up + run only at the start of a new level + add an ending to the game revamp the boss level, or add a new final level final level requires you to kill something @@ -29,7 +47,7 @@ time dilation mod rework / buff (time dilation is cool, but it can feel like a c take no damage can fire 2x move jump fire while field is active - 33% move jump fire always + 40% move jump fire always mod - after a mob or shield dies, remaining dots look for a new nearby host or mod: radiation effects can spread to nearby mobs