immortality bug fix, spore balance, acid balance, and graphics, UI update

This commit is contained in:
landgreen
2019-12-31 09:41:51 -08:00
parent 0ffafd5c31
commit 5a012508b0
9 changed files with 232 additions and 232 deletions

View File

@@ -85,104 +85,113 @@
<text x="10" y="30">custom</text>
</g>
</svg>
<div id="settings">
<details>
<summary>settings</summary>
<div style="line-height: 150%;" id="details-div">
<label for="difficulty-select" title="effects: number of mobs, damage done by mobs, damage done to mobs, mob speed, heal effects">combat difficulty:</label>
<select name="difficulty-select" id="difficulty-select">
<option value="0">easy</option>
<option value="1" selected>normal</option>
<option value="2">hard</option>
<option value="6">why...</option>
</select>
<br>
<label for="body-damage" title="allow damage from the ground and large fast moving blocks">collision damage from blocks:</label>
<input type="checkbox" id="body-damage" name="body-damage" checked style="width:16px; height:16px;">
<br>
<label for="fps-select" title="use this to slow the game down">frames per second cap:</label>
<select name="fps-select" id="fps-select">
<option value="max">no fps cap</option>
<option value="72" selected>72 fps cap</option>
<option value="60">60 fps cap</option>
<option value="45">45 fps cap</option>
<option value="30">30 fps cap</option>
</select>
</div>
</details>
</div>
<div id="controls">
<details>
<summary>about</summary>
<div id="details-div">
<table>
<tr>
<th>FIRE</th>
<td>left mouse</td>
<td></td>
</tr>
<tr>
<th>FIELD</th>
<td>right mouse / spacebar</td>
</tr>
<tr>
<th>MOVE</th>
<td>WASD / arrows</td>
</tr>
<tr>
<th>GUNS</th>
<td>Q / E / mouse wheel</td>
</tr>
<tr>
<th>ZOOM</th>
<td>+ / -</td>
</tr>
<tr>
<th>PAUSE</th>
<td>P</td>
</tr>
<!-- <tr>
<div id='info'>
<div id="settings">
<details>
<summary>settings</summary>
<div style="line-height: 150%;" id="details-div">
<label for="difficulty-select" title="effects: number of mobs, damage done by mobs, damage done to mobs, mob speed, heal effects">combat difficulty:</label>
<select name="difficulty-select" id="difficulty-select">
<option value="0">easy</option>
<option value="1" selected>normal</option>
<option value="2">hard</option>
<option value="6">why...</option>
</select>
<br>
<label for="body-damage" title="allow damage from the ground and large fast moving blocks">collision damage from blocks:</label>
<input type="checkbox" id="body-damage" name="body-damage" checked style="width:16px; height:16px;">
<br>
<label for="fps-select" title="use this to slow the game down">frames per second cap:</label>
<select name="fps-select" id="fps-select">
<option value="max">no fps cap</option>
<option value="72" selected>72 fps cap</option>
<option value="60">60 fps cap</option>
<option value="45">45 fps cap</option>
<option value="30">30 fps cap</option>
</select>
</div>
</details>
</div>
<div id="controls">
<details>
<summary>controls</summary>
<div id="details-div">
<table>
<tr>
<th>FIRE</th>
<td>left mouse</td>
<td></td>
</tr>
<tr>
<th>FIELD</th>
<td>right mouse / spacebar</td>
</tr>
<tr>
<th>MOVE</th>
<td>WASD / arrows</td>
</tr>
<tr>
<th>GUNS</th>
<td>Q / E / mouse wheel</td>
</tr>
<tr>
<th>ZOOM</th>
<td>+ / -</td>
</tr>
<tr>
<th>PAUSE</th>
<td>P</td>
</tr>
<!-- <tr>
<td>FULL SCREEN</td>
<td>enter</td>
</tr> -->
</table>
<br>
<br>
<a href="https://discord.gg/2eC9pgJ">
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 235">
<style>
.st0 {
fill: #1B1F23;
}
</style>
<path class="st0" d="M142.8 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11s-4.6-11-10.2-11zM106.3 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11 .1-6.1-4.5-11-10.2-11z" />
<path class="st0" d="M191.4 36.9h-134c-11.3 0-20.5 9.2-20.5 20.5v134c0 11.3 9.2 20.5 20.5 20.5h113.4l-5.3-18.3 12.8 11.8 12.1 11.1 21.6 18.7V57.4c-.1-11.3-9.3-20.5-20.6-20.5zm-38.6 129.5s-3.6-4.3-6.6-8c13.1-3.7 18.1-11.8 18.1-11.8-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.4-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.6-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.2-1.8-1-2.8-1.7-2.8-1.7s4.8 7.9 17.5 11.7c-3 3.8-6.7 8.2-6.7 8.2-22.1-.7-30.5-15.1-30.5-15.1 0-31.9 14.4-57.8 14.4-57.8 14.4-10.7 28-10.4 28-10.4l1 1.2c-18 5.1-26.2 13-26.2 13s2.2-1.2 5.9-2.8c10.7-4.7 19.2-5.9 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.5 0 0-7.9-7.5-24.9-12.6l1.4-1.6s13.7-.3 28 10.4c0 0 14.4 25.9 14.4 57.8 0-.1-8.4 14.3-30.5 15zM303.8 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1h33.2c17.8.1 34.5-8.8 34.5-29.2v-29.8c.1-20.8-16.6-29.9-34.4-29.9zm174 59.7v-30.6c0-11 19.8-13.5 25.8-2.5l18.3-7.4c-7.2-15.8-20.3-20.4-31.2-20.4-17.8 0-35.4 10.3-35.4 30.3v30.6c0 20.2 17.6 30.3 35 30.3 11.2 0 24.6-5.5 32-19.9l-19.6-9c-4.8 12.3-24.9 9.3-24.9-1.4zM417.3 113c-6.9-1.5-11.5-4-11.8-8.3.4-10.3 16.3-10.7 25.6-.8l14.7-11.3c-9.2-11.2-19.6-14.2-30.3-14.2-16.3 0-32.1 9.2-32.1 26.6 0 16.9 13 26 27.3 28.2 7.3 1 15.4 3.9 15.2 8.9-.6 9.5-20.2 9-29.1-1.8l-14.2 13.3c8.3 10.7 19.6 16.1 30.2 16.1 16.3 0 34.4-9.4 35.1-26.6 1-21.7-14.8-27.2-30.6-30.1zm-67 55.5h22.4V79.7h-22.4v88.8zM728 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1H728c17.8.1 34.5-8.8 34.5-29.2v-29.8c0-20.8-16.7-29.9-34.5-29.9zm-162.9-1.2c-18.4 0-36.7 10-36.7 30.5v30.3c0 20.3 18.4 30.5 36.9 30.5 18.4 0 36.7-10.2 36.7-30.5V109c0-20.4-18.5-30.5-36.9-30.5zm14.4 60.8c0 6.4-7.2 9.7-14.3 9.7-7.2 0-14.4-3.1-14.4-9.7V109c0-6.5 7-10 14-10 7.3 0 14.7 3.1 14.7 10v30.3zM682.4 109c-.5-20.8-14.7-29.2-33-29.2h-35.5v88.8h22.7v-28.2h4l20.6 28.2h28L665 138.1c10.7-3.4 17.4-12.7 17.4-29.1zm-32.6 12h-13.2v-20.3h13.2c14.1 0 14.1 20.3 0 20.3z" />
</svg>
</a>
Chat about n-gon in the <a href="https://discord.gg/2eC9pgJ">discord</a>.<br> Let me know about ideas,
or bugs.
<br>
<br>
<br>
<a href="https://github.com/landgreen/n-gon">
<svg viewBox="0 0 100 16" xmlns="http://www.w3.org/2000/svg" fill="#1B1F23">
<path d="M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z" />
<g stroke='none' font-size="8px" font-family="Arial Black, sans-serif">
<text x="19" y="11">Github</text>
</g>
</svg>
</a>
<a href="https://github.com/landgreen/n-gon">Github</a> hosts the source code for n-gon.<br> It's
written in JavaScript, CSS, and HTML.
<!-- <br>
</table>
</div>
</details>
</div>
<div id="controls">
<details>
<summary>about</summary>
<div id="details-div">
<!-- <p>
n-gon is a 2-D physics platformer / shooter
<br>it has
</p> -->
<a href="https://discord.gg/2eC9pgJ">
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 235">
<style>
.st0 {
fill: #1B1F23;
}
</style>
<path class="st0" d="M142.8 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11s-4.6-11-10.2-11zM106.3 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11 .1-6.1-4.5-11-10.2-11z" />
<path class="st0" d="M191.4 36.9h-134c-11.3 0-20.5 9.2-20.5 20.5v134c0 11.3 9.2 20.5 20.5 20.5h113.4l-5.3-18.3 12.8 11.8 12.1 11.1 21.6 18.7V57.4c-.1-11.3-9.3-20.5-20.6-20.5zm-38.6 129.5s-3.6-4.3-6.6-8c13.1-3.7 18.1-11.8 18.1-11.8-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.4-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.6-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.2-1.8-1-2.8-1.7-2.8-1.7s4.8 7.9 17.5 11.7c-3 3.8-6.7 8.2-6.7 8.2-22.1-.7-30.5-15.1-30.5-15.1 0-31.9 14.4-57.8 14.4-57.8 14.4-10.7 28-10.4 28-10.4l1 1.2c-18 5.1-26.2 13-26.2 13s2.2-1.2 5.9-2.8c10.7-4.7 19.2-5.9 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.5 0 0-7.9-7.5-24.9-12.6l1.4-1.6s13.7-.3 28 10.4c0 0 14.4 25.9 14.4 57.8 0-.1-8.4 14.3-30.5 15zM303.8 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1h33.2c17.8.1 34.5-8.8 34.5-29.2v-29.8c.1-20.8-16.6-29.9-34.4-29.9zm174 59.7v-30.6c0-11 19.8-13.5 25.8-2.5l18.3-7.4c-7.2-15.8-20.3-20.4-31.2-20.4-17.8 0-35.4 10.3-35.4 30.3v30.6c0 20.2 17.6 30.3 35 30.3 11.2 0 24.6-5.5 32-19.9l-19.6-9c-4.8 12.3-24.9 9.3-24.9-1.4zM417.3 113c-6.9-1.5-11.5-4-11.8-8.3.4-10.3 16.3-10.7 25.6-.8l14.7-11.3c-9.2-11.2-19.6-14.2-30.3-14.2-16.3 0-32.1 9.2-32.1 26.6 0 16.9 13 26 27.3 28.2 7.3 1 15.4 3.9 15.2 8.9-.6 9.5-20.2 9-29.1-1.8l-14.2 13.3c8.3 10.7 19.6 16.1 30.2 16.1 16.3 0 34.4-9.4 35.1-26.6 1-21.7-14.8-27.2-30.6-30.1zm-67 55.5h22.4V79.7h-22.4v88.8zM728 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1H728c17.8.1 34.5-8.8 34.5-29.2v-29.8c0-20.8-16.7-29.9-34.5-29.9zm-162.9-1.2c-18.4 0-36.7 10-36.7 30.5v30.3c0 20.3 18.4 30.5 36.9 30.5 18.4 0 36.7-10.2 36.7-30.5V109c0-20.4-18.5-30.5-36.9-30.5zm14.4 60.8c0 6.4-7.2 9.7-14.3 9.7-7.2 0-14.4-3.1-14.4-9.7V109c0-6.5 7-10 14-10 7.3 0 14.7 3.1 14.7 10v30.3zM682.4 109c-.5-20.8-14.7-29.2-33-29.2h-35.5v88.8h22.7v-28.2h4l20.6 28.2h28L665 138.1c10.7-3.4 17.4-12.7 17.4-29.1zm-32.6 12h-13.2v-20.3h13.2c14.1 0 14.1 20.3 0 20.3z" />
</svg>
</a>
Chat about n-gon in the <a href="https://discord.gg/2eC9pgJ">discord</a>.<br> Let me know about ideas,
or bugs.
<br>
<br>
<br>
<a href="https://github.com/landgreen/n-gon">
<svg viewBox="0 0 100 16" xmlns="http://www.w3.org/2000/svg" fill="#1B1F23">
<path d="M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z" />
<g stroke='none' font-size="8px" font-family="Arial Black, sans-serif">
<text x="19" y="11">Github</text>
</g>
</svg>
</a>
<a href="https://github.com/landgreen/n-gon">Github</a> hosts the source code for n-gon.<br> It's
written in JavaScript, CSS, and HTML.
<!-- <br>
<br>
n-gon is also hosted at <a href="https://lilgreenland.itch.io/n-gon">itch.io</a>.
<br>
<br> -->
</div>
</details>
</div>
</details>
</div>
</div>
<style>

