diff --git a/js/bullets.js b/js/bullets.js index 16e9b7d..c78d3f5 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -40,6 +40,7 @@ const b = { modLaserReflections: null, isModNoAmmo: null, isModAmmoFromHealth: null, + mobDieAtHealth: null, setModDefaults() { b.modCount = 0; b.modFireRate = 1; @@ -78,6 +79,7 @@ const b = { b.modLaserReflections = 2; b.isModNoAmmo = false; b.isModAmmoFromHealth = 0; + b.mobDieAtHealth = 0.05; mech.Fx = 0.015; mech.jumpForce = 0.38; mech.maxHealth = 1; @@ -219,6 +221,18 @@ const b = { b.isModBulletsLastLonger += 0.33 } }, + { + name: "reaction inhibitor", + description: "mobs die if their life goes below 12%", + maxCount: 3, + count: 0, + allowed() { + return true + }, + effect: () => { + b.mobDieAtHealth = 0.15 + } + }, { name: "zoospore vector", description: "enemies discharge spores on death
+11% chance", @@ -587,6 +601,18 @@ const b = { } } }, + // { + // name: "super mines", + // description: "mines fire super balls when triggered", + // maxCount: 1, + // count: 0, + // allowed() { + // return b.haveGunCheck("mines") + // }, + // effect() { + + // } + // }, ], giveMod(index = 'random') { if (index === 'random') { @@ -893,7 +919,6 @@ const b = { if (collide.length > 0) { for (let i = 0; i < collide.length; i++) { if (collide[i].bodyA.collisionFilter.category === cat.map || collide[i].bodyB.collisionFilter.category === cat.map) { - // console.log(collide) const angle = Matter.Vector.angle(collide[i].normal, { x: 1, y: 0 diff --git a/js/game.js b/js/game.js index 467cabc..c86df48 100644 --- a/js/game.js +++ b/js/game.js @@ -12,7 +12,7 @@ const game = { level.checkQuery(); mech.move(); mech.look(); - game.fallChecks(); + game.checks(); ctx.save(); game.camera(); mech.draw(); @@ -34,7 +34,7 @@ const game = { level.checkQuery(); mech.move(); mech.look(); - game.fallChecks(); + game.checks(); ctx.save(); game.camera(); level.drawFillBGs(); @@ -634,7 +634,7 @@ const game = { } } }, - fallChecks() { + checks() { // if 4000px deep if (mech.pos.y > game.fallHeight) { mech.death(); @@ -664,7 +664,11 @@ const game = { // } } - if (!(mech.cycle % 420)) { + if (!(mech.cycle % 60)) { //once a second check + + } + + if (!(game.cycle % 420)) { //once every 7 seconds fallCheck = function (who) { let i = who.length; while (i--) { diff --git a/js/index.js b/js/index.js index d776984..b32463f 100644 --- a/js/index.js +++ b/js/index.js @@ -1,168 +1,4 @@ "use strict"; -/* TODO: ******************************************* -***************************************************** - -mod - mobs die at 15% life (default is 5%) - -mod - negative mass field - mke block orbit player, like black hole boss - named rotational frame-dragging - -mod - energy recharges faster when not moving - -lore - a mech 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 - atmosphere levels that explore lore - give the user a rest, between combat - low combat more graphics - large rotating fan that the player has to move through - nonaggressive mobs one mob attacking the passive mobs - in the final level you see your self at the starting level, with the wires - you shoot your self to wake up? - -wave beam - needs a serious buff, its not fun, and it needs more damage - shorter range, higher dmg, faster wiggle -mod: wave beam - speed up the wave beam and reduce the wave amplitude to improve targeting at range - -shotgun - even more short range effects - -mod: flechettes - each burst fires an extra flechette -mod: flechettes - stick into mobs and do poison damage, like foam - -mod: foam - does extra poison dmg (to get past shields) - -mod: vacuum bomb - does a constant suck - -mod: shield harmonics - large field radius - -mod: shotgun - fire extra shot - but also increase spread? - -speed up movement - higher gravity, larger jump force - faster horizontal acceleration - only increase top speed a bit - -mob: targeting laser, then a high speed, no gravity bullet - -add difficulty slider to custom? - -add recursive mod counts to pause screen - -key required to open the exit to some levels - must hold key like a block - could the key be any block? - -css transition for pause menu - -field that pushes everything back, and can destroy smaller blocks - converts blocks into ammo power ups - -mod: make player invisible when... - use the flag from phase field - when health is low? - -field: a larger radius that attracted enemies - still deflected them near the robot - convert the health of mobs into energy when they are being attracted - -mod: chance to not die from fatal damage - also push mobs and bodies away? - also heal? - -mod: bot that fires minigun bullets - only fires when your mouse is held down - -mod: do extra damage based on your speed - do more damage when not moving? - take less damage when not moving? - -gun/field: portals - use the code from mines to get them to stick to walls - or lasers - alternate red and blue portals - -missiles don't explode reliably enough - they can bounce, which is cool, but they should still explode right after a bounce - -weekly random challenge where everyone playing each week gets the same random setup. - The randomness would be determined by the date so it would sync everyone. - power ups still drop, but the drops are determined by a preset list that changes each week. - -mod: do something at the end of each level - heal to full - should still be effected by the heal reduction at higher difficulty - give ammo to current gun - give goals/quests for each level - how to track goals? - take no damage - don't shoot - -gun: Spirit Bomb (singularity) - use charge up like rail gun - electricity graphics like plasma torch - suck in nearby mobs, power ups?, blocks? - sucked in stuff increase size - uses energy - hold above the player's head - -Boss levels - sensor that locks you in after you enter the boss room - boss that eats other mobs and gains stats from them - chance to spawn on any level (past level 5) - -add a key that player picks up and needs to set on the exit door to open it - -make power ups keep moving to player if the pickup field is turned off before they get picked up - not sure how to do this without adding a constant check - -animate new level spawn by having the map aspects randomly fly into place - -new map with repeating endlessness - get ideas from Manifold Garden game - if falling, get teleported above the map - I tried it, but had trouble getting the camera to adjust to the teleportation - this can apply to blocks mobs, and power ups as well - -field power up effects - field allows player to hold and throw living mobs - and hack mobs - -give mobs more animal-like behaviors - like rain world - give mobs something to do when they don't see player - explore map - eat power ups - drop power up (if killed after eating one) - mobs some times aren't aggressive - when low on life or after taking a large hit - mobs can fight each other - this might be hard to code - isolated mobs try to group up. - -game mechanics - mechanics that support the physics engine - add rope/constraint - get ideas from game: limbo / inside - environmental hazards - laser - lava - button / switch - door - fizzler - moving platform - map zones - water - low friction ground - bouncy ground - -*/ - //collision groups // cat.player | cat.map | cat.body | cat.bullet | cat.powerUp | cat.mob | cat.mobBullet | cat.mobShield const cat = { diff --git a/js/level.js b/js/level.js index d10cb5f..d84f7e6 100644 --- a/js/level.js +++ b/js/level.js @@ -14,10 +14,10 @@ const level = { start() { if (level.levelsCleared === 0) { // level.difficultyIncrease(5) - b.giveGuns("wave beam") - // mech.setField("phase decoherence field") + // b.giveGuns("wave beam") + // mech.setField("negative mass field") // for (let i = 0; i < 9; i++) { - // b.giveMod("auto-loading heuristics"); + // b.giveMod("reaction inhibitor"); // } level.intro(); //starting level diff --git a/js/mobs.js b/js/mobs.js index 8666de4..970fedb 100644 --- a/js/mobs.js +++ b/js/mobs.js @@ -523,57 +523,57 @@ const mobs = { // time: game.drawTime // }); }, - zoom() { - this.zoomMode--; - if (this.zoomMode > 150) { - this.drawTrail(); - if (this.seePlayer.recall) { - //attraction to player - const forceMag = this.accelMag * this.mass; - const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); - this.force.x += forceMag * Math.cos(angle); - this.force.y += forceMag * Math.sin(angle); - } - } else if (this.zoomMode < 0) { - this.zoomMode = 300; - this.setupTrail(); - } - }, - setupTrail() { - this.trail = []; - for (let i = 0; i < this.trailLength; ++i) { - this.trail.push({ - x: this.position.x, - y: this.position.y - }); - } - }, - drawTrail() { - //dont' forget to run setupTrail() after mob spawn - const t = this.trail; - const len = t.length; - t.pop(); - t.unshift({ - x: this.position.x, - y: this.position.y - }); - //draw - ctx.strokeStyle = this.trailFill; - ctx.beginPath(); - // ctx.moveTo(t[0].x, t[0].y); - // ctx.lineTo(t[0].x, t[0].y); - // ctx.globalAlpha = 0.2; - // ctx.lineWidth = this.radius * 3; - // ctx.stroke(); - ctx.globalAlpha = 0.5 / len; - ctx.lineWidth = this.radius * 1.95; - for (let i = 0; i < len; ++i) { - // ctx.lineWidth *= 0.96; - ctx.lineTo(t[i].x, t[i].y); - ctx.stroke(); - } - ctx.globalAlpha = 1; - }, + // zoom() { + // this.zoomMode--; + // if (this.zoomMode > 150) { + // this.drawTrail(); + // if (this.seePlayer.recall) { + // //attraction to player + // const forceMag = this.accelMag * this.mass; + // const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); + // this.force.x += forceMag * Math.cos(angle); + // this.force.y += forceMag * Math.sin(angle); + // } + // } else if (this.zoomMode < 0) { + // this.zoomMode = 300; + // this.setupTrail(); + // } + // }, + // setupTrail() { + // this.trail = []; + // for (let i = 0; i < this.trailLength; ++i) { + // this.trail.push({ + // x: this.position.x, + // y: this.position.y + // }); + // } + // }, + // drawTrail() { + // //dont' forget to run setupTrail() after mob spawn + // const t = this.trail; + // const len = t.length; + // t.pop(); + // t.unshift({ + // x: this.position.x, + // y: this.position.y + // }); + // //draw + // ctx.strokeStyle = this.trailFill; + // ctx.beginPath(); + // // ctx.moveTo(t[0].x, t[0].y); + // // ctx.lineTo(t[0].x, t[0].y); + // // ctx.globalAlpha = 0.2; + // // ctx.lineWidth = this.radius * 3; + // // ctx.stroke(); + // ctx.globalAlpha = 0.5 / len; + // ctx.lineWidth = this.radius * 1.95; + // for (let i = 0; i < len; ++i) { + // // ctx.lineWidth *= 0.96; + // ctx.lineTo(t[i].x, t[i].y); + // ctx.stroke(); + // } + // ctx.globalAlpha = 1; + // }, curl(range = 1000, mag = -10) { //cause all mobs, and bodies to rotate in a circle applyCurl = function (center, array) { @@ -946,7 +946,7 @@ const mobs = { this.health -= dmg //this.fill = this.color + this.health + ')'; this.onDamage(dmg); //custom damage effects - if (this.health < 0.05 && this.alive) this.death(); + if (this.health < b.mobDieAtHealth && this.alive) this.death(); } }, onDamage() { diff --git a/todo.md b/todo.md new file mode 100644 index 0000000..06fe58c --- /dev/null +++ b/todo.md @@ -0,0 +1,157 @@ +make a var that tracks the last time a kill was made + mod - squirrel cage rotor - effect is only active for 10 seconds after killing a mob + turn this off in game.checks() + mod - do more damage for 10 seconds after killing a mob + mod - energy or health regeneration for 10 seconds after killing a mob + run this effect in game.checks() + + +mod - mines - fire something instead of needles on activation + foam?, flak?, vacuum bomb, super balls + make a different mod for each type of bullet mine can fire + +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 + atmosphere levels that explore lore + give the user a rest, between combat + low combat more graphics + large rotating fan that the player has to move through + nonaggressive mobs one mob attacking the passive mobs + in the final level you see your self at the starting level, with the wires + you shoot your self to wake up? + +shotgun - even more short range effects + +mod: flechettes - each burst fires an extra flechettes +mod: flechettes - stick into mobs and do poison damage, like foam + +mod: foam - does extra poison dmg (to get past shields) + +mod: vacuum bomb - does a constant suck + +mod: shield harmonics - large field radius + +mod: shotgun - fire extra shot + but also increase spread? + +speed up movement for all gameplay + higher gravity, larger jump force + faster horizontal acceleration + only increase top speed a bit + +mob: targeting laser, then a high speed, no gravity bullet + +add difficulty slider to custom? + +add recursive mod counts to pause screen + +css transition for pause menu + +field that pushes everything back, and can destroy smaller blocks + converts blocks into ammo power ups + +mod: make player invisible when... + use the flag from phase field + when health is low? + +field: a larger radius that attracted enemies + still deflected them near the robot + convert the health of mobs into energy when they are being attracted + +mod: chance to not die from fatal damage + also push mobs and bodies away? + also heal? + +mod: bot that fires minigun bullets + only fires when your mouse is held down + +mod: do extra damage based on your speed + do more damage when not moving? + take less damage when not moving? + +gun/field: portals + use the code from mines to get them to stick to walls + or lasers + alternate red and blue portals + +missiles don't explode reliably enough + they can bounce, which is cool, but they should still explode right after a bounce + +weekly random challenge where everyone playing each week gets the same random setup. + The randomness would be determined by the date so it would sync everyone. + power ups still drop, but the drops are determined by a preset list that changes each week. + +mod: do something at the end of each level + heal to full + should still be effected by the heal reduction at higher difficulty + give ammo to current gun + give goals/quests for each level + how to track goals? + take no damage + don't shoot + +gun: Spirit Bomb (singularity) + use charge up like rail gun + electricity graphics like plasma torch + suck in nearby mobs, power ups?, blocks? + sucked in stuff increase size + uses energy + hold above the player's head + +Boss levels + sensor that locks you in after you enter the boss room + boss that eats other mobs and gains stats from them + chance to spawn on any level (past level 5) + +add a key that player picks up and needs to set on the exit door to open it + +make power ups keep moving to player if the pickup field is turned off before they get picked up + not sure how to do this without adding a constant check + +animate new level spawn by having the map aspects randomly fly into place + +new map with repeating endlessness + get ideas from Manifold Garden game + if falling, get teleported above the map + I tried it, but had trouble getting the camera to adjust to the teleportation + this can apply to blocks mobs, and power ups as well + +field power up effects + field allows player to hold and throw living mobs + and hack mobs + +give mobs more animal-like behaviors + like rain world + give mobs something to do when they don't see player + explore map + eat power ups + drop power up (if killed after eating one) + mobs some times aren't aggressive + when low on life or after taking a large hit + mobs can fight each other + this might be hard to code + isolated mobs try to group up. + +game mechanics + mechanics that support the physics engine + add rope/constraint + get ideas from game: limbo / inside + environmental hazards + laser + lava + button / switch + door + fizzler + moving platform + map zones + water + low friction ground + bouncy ground \ No newline at end of file