diff --git a/js/engine.js b/js/engine.js index 444929e..ab467b4 100644 --- a/js/engine.js +++ b/js/engine.js @@ -152,8 +152,7 @@ function collisionChecks(event) { mech.energy -= 0.33 * mech.maxEnergy mech.immuneCycle = 0; //player doesn't go immune to collision damage mob[k].death(); - game.drawList.push({ - //add dmg to draw queue + game.drawList.push({ //add dmg to draw queue x: pairs[i].activeContacts[0].vertex.x, y: pairs[i].activeContacts[0].vertex.y, radius: dmg * 2000, @@ -161,8 +160,7 @@ function collisionChecks(event) { time: game.drawTime }); } else { - game.drawList.push({ - //add dmg to draw queue + game.drawList.push({ //add dmg to draw queue x: pairs[i].activeContacts[0].vertex.x, y: pairs[i].activeContacts[0].vertex.y, radius: dmg * 500, diff --git a/js/level.js b/js/level.js index c4b3116..3a2f756 100644 --- a/js/level.js +++ b/js/level.js @@ -20,7 +20,7 @@ const level = { // for (let i = 0; i < 10; i++) { // mod.giveMod("laser-bot"); // } - // mod.giveMod("bot fabrication") + mod.giveMod("cosmic string") level.intro(); //starting level @@ -1416,7 +1416,7 @@ const level = { } // starting room - spawn.mapRect(-300, -1000, 600, 50); + spawn.mapRect(-300, -1000, 600, 100); spawn.mapRect(-300, -1300, 450, 50); spawn.mapRect(-300, -1300, 50, 350); if (!backwards && game.difficulty > 1) spawn.bodyRect(100, -1250, 200, 240); //remove on backwards @@ -1424,8 +1424,8 @@ const level = { spawn.mapRect(-100, -975, 100, 975); spawn.mapRect(-500, 100, 1950, 400); spawn.boost(-425, 100, 1400); - spawn.mapRect(600, -1000, 750, 50); - spawn.mapRect(900, -500, 550, 50); + spawn.mapRect(600, -1000, 750, 100); + spawn.mapRect(900, -500, 550, 100); spawn.mapRect(1250, -975, 100, 375); spawn.bodyRect(1250, -600, 100, 100, 0.7); spawn.mapRect(1250, -450, 100, 450); diff --git a/js/mods.js b/js/mods.js index 58edd67..16c3875 100644 --- a/js/mods.js +++ b/js/mods.js @@ -1208,7 +1208,7 @@ const mod = { }, { name: "Bayesian statistics", - description: "20% chance to duplicate spawned power ups
after a collision, eject one of your mods", + description: "18% chance to duplicate spawned power ups
after a collision, eject one of your mods", maxCount: 1, count: 0, allowed() { @@ -1217,13 +1217,13 @@ const mod = { requires: "", effect: () => { mod.isBayesian = true - mod.duplicateChance += 0.2 + mod.duplicateChance += 0.18 game.draw.powerUp = game.draw.powerUpBonus //change power up draw }, remove() { if (mod.isBayesian) { - mod.duplicateChance -= 0.2 + mod.duplicateChance -= 0.18 if (mod.duplicateChance < 0) mod.duplicateChance = 0 } mod.isBayesian = false @@ -1232,7 +1232,7 @@ const mod = { }, { name: "stimulated emission", - description: "8% chance to duplicate spawned power ups", + description: "7% chance to duplicate spawned power ups", maxCount: 9, count: 0, allowed() { @@ -1240,7 +1240,7 @@ const mod = { }, requires: "", effect() { - mod.duplicateChance += 0.08 + mod.duplicateChance += 0.07 game.draw.powerUp = game.draw.powerUpBonus //change power up draw // this.description = `8% chance to duplicate spawned power ups
chance to duplicate = ${mod.duplicateChance}` }, @@ -2676,7 +2676,7 @@ const mod = { }, { name: "pair production", - description: "power ups overload your energy
by 250% of your maximum energy", + description: "power ups overload your energy
to 250% of your maximum energy", maxCount: 1, count: 0, allowed() { @@ -2685,7 +2685,7 @@ const mod = { requires: "nano-scale manufacturing", effect: () => { mod.isMassEnergy = true // used in mech.grabPowerUp - mech.energy = mech.maxEnergy * 2.5 + if (mech.energy < mech.maxEnergy * 2.5) mech.energy = mech.maxEnergy * 2.5 }, remove() { mod.isMassEnergy = false; @@ -2805,6 +2805,38 @@ const mod = { mod.isPilotFreeze = false } }, + { + name: "cosmic string", + description: "when you tunnel through a wormhole
damage mobs between the endpoints", + maxCount: 1, + count: 0, + allowed() { + return mech.fieldUpgrades[mech.fieldMode].name === "wormhole" + }, + requires: "wormhole", + effect() { + mod.isWormholeDamage = true + }, + remove() { + mod.isWormholeDamage = false + } + }, + { + name: "Penrose process", + description: "after a block falls into a wormhole
overfill your energy to 300% of your maximum
", + maxCount: 1, + count: 0, + allowed() { + return mech.fieldUpgrades[mech.fieldMode].name === "wormhole" + }, + requires: "wormhole", + effect() { + mod.isWormholeEnergy = true + }, + remove() { + mod.isWormholeEnergy = false + } + }, { name: "heals", description: "spawn 6 heal power ups", @@ -3040,5 +3072,7 @@ const mod = { beamSplitter: null, iceEnergy: null, isPerfectBrake: null, - explosiveRadius: null + explosiveRadius: null, + isWormholeEnergy: null, + isWormholeDamage: null } \ No newline at end of file diff --git a/js/player.js b/js/player.js index 38f9ec4..488f210 100644 --- a/js/player.js +++ b/js/player.js @@ -1713,7 +1713,7 @@ const mech = { }, { name: "time dilation field", - description: "use energy to stop time
move and fire while time is stopped
touching mobs still does harm", + description: "use energy to stop time
move and fire while time is stopped", effect: () => { // mech.fieldMeterColor = "#000" mech.fieldFire = true; @@ -2240,7 +2240,7 @@ const mech = { }, { name: "wormhole", - description: "use energy to tunnel through a wormhole
bullets may also traverse the wormholes
blocks and power ups can't exit it", + description: "use energy to tunnel through a wormhole
bullets may also traverse wormholes
blocks and power ups can't exit", effect: () => { game.replaceTextLog = true; //allow text over write mech.drop(); @@ -2270,7 +2270,7 @@ const mech = { const edge1b = Vector.add(Vector.mult(unit, -semiMajorAxis), mech.hole.pos1) const edge2a = Vector.add(Vector.mult(unit, semiMajorAxis), mech.hole.pos2) const edge2b = Vector.add(Vector.mult(unit, -semiMajorAxis), mech.hole.pos2) - const opacity = 200 / mech.fieldRange / mech.fieldRange + // const opacity = 200 / mech.fieldRange / mech.fieldRange ctx.beginPath(); ctx.moveTo(edge1a.x, edge1a.y) ctx.bezierCurveTo(mech.hole.pos1.x, mech.hole.pos1.y, mech.hole.pos2.x, mech.hole.pos2.y, edge2a.x, edge2a.y); @@ -2353,6 +2353,7 @@ const mech = { Matter.World.remove(engine.world, body[i]); body.splice(i, 1); mech.fieldRange *= 0.8 + if (mod.isWormholeEnergy && mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3 break } } @@ -2368,26 +2369,25 @@ const mech = { Matter.World.remove(engine.world, body[i]); body.splice(i, 1); mech.fieldRange *= 0.8 + if (mod.isWormholeEnergy && mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3 break } } } } } - //mobs get sucked in + //mobs get pushed away for (let i = 0, len = mob.length; i < len; i++) { - if (!mob[i].shield && !mob[i].isShielded) { - if (Vector.magnitude(Vector.sub(mech.hole.pos1, mob[i].position)) < suckRange) { - const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos1, mob[i].position)), 0.05) - const slow = Vector.mult(mob[i].velocity, 0.99) - Matter.Body.setVelocity(mob[i], Vector.add(slow, pull)); - } - if (Vector.magnitude(Vector.sub(mech.hole.pos2, mob[i].position)) < suckRange) { - const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos2, mob[i].position)), 0.05) - const slow = Vector.mult(mob[i].velocity, 0.99) - Matter.Body.setVelocity(mob[i], Vector.add(slow, pull)); - } + // if (!mob[i].shield && !mob[i].isShielded) { + if (Vector.magnitude(Vector.sub(mech.hole.pos1, mob[i].position)) < 200) { + const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos1, mob[i].position)), -0.07) + Matter.Body.setVelocity(mob[i], Vector.add(mob[i].velocity, pull)); } + if (Vector.magnitude(Vector.sub(mech.hole.pos2, mob[i].position)) < 200) { + const pull = Vector.mult(Vector.normalise(Vector.sub(mech.hole.pos2, mob[i].position)), -0.07) + Matter.Body.setVelocity(mob[i], Vector.add(mob[i].velocity, pull)); + } + // } } } @@ -2399,11 +2399,15 @@ const mech = { // Matter.Query.ray(map, jumpSensor.position, game.mouseInGame).length === 0 || if ( mech.hole.isReady && !mech.holdingTarget && - (Matter.Query.ray(map, player.position, game.mouseInGame).length === 0 && Matter.Query.ray(map, mech.pos, game.mouseInGame).length === 0) + ( + // Matter.Query.ray(map, player.position, game.mouseInGame).length === 0 && + Matter.Query.ray(map, mech.pos, game.mouseInGame).length === 0 && + Matter.Query.ray(map, mech.pos, Vector.add(Vector.mult(Vector.normalise(Vector.sub(game.mouseInGame, mech.pos)), 50), game.mouseInGame)).length === 0 + ) ) { const sub = Vector.sub(game.mouseInGame, mech.pos) const mag = Vector.magnitude(sub) - const drain = 0.005 * Math.sqrt(mag) + const drain = 0.06 + 0.007 * Math.sqrt(mag) if (mech.energy > drain && mag > 150) { mech.energy -= drain mech.hole.isReady = false; @@ -2435,6 +2439,24 @@ const mech = { mech.hole.pos1.y = mech.pos.y mech.hole.pos2.x = player.position.x mech.hole.pos2.y = player.position.y + + if (mod.isWormholeDamage) { + who = Matter.Query.ray(mob, mech.pos, game.mouseInGame, 60) + for (let i = 0; i < who.length; i++) { + if (who[i].body.alive) { + const dmg = b.dmgScale * 6 + who[i].body.damage(dmg); + who[i].body.locatePlayer(); + game.drawList.push({ //add dmg to draw queue + x: who[i].body.position.x, + y: who[i].body.position.y, + radius: Math.log(2 * dmg + 1.1) * 40, + color: game.playerDmgColor, + time: game.drawTime + }); + } + } + } } } // mech.grabPowerUp(); diff --git a/js/powerup.js b/js/powerup.js index c0afd8f..6ec6823 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -412,7 +412,7 @@ const powerUps = { } }, onPickUp(where) { - if (mod.isMassEnergy) mech.energy = mech.maxEnergy * 2.5; + if (mod.isMassEnergy && mech.energy < mech.maxEnergy * 2.5) mech.energy = mech.maxEnergy * 2.5; if (mod.isMineDrop) b.mine({ x: where.x, y: where.y @@ -549,7 +549,7 @@ const powerUps = { } if (have.length) { const choose = have[Math.floor(Math.random() * have.length)] - game.makeTextLog(`
  ${mod.mods[choose].name} ejected by Bayesian statistics`, 600) //message about what mod was lost + game.makeTextLog(`
  ${mod.mods[choose].name} was ejected`, 600) //message about what mod was lost for (let i = 0; i < mod.mods[choose].count; i++) { powerUps.directSpawn(mech.pos.x, mech.pos.y, "mod"); powerUp[powerUp.length - 1].isBonus = true diff --git a/style.css b/style.css index 86bf1b2..83823b4 100644 --- a/style.css +++ b/style.css @@ -490,16 +490,16 @@ em { .color-plasma { color: #c0e; letter-spacing: 1px; - background-color: rgba(132, 0, 255, 0.04); + background-color: rgba(132, 0, 255, 0.06); padding: 2px; - border-radius: 4px; + border-radius: 9px; letter-spacing: 1px; } .color-worm { color: #fff; - text-shadow: 0px 0px 3px #357; - letter-spacing: 1px; + text-shadow: 1px 0px 2px #234; + /* letter-spacing: 2px; */ } .color-harm { diff --git a/todo.txt b/todo.txt index 665eecc..639d857 100644 --- a/todo.txt +++ b/todo.txt @@ -1,18 +1,12 @@ +some wormhole bug fixes +wormhole mod: cosmic string - damage mobs when you teleport through them +wormhole mod: Penrose process - overfill energy to 300% of max, with a block gets sucked into a hole -mods ejected from Bayesian statistics can't duplicate - -the power up boss moves faster, has less health, - it will eject one of your mods after a collision - and two health power ups - -mod ammonium nitrate: increase explosion damage and area by 25% - also other explosion mods have been rebalanced (damage buffed, but self damage is also higher) - -field: wormhole - teleport around, bullets teleport too, blocks and power ups get sucked in - mobs don't do much in worm hole yet, but that is coming with future mods ************** TODO - n-gon ************** +set mouse 4 and 5 for gun switch + add an ending to the game revamp the boss level, or add a new final level final level requires you to kill something, not skip content @@ -20,8 +14,6 @@ add an ending to the game game never ends if you have used cheats field wormhole - mobs are protected from bullets when stuck in a hole - mobs should destabilize holes, or take damage store constant info about the holes: unit, angle to save processing maybe bullets should be able to enter and exit multiple times or bullets shouldn't get stuck at all? @@ -29,9 +21,7 @@ field wormhole player: drain energy when near a hole, does damage if no energy mod: Hawking radiation: do damage, to mobs that get near the end points this is good because it explains why mobs don't teleport - mod: cosmic string: do damage, like a laser for any mob that passes between the two portals, near the bezier curves mod: extend immunity cycle after a teleport //mech.immuneCycle = mech.cycle + 15; - mod: reduce energy cost of teleportation look for mods that could update description text with count and mod.is information can only use variables that change in effect() and remove()