View File

@@ -73,7 +73,8 @@ const b = {
description: "each <strong>bullet</strong> does extra chemical <strong class='color-d'>damage</strong><br>instant damage, unaffected by momentum",
have: false, //1
effect: () => { //good with guns that fire many bullets at low speeds, minigun, drones, junk-bots, shotgun, superballs, wavebeam
b.modExtraDmg = 0.1
b.modExtraDmg = 0.25
game.playerDmgColor = "rgba(0,80,80,0.9)"
}
},
{
@@ -118,10 +119,10 @@ const b = {
},
{
name: "Lorentzian topology",
description: "your <strong>bullets</strong> last 40% <strong>longer</strong>",
description: "your <strong>bullets</strong> last 33% <strong>longer</strong>",
have: false, //7
effect: () => { //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range)
b.isModBulletsLastLonger = 1.40
b.isModBulletsLastLonger = 1.33
}
},
{
@@ -129,7 +130,7 @@ const b = {
description: "enemies can discharge <strong style='letter-spacing: 2px;'>spores</strong> on <strong>death</strong><br><strong style='letter-spacing: 2px;'>spores</strong> seek out enemies",
have: false, //8
effect: () => { //good late game maybe?
b.modSpores = 0.20;
b.modSpores = 0.15;
}
},
{
@@ -150,17 +151,17 @@ const b = {
},
{
name: "high explosives",
description: "<strong class='color-e'>explosions</strong> are 50% <strong>larger</strong><br>immune to <strong>harm</strong> from <strong class='color-e'>explosions</strong>",
description: "<strong class='color-e'>explosions</strong> are 33% <strong>larger</strong><br>immune to <strong>harm</strong> from <strong class='color-e'>explosions</strong>",
have: false, //11
effect: () => {
b.modExplosionRadius = 1.3;
b.modExplosionRadius = 1.2;
b.isModImmuneExplosion = true;
}
},
{
name: "entanglement",
description: "using your first gun reduces <strong>harm</strong><br>scales by <strong>7%</strong> for each gun in your inventory",
have: false, //13
have: false, //12
effect: () => { // good with laser-bots
b.isModEntanglement = true
}
@@ -168,15 +169,15 @@ const b = {
{
name: "energy transfer",
description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done",
have: false, //14
have: false, //13
effect: () => { //good with laser, and all fields
b.modEnergySiphon = 0.2;
b.modEnergySiphon = 0.18;
}
},
{
name: "entropy transfer",
description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done",
have: false, //15
have: false, //14
effect: () => { //good with guns that overkill: one shot, grenade
b.modHealthDrain = 0.015;
}
@@ -184,7 +185,7 @@ const b = {
{
name: "overcharge",
description: "charge <strong class='color-f'>energy</strong> <strong>33%</strong> beyond your <strong>maximum</strong>",
have: false, //16
have: false, //15
effect: () => {
mech.fieldEnergyMax = 1.33
}
@@ -192,7 +193,7 @@ const b = {
{
name: "supersaturation",
description: "<strong class='color-h'>heal</strong> <strong>33%</strong> beyond your <strong>max health</strong>",
have: false, //17
have: false, //16
effect: () => {
mech.maxHealth = 1.33
}
@@ -200,7 +201,7 @@ const b = {
{
name: "recursive healing",
description: "<strong class='color-h'>healing</strong> power ups are twice as effective",
have: false, //18
have: false, //17
effect: () => { // good with ablative synthesis, melee builds
b.isModRecursiveHealing = true
}
@@ -208,7 +209,7 @@ const b = {
{
name: "mass-energy equivalence",
description: "convert the mass of <strong>power ups</strong> into <strong class='color-f'>energy</strong><br>power ups fill your <strong class='color-f'>energy</strong> and <strong class='color-h'>heal</strong> for +5%",
have: false, //19
have: false, //18
effect: () => {
b.isModMassEnergy = true // used in mech.usePowerUp
}
@@ -216,7 +217,7 @@ const b = {
{
name: "Bayesian inference",
description: "<strong>15%</strong> chance for double <strong>power ups</strong> to drop",
have: false, //20
have: false, //19
effect: () => { // good with long term planning
b.modMoreDrops = 0.15;
}
@@ -224,7 +225,7 @@ const b = {
{
name: "Gauss rifle",
description: "<strong>launch blocks</strong> at much higher speeds<br><em>hold onto larger blocks even after getting hit</em>",
have: false, //21
have: false, //20
effect: () => { // good with guns that run out of ammo
mech.throwChargeRate = 4;
mech.throwChargeMax = 150;
@@ -234,7 +235,7 @@ const b = {
{
name: "squirrel-cage rotor",
description: "<strong>jump</strong> higher and <strong>move</strong> faster<br>reduced <strong>harm</strong> from <strong>falling</strong> ",
have: false, //22
have: false, //21
effect: () => { // good with melee builds, content skipping builds
b.modSquirrelFx = 1.2;
mech.Fx = 0.015 * b.modSquirrelFx;
@@ -244,7 +245,7 @@ const b = {
{
name: "quantum immortality",
description: "after <strong>dying</strong>, continue in an <strong>alternate reality</strong><br><em>guns, ammo, and field are randomized</em>",
have: false, //23
have: false, //22
effect: () => {
b.modIsImmortal = true;
}
@@ -272,23 +273,6 @@ const b = {
activeGun: null, //current gun in use by player
inventoryGun: 0,
inventory: [], //list of what guns player has // 0 starts with basic gun
giveGuns(gun = "all", ammoPacks = 2) {
if (gun === "all") {
b.activeGun = 0;
b.inventoryGun = 0;
for (let i = 0; i < b.guns.length; i++) {
b.guns[i].have = true;
b.guns[i].ammo = b.guns[i].ammoPack * ammoPacks;
b.inventory[i] = i;
}
} else {
if (!b.guns[gun].have) b.inventory.push(gun);
if (b.activeGun === null) b.activeGun = gun //if no active gun switch to new gun
b.guns[gun].have = true;
b.guns[gun].ammo = b.guns[gun].ammoPack * ammoPacks;
}
game.makeGunHUD();
},
fire() {
if (game.mouseDown && mech.fireCDcycle < mech.cycle && (!(keys[32] || game.mouseDownRight) || mech.fieldFire) && b.inventory.length) {
if (b.guns[b.activeGun].ammo > 0) {
@@ -362,7 +346,7 @@ const b = {
angle: dir,
friction: 0.5,
frictionAir: 0,
dmg: b.modExtraDmg, //damage done in addition to the damage from momentum
dmg: 0, //damage done in addition to the damage from momentum
classType: "bullet",
collisionFilter: {
category: cat.bullet,
@@ -609,20 +593,20 @@ const b = {
restitution: 0.5,
angle: Math.random() * 2 * Math.PI,
friction: 0,
frictionAir: 0.02,
dmg: 1.8, //damage done in addition to the damage from momentum
frictionAir: 0.025,
dmg: 2.5, //damage done in addition to the damage from momentum
classType: "bullet",
collisionFilter: {
category: cat.bullet,
mask: cat.map | cat.mob | cat.mobBullet | cat.mobShield //no collide with body
},
endCycle: game.cycle + Math.floor((360 + Math.floor(Math.random() * 240)) * b.isModBulletsLastLonger),
endCycle: game.cycle + Math.floor((480 + Math.floor(Math.random() * 240)) * b.isModBulletsLastLonger),
minDmgSpeed: 0,
onDmg() {
this.endCycle = 0; //bullet ends cycle after doing damage
},
onEnd() {},
lookFrequency: 87 + Math.floor(47 * Math.random()),
lookFrequency: 97 + Math.floor(77 * Math.random()),
do() {
//find mob targets
if (!(game.cycle % this.lookFrequency)) {
@@ -637,23 +621,24 @@ const b = {
if (dist < closeDist) {
this.closestTarget = mob[i].position;
closeDist = dist;
this.lockedOn = Vector.normalise(targetVector);
this.lockedOn = mob[i] //Vector.normalise(targetVector);
if (0.3 > Math.random()) break //doesn't always target the closest mob
}
}
}
}
//accelerate towards mobs
const THRUST = this.mass * 0.001
if (this.lockedOn) {
this.force.x -= THRUST * this.lockedOn.x
this.force.y -= THRUST * this.lockedOn.y
const THRUST = 0.0004
if (this.lockedOn && this.lockedOn.alive) {
this.force = Vector.mult(Vector.normalise(Vector.sub(this.position, this.lockedOn.position)), -this.mass * THRUST)
// this.force.x -= THRUST * this.lockedOn.x
// this.force.y -= THRUST * this.lockedOn.y
} else {
this.force.y += this.mass * 0.00027; //gravity
}
},
});
const SPEED = 19;
const SPEED = 8 + 3 * Math.random();
const ANGLE = 2 * Math.PI * Math.random()
Matter.Body.setVelocity(bullet[bIndex], {
x: SPEED * Math.cos(ANGLE),
@@ -672,7 +657,7 @@ const b = {
friction: 0.05,
frictionAir: 0.0005,
restitution: 1,
dmg: 0.13 + b.modExtraDmg, //damage done in addition to the damage from momentum
dmg: 0.13, //damage done in addition to the damage from momentum
lookFrequency: 83 + Math.floor(41 * Math.random()),
endCycle: game.cycle + Math.floor((1080 + 360 * Math.random()) * b.isModBulletsLastLonger),
classType: "bullet",
@@ -761,6 +746,35 @@ const b = {
y: speed * Math.sin(dir)
});
},
giveGuns(gun = "random", ammoPacks = 2) {
if (gun === "random") {
//find what guns player doesn't have
options = []
for (let i = 0, len = b.guns.length; i < len; i++) {
if (!b.guns[i].have) options.push(i)
}
if (options.length === 0) return
//randomly pick from list of possible guns
gun = options[Math.floor(Math.random() * options.length)]
}
if (gun === "all") {
b.activeGun = 0;
b.inventoryGun = 0;
for (let i = 0; i < b.guns.length; i++) {
b.guns[i].have = true;
b.guns[i].ammo = b.guns[i].ammoPack * ammoPacks;
b.inventory[i] = i;
}
} else {
if (!b.guns[gun].have) b.inventory.push(gun);
if (b.activeGun === null) b.activeGun = gun //if no active gun switch to new gun
b.guns[gun].have = true;
b.guns[gun].ammo = b.guns[gun].ammoPack * ammoPacks;
}
game.makeGunHUD();
},
guns: [{
name: "minigun", //0
description: "rapidly fire a stream of small <strong>bullets</strong>",
@@ -842,7 +856,7 @@ const b = {
});
// Matter.Body.setDensity(bullet[me], 0.0001);
bullet[me].endCycle = game.cycle + Math.floor(360 * b.isModBulletsLastLonger);
bullet[me].dmg = b.modExtraDmg;
bullet[me].dmg = 0;
bullet[me].minDmgSpeed = 0;
bullet[me].restitution = 0.99;
bullet[me].friction = 0;
@@ -878,7 +892,7 @@ const b = {
const me = bullet.length;
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle), 45 * b.modBulletSize, 1.4 * b.modBulletSize, b.fireAttributes(mech.angle));
bullet[me].endCycle = game.cycle + Math.floor(180 * b.isModBulletsLastLonger);
bullet[me].dmg = 1 + b.modExtraDmg;
bullet[me].dmg = 1;
bullet[me].do = function () {
if (this.speed < 10) this.force.y += this.mass * 0.0003; //no gravity until it slows don to improve aiming
};
@@ -909,7 +923,7 @@ const b = {
inertia: Infinity,
frictionAir: 0,
minDmgSpeed: 0,
dmg: 0.13 + b.modExtraDmg, //damage done in addition to the damage from momentum
dmg: 0.13, //damage done in addition to the damage from momentum
classType: "bullet",
collisionFilter: {
category: cat.bullet,
@@ -959,7 +973,7 @@ const b = {
// angle: 0,
// friction: 0.5,
frictionAir: 0,
dmg: b.modExtraDmg, //damage done in addition to the damage from momentum
dmg: 0, //damage done in addition to the damage from momentum
classType: "bullet",
collisionFilter: {
category: 0,
@@ -1512,7 +1526,7 @@ const b = {
Matter.Body.setVelocity(bullet[me], velocity);
World.add(engine.world, bullet[me]); //add bullet to world
bullet[me].endCycle = game.cycle + 60 + 15 * Math.random();
// bullet[me].dmg = 1.1+b.modExtraDmg;
// bullet[me].dmg = 1.1
bullet[me].do = function () {};
}
}
@@ -1524,7 +1538,7 @@ const b = {
name: "spores", //11
description: "fire orbs that discharge <strong style='letter-spacing: 2px;'>spores</strong><br><strong style='letter-spacing: 2px;'>spores</strong> seek out enemies",
ammo: 0,
ammoPack: 6,
ammoPack: 10,
have: false,
isStarterGun: false,
fire() {
@@ -1557,7 +1571,7 @@ const b = {
//spawn bullets on end
bullet[me].onEnd = function () {
const NUM = 9;
const NUM = 10;
for (let i = 0; i < NUM; i++) {
b.spore(this)
}
@@ -1593,7 +1607,7 @@ const b = {
friction: 0,
frictionStatic: 0,
restitution: 0.5 + 0.5 * Math.random(),
dmg: b.modExtraDmg, // 0.14 //damage done in addition to the damage from momentum
dmg: 0, // 0.14 //damage done in addition to the damage from momentum
minDmgSpeed: 2,
lookFrequency: 37 + Math.floor(27 * Math.random()),
acceleration: 0.0015 + 0.0013 * Math.random(),
@@ -2261,7 +2275,7 @@ const b = {
frictionAir: 0.003,
friction: 0.2,
restitution: 0.2,
dmg: b.modExtraDmg, //damage done in addition to the damage from momentum
dmg: 0, //damage done in addition to the damage from momentum
classType: "bullet",
collisionFilter: {
category: cat.bullet,
@@ -2355,7 +2369,7 @@ const b = {
// friction: 1,
// // frictionAir: 1,
// endCycle: game.cycle + TOTAL_CYCLES,
// dmg: b.modExtraDmg, //damage done in addition to the damage from momentum
// dmg: 0, //damage done in addition to the damage from momentum
// classType: "bullet",
// collisionFilter: {
// category: 0x000100,
@@ -2448,7 +2462,7 @@ const b = {
// // friction: 0.05,
// // frictionAir: 0.05,
// restitution: 0.8,
// dmg: 0.14 + b.modExtraDmg, //damage done in addition to the damage from momentum
// dmg: 0.14, //damage done in addition to the damage from momentum
// lookFrequency: 3,
// endCycle: game.cycle + Math.floor(120 * b.isModBulletsLastLonger),
// classType: "bullet",

View File

@@ -197,7 +197,7 @@ function mobCollisionChecks(event) {
if (obj.classType === "body" && obj.speed > 5) {
const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity));
if (v > 8) {
let dmg = b.dmgScale * v * Math.sqrt(obj.mass) * 0.05;
let dmg = b.dmgScale * (b.modExtraDmg + v * Math.sqrt(obj.mass) * 0.05);
mob[k].damage(dmg);
if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer();
game.drawList.push({

View File

@@ -325,8 +325,7 @@ const game = {
const mode = (mech.fieldMode === mech.fieldUpgrades.length - 1) ? 0 : mech.fieldMode + 1
mech.setField(mode)
} else if (keys[71]) { // give all guns with G
// b.giveGuns("all", 1000)
powerUps.gun.effect()
b.giveGuns("all", 1000)
} else if (keys[72]) { // heal with H
mech.addHealth(Infinity)
mech.fieldMeter = mech.fieldEnergyMax;
@@ -498,10 +497,9 @@ const game = {
game.startGame();
};
document.getElementById("choose-grid").style.display = "none"
document.getElementById("controls").style.display = "inline";
document.getElementById("info").style.display = "inline";
document.getElementById("build-button").style.display = "inline"
isShowingBuilds = false
document.getElementById("settings").style.display = "inline";
document.getElementById("splash").style.display = "inline";
document.getElementById("dmg").style.display = "none";
document.getElementById("health-bg").style.display = "none";
@@ -515,8 +513,7 @@ const game = {
document.body.style.overflow = "hidden"
document.getElementById("choose-grid").style.display = "none"
document.getElementById("build-grid").style.display = "none"
document.getElementById("controls").style.display = "none";
document.getElementById("settings").style.display = "none";
document.getElementById("info").style.display = "none";
document.getElementById("build-button").style.display = "none";
document.getElementById("splash").onclick = null; //removes the onclick effect so the function only runs once
document.getElementById("splash").style.display = "none"; //hides the element that spawned the function
@@ -538,7 +535,7 @@ const game = {
// // game.getCoords.pos1.y = Math.round(game.mouseInGame.y / 25) * 25;
// // }
// // mech.throw();
// // mech.throwBlock();
// };
document.body.style.cursor = "none";

View File

@@ -94,7 +94,7 @@ game mechanics
// local storage
let localSettings = JSON.parse(localStorage.getItem("localSettings"));
// console.log(localSettings)
if (localSettings) {
game.isBodyDamage = localSettings.isBodyDamage
document.getElementById("body-damage").checked = localSettings.isBodyDamage
@@ -102,9 +102,12 @@ if (localSettings) {
game.difficultyMode = localSettings.difficultyMode
document.getElementById("difficulty-select").value = localSettings.difficultyMode
game.fpsCapDefault = localSettings.fpsCapDefault
if (localSettings.fpsCapDefault === 'max') {
game.fpsCapDefault = 999999999;
} else {
game.fpsCapDefault = Number(localSettings.fpsCapDefault)
}
document.getElementById("fps-select").value = localSettings.fpsCapDefault
} else {
localSettings = {
isBodyDamage: true,
@@ -192,8 +195,7 @@ document.getElementById("build-button").addEventListener("click", () => {
el.style.display = "none"
build.isShowingBuilds = false
document.body.style.overflow = "hidden"
document.getElementById("controls").style.display = 'inline'
document.getElementById("settings").style.display = 'inline'
document.getElementById("info").style.display = 'inline'
} else {
build.list = []
// let text = '<p>choose up to 5 powers<br> <button type="button" id="build-begin-button" onclick="build.startBuildRun()">Begin Run</button></p>'
@@ -222,8 +224,7 @@ document.getElementById("build-button").addEventListener("click", () => {
build.isShowingBuilds = true
document.body.style.overflowY = "scroll";
document.body.style.overflowX = "hidden";
document.getElementById("controls").style.display = 'none'
document.getElementById("settings").style.display = 'none'
document.getElementById("info").style.display = 'none'
}
});
@@ -305,18 +306,10 @@ document.getElementById("fps-select").addEventListener("input", () => {
let value = document.getElementById("fps-select").value
if (value === 'max') {
game.fpsCapDefault = 999999999;
} else if (value === '72') {
game.fpsCapDefault = 72
} else if (value === '60') {
game.fpsCapDefault = 60
} else if (value === '45') {
game.fpsCapDefault = 45
} else if (value === '30') {
game.fpsCapDefault = 30
} else if (value === '15') {
game.fpsCapDefault = 15
} else {
game.fpsCapDefault = Number(value)
}
localSettings.fpsCapDefault = game.fpsCapDefault
localSettings.fpsCapDefault = value
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
});

View File

@@ -14,9 +14,9 @@ const level = {
start() {
if (level.levelsCleared === 0) {
// game.difficulty = 6; //for testing to simulate possible mobs spawns
// b.giveGuns(3)
// b.giveGuns(21)
// mech.fieldUpgrades[2].effect();
// b.giveMod(21)
// b.giveMod(22)
level.intro(); //starting level
// level.testingMap();
@@ -119,10 +119,10 @@ const level = {
// powerUps.spawn(450, -400, "mod", false);
// spawn.bodyRect(-45, -100, 40, 50);
// spawn.groupBoss(800, -1050);
spawn.spinner(400, -1050);
spawn.spinner(1200, -1050);
spawn.starter(400, -1050);
spawn.starter(1200, -1050);
// spawn.groupBoss(-600, -550);
spawn.spinner(800, -150);
spawn.starter(800, -150);
// spawn.beamer(800, -150);
// spawn.grower(800, -250);
// spawn.blinker(800, -250, 40);

View File

@@ -328,9 +328,9 @@ const mech = {
function randomizeField() {
if (game.difficulty * (Math.random() + 0.27) > 2) {
mech.fieldUpgrades[Math.floor(Math.random() * (mech.fieldUpgrades.length))].effect();
mech.setField(Math.floor(Math.random() * (mech.fieldUpgrades.length)))
} else {
mech.fieldUpgrades[0].effect();
mech.setField(0)
}
}
@@ -350,8 +350,10 @@ const mech = {
b.guns[i].have = false;
if (b.guns[i].ammo !== Infinity) b.guns[i].ammo = 0;
}
//give random guns
for (let i = 0; i < length; i++) {
powerUps.gun.effect();
b.giveGuns()
}
//randomize ammo
@@ -746,33 +748,31 @@ const mech = {
Matter.Body.rotate(mech.holdingTarget, 0.01 / mech.holdingTarget.mass); //gently spin the block
}
},
throw () {
if ((keys[32] || game.mouseDownRight)) {
throwBlock() {
if (mech.holdingTarget && (keys[32] || game.mouseDownRight)) {
if (mech.fieldMeter > 0.0007) {
if (mech.holdingTarget) {
mech.fieldMeter -= 0.0007;
mech.throwCharge += mech.throwChargeRate;;
//draw charge
const x = mech.pos.x + 15 * Math.cos(mech.angle);
const y = mech.pos.y + 15 * Math.sin(mech.angle);
const len = mech.holdingTarget.vertices.length - 1;
const edge = mech.throwCharge * mech.throwCharge * 0.02;
const grd = ctx.createRadialGradient(x, y, edge, x, y, edge + 5);
grd.addColorStop(0, "rgba(255,50,150,0.3)");
grd.addColorStop(1, "transparent");
ctx.fillStyle = grd;
mech.fieldMeter -= 0.0007;
mech.throwCharge += mech.throwChargeRate;;
//draw charge
const x = mech.pos.x + 15 * Math.cos(mech.angle);
const y = mech.pos.y + 15 * Math.sin(mech.angle);
const len = mech.holdingTarget.vertices.length - 1;
const edge = mech.throwCharge * mech.throwCharge * 0.02;
const grd = ctx.createRadialGradient(x, y, edge, x, y, edge + 5);
grd.addColorStop(0, "rgba(255,50,150,0.3)");
grd.addColorStop(1, "transparent");
ctx.fillStyle = grd;
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(mech.holdingTarget.vertices[len].x, mech.holdingTarget.vertices[len].y);
ctx.lineTo(mech.holdingTarget.vertices[0].x, mech.holdingTarget.vertices[0].y);
ctx.fill();
for (let i = 0; i < len; i++) {
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(mech.holdingTarget.vertices[len].x, mech.holdingTarget.vertices[len].y);
ctx.lineTo(mech.holdingTarget.vertices[0].x, mech.holdingTarget.vertices[0].y);
ctx.lineTo(mech.holdingTarget.vertices[i].x, mech.holdingTarget.vertices[i].y);
ctx.lineTo(mech.holdingTarget.vertices[i + 1].x, mech.holdingTarget.vertices[i + 1].y);
ctx.fill();
for (let i = 0; i < len; i++) {
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(mech.holdingTarget.vertices[i].x, mech.holdingTarget.vertices[i].y);
ctx.lineTo(mech.holdingTarget.vertices[i + 1].x, mech.holdingTarget.vertices[i + 1].y);
ctx.fill();
}
}
} else {
mech.drop()
@@ -1052,7 +1052,7 @@ const mech = {
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.05 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
mech.drawField();
mech.grabPowerUp();
@@ -1079,7 +1079,7 @@ const mech = {
mech.wakeCheck();
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
const DRAIN = 0.0023
if (mech.fieldMeter > DRAIN) {
@@ -1145,7 +1145,7 @@ const mech = {
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
const DRAIN = 0.0005
if (mech.fieldMeter > DRAIN) {
@@ -1309,7 +1309,7 @@ const mech = {
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
const DRAIN = 0.0004
if (mech.fieldMeter > DRAIN) {
@@ -1394,7 +1394,7 @@ const mech = {
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
mech.throwBlock();
} else if (((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle && mech.fieldMeter > 0)) { //not hold but field button is pressed
mech.grabPowerUp();
mech.lookForPickUp(180);
@@ -1431,15 +1431,15 @@ const mech = {
effect: () => {
mech.fieldRegen *= 2;
mech.hold = function () {
if (mech.fieldMeter > mech.fieldEnergyMax - 0.02) {
if (mech.fieldMeter > mech.fieldEnergyMax - 0.02 && mech.fieldCDcycle < mech.cycle) {
mech.fieldCDcycle = mech.cycle + 17; // set cool down to prevent +energy from making huge numbers of drones
mech.fieldMeter -= 0.32;
b.drone(1)
mech.fireCDcycle = mech.cycle + 25; // set fire cool down to prevent +energy from making huge numbers of drones
}
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.1 && mech.fieldCDcycle < mech.cycle)) { //not hold but field button is pressed
mech.drawField();
mech.grabPowerUp();
@@ -1465,7 +1465,7 @@ const mech = {
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
const DRAIN = 0.0015
if (mech.fieldMeter > DRAIN) {
@@ -1514,7 +1514,7 @@ const mech = {
// mech.hackProgress = 0
// mech.drawHold(mech.holdingTarget);
// mech.holding();
// mech.throw();
// mech.throwBlock();
// } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) {
// const DRAIN = 0.0005
// if (mech.fieldMeter > DRAIN) {

View File

@@ -3,12 +3,7 @@ let powerUp = [];
const powerUps = {
choose(type, index) {
if (type === "gun") {
if (b.activeGun === null) b.activeGun = index //if no active gun switch to new gun
b.guns[index].have = true;
b.inventory.push(index);
b.guns[index].ammo += b.guns[index].ammoPack * 2;
game.makeGunHUD();
b.giveGuns(index)
// game.replaceTextLog = true;
// game.makeTextLog(`${game.SVGleftMouse} <strong style='font-size:30px;'>${b.guns[index].name}</strong><br><br>${b.guns[index].description}`, 500);
// game.replaceTextLog = false;

View File

@@ -55,7 +55,7 @@ summary {
#build-button {
position: absolute;
top: 3px;
bottom: 3px;
right: 3px;
z-index: 12;
}
@@ -135,15 +135,7 @@ summary {
background-color: #efeff5;
}
#settings {
position: absolute;
bottom: 0px;
right: 1px;
z-index: 12;
font-size: 1.5em;
}
#controls {
#info {
position: absolute;
bottom: 0px;
left: 1px;