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> <text x="10" y="30">custom</text>
</g> </g>
</svg> </svg>
<div id="settings"> <div id='info'>
<details> <div id="settings">
<summary>settings</summary> <details>
<div style="line-height: 150%;" id="details-div"> <summary>settings</summary>
<label for="difficulty-select" title="effects: number of mobs, damage done by mobs, damage done to mobs, mob speed, heal effects">combat difficulty:</label> <div style="line-height: 150%;" id="details-div">
<select name="difficulty-select" id="difficulty-select"> <label for="difficulty-select" title="effects: number of mobs, damage done by mobs, damage done to mobs, mob speed, heal effects">combat difficulty:</label>
<option value="0">easy</option> <select name="difficulty-select" id="difficulty-select">
<option value="1" selected>normal</option> <option value="0">easy</option>
<option value="2">hard</option> <option value="1" selected>normal</option>
<option value="6">why...</option> <option value="2">hard</option>
</select> <option value="6">why...</option>
<br> </select>
<label for="body-damage" title="allow damage from the ground and large fast moving blocks">collision damage from blocks:</label> <br>
<input type="checkbox" id="body-damage" name="body-damage" checked style="width:16px; height:16px;"> <label for="body-damage" title="allow damage from the ground and large fast moving blocks">collision damage from blocks:</label>
<br> <input type="checkbox" id="body-damage" name="body-damage" checked style="width:16px; height:16px;">
<label for="fps-select" title="use this to slow the game down">frames per second cap:</label> <br>
<select name="fps-select" id="fps-select"> <label for="fps-select" title="use this to slow the game down">frames per second cap:</label>
<option value="max">no fps cap</option> <select name="fps-select" id="fps-select">
<option value="72" selected>72 fps cap</option> <option value="max">no fps cap</option>
<option value="60">60 fps cap</option> <option value="72" selected>72 fps cap</option>
<option value="45">45 fps cap</option> <option value="60">60 fps cap</option>
<option value="30">30 fps cap</option> <option value="45">45 fps cap</option>
</select> <option value="30">30 fps cap</option>
</div> </select>
</details> </div>
</div> </details>
</div>
<div id="controls">
<div id="controls"> <details>
<details> <summary>controls</summary>
<summary>about</summary> <div id="details-div">
<div id="details-div"> <table>
<table> <tr>
<tr> <th>FIRE</th>
<th>FIRE</th> <td>left mouse</td>
<td>left mouse</td> <td></td>
<td></td> </tr>
</tr> <tr>
<tr> <th>FIELD</th>
<th>FIELD</th> <td>right mouse / spacebar</td>
<td>right mouse / spacebar</td> </tr>
</tr> <tr>
<tr> <th>MOVE</th>
<th>MOVE</th> <td>WASD / arrows</td>
<td>WASD / arrows</td> </tr>
</tr> <tr>
<tr> <th>GUNS</th>
<th>GUNS</th> <td>Q / E / mouse wheel</td>
<td>Q / E / mouse wheel</td> </tr>
</tr> <tr>
<tr> <th>ZOOM</th>
<th>ZOOM</th> <td>+ / -</td>
<td>+ / -</td> </tr>
</tr> <tr>
<tr> <th>PAUSE</th>
<th>PAUSE</th> <td>P</td>
<td>P</td> </tr>
</tr> <!-- <tr>
<!-- <tr>
<td>FULL SCREEN</td> <td>FULL SCREEN</td>
<td>enter</td> <td>enter</td>
</tr> --> </tr> -->
</table> </table>
<br> </div>
<br> </details>
<a href="https://discord.gg/2eC9pgJ"> </div>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 235"> <div id="controls">
<style> <details>
.st0 { <summary>about</summary>
fill: #1B1F23; <div id="details-div">
} <!-- <p>
</style> n-gon is a 2-D physics platformer / shooter
<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" /> <br>it has
<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" /> </p> -->
</svg> <a href="https://discord.gg/2eC9pgJ">
</a> <svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 235">
Chat about n-gon in the <a href="https://discord.gg/2eC9pgJ">discord</a>.<br> Let me know about ideas, <style>
or bugs. .st0 {
<br> fill: #1B1F23;
<br> }
<br> </style>
<a href="https://github.com/landgreen/n-gon"> <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" />
<svg viewBox="0 0 100 16" xmlns="http://www.w3.org/2000/svg" fill="#1B1F23"> <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" />
<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" /> </svg>
<g stroke='none' font-size="8px" font-family="Arial Black, sans-serif"> </a>
<text x="19" y="11">Github</text> Chat about n-gon in the <a href="https://discord.gg/2eC9pgJ">discord</a>.<br> Let me know about ideas,
</g> or bugs.
</svg> <br>
</a> <br>
<a href="https://github.com/landgreen/n-gon">Github</a> hosts the source code for n-gon.<br> It's <br>
written in JavaScript, CSS, and HTML. <a href="https://github.com/landgreen/n-gon">
<!-- <br> <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> <br>
n-gon is also hosted at <a href="https://lilgreenland.itch.io/n-gon">itch.io</a>. n-gon is also hosted at <a href="https://lilgreenland.itch.io/n-gon">itch.io</a>.
<br> <br>
<br> --> <br> -->
</div> </div>
</details> </details>
</div>
</div> </div>
<style> <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", description: "each <strong>bullet</strong> does extra chemical <strong class='color-d'>damage</strong><br>instant damage, unaffected by momentum",
have: false, //1 have: false, //1
effect: () => { //good with guns that fire many bullets at low speeds, minigun, drones, junk-bots, shotgun, superballs, wavebeam 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", 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 have: false, //7
effect: () => { //good with: drones, super balls, spore, missiles, wave beam(range), rapid fire(range), flak(range) 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", 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 have: false, //8
effect: () => { //good late game maybe? effect: () => { //good late game maybe?
b.modSpores = 0.20; b.modSpores = 0.15;
} }
}, },
{ {
@@ -150,17 +151,17 @@ const b = {
}, },
{ {
name: "high explosives", 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 have: false, //11
effect: () => { effect: () => {
b.modExplosionRadius = 1.3; b.modExplosionRadius = 1.2;
b.isModImmuneExplosion = true; b.isModImmuneExplosion = true;
} }
}, },
{ {
name: "entanglement", name: "entanglement",
description: "using your first gun reduces <strong>harm</strong><br>scales by <strong>7%</strong> for each gun in your inventory", 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 effect: () => { // good with laser-bots
b.isModEntanglement = true b.isModEntanglement = true
} }
@@ -168,15 +169,15 @@ const b = {
{ {
name: "energy transfer", name: "energy transfer",
description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done", 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 effect: () => { //good with laser, and all fields
b.modEnergySiphon = 0.2; b.modEnergySiphon = 0.18;
} }
}, },
{ {
name: "entropy transfer", name: "entropy transfer",
description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done", 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 effect: () => { //good with guns that overkill: one shot, grenade
b.modHealthDrain = 0.015; b.modHealthDrain = 0.015;
} }
@@ -184,7 +185,7 @@ const b = {
{ {
name: "overcharge", name: "overcharge",
description: "charge <strong class='color-f'>energy</strong> <strong>33%</strong> beyond your <strong>maximum</strong>", description: "charge <strong class='color-f'>energy</strong> <strong>33%</strong> beyond your <strong>maximum</strong>",
have: false, //16 have: false, //15
effect: () => { effect: () => {
mech.fieldEnergyMax = 1.33 mech.fieldEnergyMax = 1.33
} }
@@ -192,7 +193,7 @@ const b = {
{ {
name: "supersaturation", name: "supersaturation",
description: "<strong class='color-h'>heal</strong> <strong>33%</strong> beyond your <strong>max health</strong>", description: "<strong class='color-h'>heal</strong> <strong>33%</strong> beyond your <strong>max health</strong>",
have: false, //17 have: false, //16
effect: () => { effect: () => {
mech.maxHealth = 1.33 mech.maxHealth = 1.33
} }
@@ -200,7 +201,7 @@ const b = {
{ {
name: "recursive healing", name: "recursive healing",
description: "<strong class='color-h'>healing</strong> power ups are twice as effective", 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 effect: () => { // good with ablative synthesis, melee builds
b.isModRecursiveHealing = true b.isModRecursiveHealing = true
} }
@@ -208,7 +209,7 @@ const b = {
{ {
name: "mass-energy equivalence", 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%", 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: () => { effect: () => {
b.isModMassEnergy = true // used in mech.usePowerUp b.isModMassEnergy = true // used in mech.usePowerUp
} }
@@ -216,7 +217,7 @@ const b = {
{ {
name: "Bayesian inference", name: "Bayesian inference",
description: "<strong>15%</strong> chance for double <strong>power ups</strong> to drop", 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 effect: () => { // good with long term planning
b.modMoreDrops = 0.15; b.modMoreDrops = 0.15;
} }
@@ -224,7 +225,7 @@ const b = {
{ {
name: "Gauss rifle", name: "Gauss rifle",
description: "<strong>launch blocks</strong> at much higher speeds<br><em>hold onto larger blocks even after getting hit</em>", 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 effect: () => { // good with guns that run out of ammo
mech.throwChargeRate = 4; mech.throwChargeRate = 4;
mech.throwChargeMax = 150; mech.throwChargeMax = 150;
@@ -234,7 +235,7 @@ const b = {
{ {
name: "squirrel-cage rotor", name: "squirrel-cage rotor",
description: "<strong>jump</strong> higher and <strong>move</strong> faster<br>reduced <strong>harm</strong> from <strong>falling</strong> ", 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 effect: () => { // good with melee builds, content skipping builds
b.modSquirrelFx = 1.2; b.modSquirrelFx = 1.2;
mech.Fx = 0.015 * b.modSquirrelFx; mech.Fx = 0.015 * b.modSquirrelFx;
@@ -244,7 +245,7 @@ const b = {
{ {
name: "quantum immortality", name: "quantum immortality",
description: "after <strong>dying</strong>, continue in an <strong>alternate reality</strong><br><em>guns, ammo, and field are randomized</em>", 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: () => { effect: () => {
b.modIsImmortal = true; b.modIsImmortal = true;
} }
@@ -272,23 +273,6 @@ const b = {
activeGun: null, //current gun in use by player activeGun: null, //current gun in use by player
inventoryGun: 0, inventoryGun: 0,
inventory: [], //list of what guns player has // 0 starts with basic gun 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() { fire() {
if (game.mouseDown && mech.fireCDcycle < mech.cycle && (!(keys[32] || game.mouseDownRight) || mech.fieldFire) && b.inventory.length) { if (game.mouseDown && mech.fireCDcycle < mech.cycle && (!(keys[32] || game.mouseDownRight) || mech.fieldFire) && b.inventory.length) {
if (b.guns[b.activeGun].ammo > 0) { if (b.guns[b.activeGun].ammo > 0) {
@@ -362,7 +346,7 @@ const b = {
angle: dir, angle: dir,
friction: 0.5, friction: 0.5,
frictionAir: 0, 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", classType: "bullet",
collisionFilter: { collisionFilter: {
category: cat.bullet, category: cat.bullet,
@@ -609,20 +593,20 @@ const b = {
restitution: 0.5, restitution: 0.5,
angle: Math.random() * 2 * Math.PI, angle: Math.random() * 2 * Math.PI,
friction: 0, friction: 0,
frictionAir: 0.02, frictionAir: 0.025,
dmg: 1.8, //damage done in addition to the damage from momentum dmg: 2.5, //damage done in addition to the damage from momentum
classType: "bullet", classType: "bullet",
collisionFilter: { collisionFilter: {
category: cat.bullet, category: cat.bullet,
mask: cat.map | cat.mob | cat.mobBullet | cat.mobShield //no collide with body 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, minDmgSpeed: 0,
onDmg() { onDmg() {
this.endCycle = 0; //bullet ends cycle after doing damage this.endCycle = 0; //bullet ends cycle after doing damage
}, },
onEnd() {}, onEnd() {},
lookFrequency: 87 + Math.floor(47 * Math.random()), lookFrequency: 97 + Math.floor(77 * Math.random()),
do() { do() {
//find mob targets //find mob targets
if (!(game.cycle % this.lookFrequency)) { if (!(game.cycle % this.lookFrequency)) {
@@ -637,23 +621,24 @@ const b = {
if (dist < closeDist) { if (dist < closeDist) {
this.closestTarget = mob[i].position; this.closestTarget = mob[i].position;
closeDist = dist; 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 if (0.3 > Math.random()) break //doesn't always target the closest mob
} }
} }
} }
} }
//accelerate towards mobs //accelerate towards mobs
const THRUST = this.mass * 0.001 const THRUST = 0.0004
if (this.lockedOn) { if (this.lockedOn && this.lockedOn.alive) {
this.force.x -= THRUST * this.lockedOn.x this.force = Vector.mult(Vector.normalise(Vector.sub(this.position, this.lockedOn.position)), -this.mass * THRUST)
this.force.y -= THRUST * this.lockedOn.y // this.force.x -= THRUST * this.lockedOn.x
// this.force.y -= THRUST * this.lockedOn.y
} else { } else {
this.force.y += this.mass * 0.00027; //gravity this.force.y += this.mass * 0.00027; //gravity
} }
}, },
}); });
const SPEED = 19; const SPEED = 8 + 3 * Math.random();
const ANGLE = 2 * Math.PI * Math.random() const ANGLE = 2 * Math.PI * Math.random()
Matter.Body.setVelocity(bullet[bIndex], { Matter.Body.setVelocity(bullet[bIndex], {
x: SPEED * Math.cos(ANGLE), x: SPEED * Math.cos(ANGLE),
@@ -672,7 +657,7 @@ const b = {
friction: 0.05, friction: 0.05,
frictionAir: 0.0005, frictionAir: 0.0005,
restitution: 1, 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()), lookFrequency: 83 + Math.floor(41 * Math.random()),
endCycle: game.cycle + Math.floor((1080 + 360 * Math.random()) * b.isModBulletsLastLonger), endCycle: game.cycle + Math.floor((1080 + 360 * Math.random()) * b.isModBulletsLastLonger),
classType: "bullet", classType: "bullet",
@@ -761,6 +746,35 @@ const b = {
y: speed * Math.sin(dir) 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: [{ guns: [{
name: "minigun", //0 name: "minigun", //0
description: "rapidly fire a stream of small <strong>bullets</strong>", description: "rapidly fire a stream of small <strong>bullets</strong>",
@@ -842,7 +856,7 @@ const b = {
}); });
// Matter.Body.setDensity(bullet[me], 0.0001); // Matter.Body.setDensity(bullet[me], 0.0001);
bullet[me].endCycle = game.cycle + Math.floor(360 * b.isModBulletsLastLonger); 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].minDmgSpeed = 0;
bullet[me].restitution = 0.99; bullet[me].restitution = 0.99;
bullet[me].friction = 0; bullet[me].friction = 0;
@@ -878,7 +892,7 @@ const b = {
const me = bullet.length; 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] = 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].endCycle = game.cycle + Math.floor(180 * b.isModBulletsLastLonger);
bullet[me].dmg = 1 + b.modExtraDmg; bullet[me].dmg = 1;
bullet[me].do = function () { bullet[me].do = function () {
if (this.speed < 10) this.force.y += this.mass * 0.0003; //no gravity until it slows don to improve aiming 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, inertia: Infinity,
frictionAir: 0, frictionAir: 0,
minDmgSpeed: 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", classType: "bullet",
collisionFilter: { collisionFilter: {
category: cat.bullet, category: cat.bullet,
@@ -959,7 +973,7 @@ const b = {
// angle: 0, // angle: 0,
// friction: 0.5, // friction: 0.5,
frictionAir: 0, 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", classType: "bullet",
collisionFilter: { collisionFilter: {
category: 0, category: 0,
@@ -1512,7 +1526,7 @@ const b = {
Matter.Body.setVelocity(bullet[me], velocity); Matter.Body.setVelocity(bullet[me], velocity);
World.add(engine.world, bullet[me]); //add bullet to world World.add(engine.world, bullet[me]); //add bullet to world
bullet[me].endCycle = game.cycle + 60 + 15 * Math.random(); 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 () {}; bullet[me].do = function () {};
} }
} }
@@ -1524,7 +1538,7 @@ const b = {
name: "spores", //11 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", 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, ammo: 0,
ammoPack: 6, ammoPack: 10,
have: false, have: false,
isStarterGun: false, isStarterGun: false,
fire() { fire() {
@@ -1557,7 +1571,7 @@ const b = {
//spawn bullets on end //spawn bullets on end
bullet[me].onEnd = function () { bullet[me].onEnd = function () {
const NUM = 9; const NUM = 10;
for (let i = 0; i < NUM; i++) { for (let i = 0; i < NUM; i++) {
b.spore(this) b.spore(this)
} }
@@ -1593,7 +1607,7 @@ const b = {
friction: 0, friction: 0,
frictionStatic: 0, frictionStatic: 0,
restitution: 0.5 + 0.5 * Math.random(), 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, minDmgSpeed: 2,
lookFrequency: 37 + Math.floor(27 * Math.random()), lookFrequency: 37 + Math.floor(27 * Math.random()),
acceleration: 0.0015 + 0.0013 * Math.random(), acceleration: 0.0015 + 0.0013 * Math.random(),
@@ -2261,7 +2275,7 @@ const b = {
frictionAir: 0.003, frictionAir: 0.003,
friction: 0.2, friction: 0.2,
restitution: 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", classType: "bullet",
collisionFilter: { collisionFilter: {
category: cat.bullet, category: cat.bullet,
@@ -2355,7 +2369,7 @@ const b = {
// friction: 1, // friction: 1,
// // frictionAir: 1, // // frictionAir: 1,
// endCycle: game.cycle + TOTAL_CYCLES, // 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", // classType: "bullet",
// collisionFilter: { // collisionFilter: {
// category: 0x000100, // category: 0x000100,
@@ -2448,7 +2462,7 @@ const b = {
// // friction: 0.05, // // friction: 0.05,
// // frictionAir: 0.05, // // frictionAir: 0.05,
// restitution: 0.8, // 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, // lookFrequency: 3,
// endCycle: game.cycle + Math.floor(120 * b.isModBulletsLastLonger), // endCycle: game.cycle + Math.floor(120 * b.isModBulletsLastLonger),
// classType: "bullet", // classType: "bullet",

View File

@@ -197,7 +197,7 @@ function mobCollisionChecks(event) {
if (obj.classType === "body" && obj.speed > 5) { if (obj.classType === "body" && obj.speed > 5) {
const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)); const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity));
if (v > 8) { 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); mob[k].damage(dmg);
if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer(); if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer();
game.drawList.push({ game.drawList.push({

View File

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

View File

@@ -94,7 +94,7 @@ game mechanics
// local storage // local storage
let localSettings = JSON.parse(localStorage.getItem("localSettings")); let localSettings = JSON.parse(localStorage.getItem("localSettings"));
// console.log(localSettings)
if (localSettings) { if (localSettings) {
game.isBodyDamage = localSettings.isBodyDamage game.isBodyDamage = localSettings.isBodyDamage
document.getElementById("body-damage").checked = localSettings.isBodyDamage document.getElementById("body-damage").checked = localSettings.isBodyDamage
@@ -102,9 +102,12 @@ if (localSettings) {
game.difficultyMode = localSettings.difficultyMode game.difficultyMode = localSettings.difficultyMode
document.getElementById("difficulty-select").value = 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 document.getElementById("fps-select").value = localSettings.fpsCapDefault
} else { } else {
localSettings = { localSettings = {
isBodyDamage: true, isBodyDamage: true,
@@ -192,8 +195,7 @@ document.getElementById("build-button").addEventListener("click", () => {
el.style.display = "none" el.style.display = "none"
build.isShowingBuilds = false build.isShowingBuilds = false
document.body.style.overflow = "hidden" document.body.style.overflow = "hidden"
document.getElementById("controls").style.display = 'inline' document.getElementById("info").style.display = 'inline'
document.getElementById("settings").style.display = 'inline'
} else { } else {
build.list = [] 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>' // 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 build.isShowingBuilds = true
document.body.style.overflowY = "scroll"; document.body.style.overflowY = "scroll";
document.body.style.overflowX = "hidden"; document.body.style.overflowX = "hidden";
document.getElementById("controls").style.display = 'none' document.getElementById("info").style.display = 'none'
document.getElementById("settings").style.display = 'none'
} }
}); });
@@ -305,18 +306,10 @@ document.getElementById("fps-select").addEventListener("input", () => {
let value = document.getElementById("fps-select").value let value = document.getElementById("fps-select").value
if (value === 'max') { if (value === 'max') {
game.fpsCapDefault = 999999999; game.fpsCapDefault = 999999999;
} else if (value === '72') { } else {
game.fpsCapDefault = 72 game.fpsCapDefault = Number(value)
} 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
} }
localSettings.fpsCapDefault = game.fpsCapDefault localSettings.fpsCapDefault = value
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
}); });

View File

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

View File

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

View File

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

View File

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