diff --git a/js/bullets.js b/js/bullets.js index 70a1052..a44e720 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -694,6 +694,8 @@ const b = { }, remove() { mech.maxHealth = 1; + b.modOnHealthChange(); + mech.displayHealth(); } }, { diff --git a/js/index.js b/js/index.js index 39e8253..b3cce54 100644 --- a/js/index.js +++ b/js/index.js @@ -29,29 +29,6 @@ function getUrlVars() { }); return vars; } -// ? -// &gun0 = minigun & gun1 = shotgun & gun2 = super % 20 balls & gun3 = flechettes & gun4 = wave % 20 beam & gun5 = missiles & gun6 = flak & gun7 = grenades & gun8 = vacuum % 20 bomb & -// gun9 = mine & gun10 = spores & gun11 = drones & gun12 = ice % 20 IX & gun13 = foam & gun14 = rail % 20 gun & gun15 = laser & gun16 = pulse -// & -// mod0 = depleted % 20 uranium % 20 rounds & mod1 = kinetic % 20 bombardment & mod2 = fracture % 20 analysis & mod3 = fluoroantimonic % 20 acid & -// mod4 = negative % 20 feedback & mod5 = radiative % 20 equilibrium & mod6 = high % 20 explosives & mod7 = high % 20 explosives & -// mod8 = high % 20 explosives & mod9 = electric % 20 reactive % 20 armor & mod10 = thermal % 20 runaway & mod11 = auto - loading % 20 heuristics & -// mod12 = desublimated % 20 ammunition & mod13 = mass % 20 driver & mod14 = laser - bot & mod15 = nail - bot & mod16 = ablative % 20 drones & -// mod17 = ablative % 20 mines & mod18 = Lorentzian % 20 topology & mod19 = Lorentzian % 20 topology & mod20 = Lorentzian % 20 topology & -// mod21 = zoospore % 20 vector & mod22 = reaction % 20 inhibitor & mod23 = waste % 20 energy % 20 recovery & mod24 = scrap % 20 recycling & -// mod25 = acute % 20 stress % 20 response & mod26 = squirrel - cage % 20 rotor & mod27 = basidio - stomp & mod28 = Pauli % 20 exclusion & -// mod29 = annihilation & mod30 = quantum % 20 immortality & mod31 = weak % 20 anthropic % 20 principle & mod32 = entanglement & mod33 = piezoelectricity & -// mod34 = ground % 20 state & mod35 = energy % 20 conservation & mod36 = entropy % 20 exchange & mod37 = overcharge & mod38 = supersaturation & -// mod39 = recursive % 20 healing & mod40 = mass - energy % 20 equivalence & mod41 = Bayesian % 20 inference & mod42 = % 2 B1 % 20 cardinality & -// mod43 = catabolism & mod44 = leveraged % 20 investment & mod45 = ice % 20 crystal % 20n ucleation & mod46 = shotgun % 20 spin - statistics & -// mod47 = super % 20 duper & mod48 = super % 20 duper & mod49 = flechettes % 20 cartridges & mod50 = irradiated % 20n eedles & mod51 = wave % 20 phase % 20 velocity & -// mod52 = pocket % 20 universe & mod53 = self - replication & mod54 = optimized % 20 shell % 20 packing & mod55 = electromagnetic % 20 pulse & -// mod56 = mine % 20 reclamation & mod57 = tinsellated % 20 flagella & mod58 = redundant % 20 systems & mod59 = heavy % 20 water & mod60 = foam % 20 stabilization & -// mod61 = fragmenting % 20 projectiles & mod62 = specular % 20 reflection & mod63 = specular % 20 reflection & mod64 = specular % 20 reflection & -// mod65 = quantum % 20 dissipation & field = phase % 20 decoherence % 20 field & difficulty = 2 - - - window.addEventListener('load', (event) => { const set = getUrlVars() if (Object.keys(set).length !== 0) { @@ -76,7 +53,21 @@ const build = { game.difficultyMode = Number(set[property]) document.getElementById("difficulty-select").value = Number(set[property]) } + if (property === "level") { + level.levelsCleared += Number(set[property]); + level.difficultyIncrease(Number(set[property]) * game.difficultyMode) //increase difficulty based on modes + spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns + level.onLevel++ + } } + + for (let i = 0; i < bullet.length; ++i) Matter.World.remove(engine.world, bullet[i]); + bullet = []; //remove any bullets that might have spawned from mods + if (b.inventory.length > 0) { + b.activeGun = b.inventory[0] //set first gun to active gun + game.makeGunHUD(); + } + b.modOnHealthChange(); } }, pauseGrid() { @@ -331,6 +322,7 @@ const build = { } url += `&field=${encodeURIComponent(mech.fieldUpgrades[mech.fieldMode].name.trim())}` url += `&difficulty=${game.difficultyMode}` + url += `&level=${Number(document.getElementById("starting-level").value)}` console.log(url) return url }, @@ -348,10 +340,9 @@ const build = { //remove any bullets that might have spawned from mods for (let i = 0; i < bullet.length; ++i) Matter.World.remove(engine.world, bullet[i]); bullet = []; - - const increase = Math.min(99, Number(document.getElementById("starting-level").value) * game.difficultyMode) - level.levelsCleared += increase; - level.difficultyIncrease(increase) //increase difficulty based on modes + const levelsCleared = Number(document.getElementById("starting-level").value) - 1 + level.difficultyIncrease(Math.min(99, levelsCleared * game.difficultyMode)) //increase difficulty based on modes + level.levelsCleared += levelsCleared; document.body.style.cursor = "none"; document.body.style.overflow = "hidden" diff --git a/js/level.js b/js/level.js index 95e46cc..85083a1 100644 --- a/js/level.js +++ b/js/level.js @@ -12,8 +12,8 @@ const level = { onLevel: 0, levelsCleared: 0, start() { + if (build.isURLBuild && level.levelsCleared === 0) build.onLoadPowerUps(); if (level.levelsCleared === 0) { - if (build.isURLBuild) build.onLoadPowerUps(); // level.difficultyIncrease(9) // b.giveGuns("vacuum bomb") // mech.setField("phase decoherence field") @@ -32,13 +32,13 @@ const level = { // level.warehouse(); // level.highrise(); // level.office(); - level.levelAnnounce(); } else { spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns // spawn.pickList = ["focuser", "focuser"] level[level.levels[level.onLevel]](); //picks the current map from the the levels array - level.levelAnnounce(); } + + level.levelAnnounce(); game.noCameraScroll(); game.setZoom(); level.addToWorld(); //add bodies to game engine @@ -98,7 +98,8 @@ const level = { //****************************************************************************************************************** testing() { - // level.difficultyIncrease(9) //level 7 on normal, level 4 on hard, level 1.2 on why? + level.difficultyIncrease(9); + spawn.setSpawnList(); spawn.setSpawnList(); level.defaultZoom = 1500 game.zoomTransition(level.defaultZoom) @@ -144,8 +145,11 @@ const level = { spawn.mapRect(6400, -200, 400, 300); //right wall spawn.mapRect(6700, -1800, 800, 2600); //right wall spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump + + // spawn.laserBoss(2900, -500) + // spawn.exploder(3200, -500) spawn.timeSkipBoss(2900, -500) - spawn.randomMob(3200, -500) + // spawn.randomMob(3200, -500) }, bosses() { diff --git a/js/spawn.js b/js/spawn.js index 455ae5e..7a92ac5 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -644,7 +644,6 @@ const spawn = { me.eventHorizon = 1300; //required for black hole me.seeAtDistance2 = (me.eventHorizon + 1000) * (me.eventHorizon + 1000); //vision limit is event horizon me.accelMag = 0.00013 * game.accelScale; - // me.collisionFilter.mask = cat.player | cat.bullet // me.frictionAir = 0.005; // me.memory = 1600; Matter.Body.setDensity(me, 0.018); //extra dense //normal is 0.001 //makes effective life much larger @@ -667,6 +666,8 @@ const spawn = { this.stroke = "#000" this.isShielded = false; this.dropPowerUp = true; + this.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob; //can't touch bullets + ctx.beginPath(); ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI); ctx.fillStyle = `rgba(255,255,255,${mech.energy*0.5})`; @@ -696,6 +697,7 @@ const spawn = { this.seePlayer.recall = false this.fill = "transparent" this.stroke = "transparent" + this.collisionFilter.mask = cat.player | cat.map | cat.body | cat.mob; //can't touch bullets ctx.beginPath(); ctx.arc(this.position.x, this.position.y, this.eventHorizon, 0, 2 * Math.PI); ctx.fillStyle = `rgba(0,0,0,${0.1*Math.random()})`; @@ -904,32 +906,16 @@ const spawn = { vertexCollision(where, look, map); vertexCollision(where, look, body); if (!mech.isStealth) vertexCollision(where, look, [player]); - //hitting mob - if (best.who) { - // if (best.who.mob) { - // best.who.damage(Infinity); - // //draw damage - // game.drawList.push({ //add dmg to draw queue - // x: best.x, - // y: best.y, - // radius: 50, - // color: game.playerDmgColor, - // time: game.drawTime - // }); - // } - // hitting player - if (best.who === player && mech.collisionImmuneCycle < mech.cycle) { - mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles - mech.damage(this.dmg); - //draw damage - game.drawList.push({ //add dmg to draw queue - x: best.x, - y: best.y, - radius: this.dmg * 1500, - color: "rgba(80,0,255,0.5)", - time: 20 - }); - } + if (best.who && best.who === player && mech.collisionImmuneCycle < mech.cycle) { + mech.collisionImmuneCycle = mech.cycle + b.modCollisionImmuneCycles; //player is immune to collision damage for 30 cycles + mech.damage(this.dmg); + game.drawList.push({ //add dmg to draw queue + x: best.x, + y: best.y, + radius: this.dmg * 1500, + color: "rgba(80,0,255,0.5)", + time: 20 + }); } //draw beam if (best.dist2 === Infinity) best = look; @@ -1077,30 +1063,35 @@ const spawn = { // me.isStatic = true; // me.memory = 360; // me.seePlayerFreq = Math.round((40 + 30 * Math.random()) * game.lookFreqScale); - // me.isBig = false; - // me.scaleMag = Math.max(5 - me.mass, 1.75); + // // me.isBig = false; + // // me.scaleMag = Math.max(5 - me.mass, 1.75); // me.onDeath = function () { - // if (this.isBig) { - // Matter.Body.scale(this, 1 / this.scaleMag, 1 / this.scaleMag); - // this.isBig = false; - // } + // // if (this.isBig) { + // // Matter.Body.scale(this, 1 / this.scaleMag, 1 / this.scaleMag); + // // this.isBig = false; + // // } + // }; + // me.onHit = function () { + // game.timeSkip(120) // }; // me.do = function () { // this.seePlayerCheck(); // this.blink(); // //strike by expanding - // if (this.isBig) { - // if (this.cd - this.delay + 15 < game.cycle) { - // Matter.Body.scale(this, 1 / this.scaleMag, 1 / this.scaleMag); - // this.isBig = false; - // } - // } else if (this.seePlayer.yes && this.cd < game.cycle) { + // // if (this.isBig) { + // // if (this.cd - this.delay + 15 < game.cycle) { + // // Matter.Body.scale(this, 1 / this.scaleMag, 1 / this.scaleMag); + // // this.isBig = false; + // // } + // // } else + // if (this.seePlayer.yes && this.cd < game.cycle) { // const dist = Vector.sub(this.seePlayer.position, this.position); // const distMag2 = Vector.magnitudeSquared(dist); // if (distMag2 < 80000) { // this.cd = game.cycle + this.delay; - // Matter.Body.scale(this, this.scaleMag, this.scaleMag); - // this.isBig = true; + + // // Matter.Body.scale(this, this.scaleMag, this.scaleMag); + // // this.isBig = true; // } // } // }; @@ -1169,7 +1160,7 @@ const spawn = { x: x, y: y }; - me.fireFreq = 0.025; + me.fireFreq = 0.02; me.noseLength = 0; me.fireAngle = 0; me.accelMag = 0.005 * game.accelScale; @@ -1179,7 +1170,7 @@ const spawn = { x: 0, y: 0 }; - Matter.Body.setDensity(me, 0.023 + 0.001 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.setDensity(me, 0.02 + 0.0008 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger me.onDeath = function () { powerUps.spawnBossPowerUp(this.position.x, this.position.y) }; diff --git a/todo.txt b/todo.txt index e48cba6..cc89132 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,18 @@ -mod - electromagnetic pulse - vacuum bomb removes shields and does 20% extra damage - ************** TODO - n-gon ************** +lore - a robot (the player) gains self awareness + each mod/gun/field is a new tech + all the technology leads to the singularity + each game run is actually the mech simulating a possible escape + this is why the graphics are so bad, its just a simulation + final mod is "this is just a simulation" + you get immortality and Infinity damage + the next level is the final level + when you die with Quantum Immortality there is a chance of lore text + make a global variable that goes up by one every time you play + show text at start, loading simulation #... + mod - spores with no target hang out about player mod - status effects last 1 second longer @@ -58,16 +68,6 @@ settings - custom keys binding mod - energy recharges faster when not moving -lore - a robot (the player) gains self awareness - each mod/gun/field is a new tech - all the technology leads to the singularity - each game run is actually the mech simulating a possible escape - this is why the graphics are so bad, its just a simulation - final mod is "this is just a simulation" - you get immortality and Infinity damage - the next level is the final level - when you die with Quantum Immortality there is a chance of lore text - atmosphere levels: change the pace, give the user a rest between combat low or no combat, but more graphics explore lore