update to mod: anthropic principle - only works once per level
  but gives 6 seconds of damage immunity and 2 extra heal power ups

most energy regeneration effects now overfill energy above the max by default
piezo electricity over fills energy by 300% (was 100%)
This commit is contained in:
landgreen
2020-11-04 05:36:50 -08:00
parent d7ab196dc3
commit a57ff0c4c1
10 changed files with 1845 additions and 1865 deletions

View File

@@ -2,57 +2,57 @@
<html> <html>
<head> <head>
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113454647-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-113454647-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag() { function gtag() {
dataLayer.push(arguments); dataLayer.push(arguments);
} }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-113454647-1'); gtag('config', 'UA-113454647-1');
</script> </script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Browser-based side scrolling video game with the matter.js physics engine."> <meta name="description" content="Browser-based side scrolling video game with the matter.js physics engine.">
<meta name="author" content="Ross Landgreen"> <meta name="author" content="Ross Landgreen">
<meta property="og:description" content="Browser-based side scrolling video game with the matter.js physics engine."> <meta property="og:description" content="Browser-based side scrolling video game with the matter.js physics engine.">
<meta property="og:title" content="n-gon"> <meta property="og:title" content="n-gon">
<meta name="twitter:title" content="n-gon"> <meta name="twitter:title" content="n-gon">
<meta name="twitter:description" content="Browser-based side scrolling video game with the matter.js physics engine."> <meta name="twitter:description" content="Browser-based side scrolling video game with the matter.js physics engine.">
<title>n-gon</title> <title>n-gon</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon' /> <link rel='shortcut icon' href='favicon.ico' type='image/x-icon' />
</head> </head>
<body> <body>
<!-- <body oncontextmenu="return false"> --> <!-- <body oncontextmenu="return false"> -->
<div id='guns'></div> <div id='guns'></div>
<div id='field'></div> <div id='field'></div>
<div id='mods'></div> <div id='mods'></div>
<div id="text-log"></div> <div id="text-log"></div>
<div id="fade-out"></div> <div id="fade-out"></div>
<div id="health-bg"></div> <div id="health-bg"></div>
<div id="health"></div> <div id="health"></div>
<div id="dmg"></div> <div id="dmg"></div>
<div id="choose-background"></div> <div id="choose-background"></div>
<div id='construct'></div> <div id='construct'></div>
<!-- contenteditable="true" --> <!-- contenteditable="true" -->
<!-- guns --> <!-- guns -->
<!-- <audio id="snare2" src="sounds\guns\snare2.ogg" preload="auto"></audio> <!-- <audio id="snare2" src="sounds\guns\snare2.ogg" preload="auto"></audio>
<audio id="airgun" src="sounds\guns\airgun.ogg" preload="auto"></audio> <audio id="airgun" src="sounds\guns\airgun.ogg" preload="auto"></audio>
<audio id="basssnaredrum" src="sounds\guns\basssnaredrum.ogg" preload="auto"></audio> <audio id="basssnaredrum" src="sounds\guns\basssnaredrum.ogg" preload="auto"></audio>
<audio id="sniper" src="sounds\guns\sniper.ogg" preload="auto"></audio> <audio id="sniper" src="sounds\guns\sniper.ogg" preload="auto"></audio>
<audio id="glock" src="sounds\guns\glock.ogg" preload="auto"></audio> <audio id="glock" src="sounds\guns\glock.ogg" preload="auto"></audio>
<audio id="launcher" src="sounds\guns\launcher2.ogg" preload="auto"></audio> --> <audio id="launcher" src="sounds\guns\launcher2.ogg" preload="auto"></audio> -->
<!-- player walk --> <!-- player walk -->
<!-- <audio id="walk1" src="sounds\mech\walk1.ogg" preload="auto"></audio> <!-- <audio id="walk1" src="sounds\mech\walk1.ogg" preload="auto"></audio>
<audio id="walk2" src="sounds\mech\walk2.ogg" preload="auto"></audio> <audio id="walk2" src="sounds\mech\walk2.ogg" preload="auto"></audio>
<audio id="walk3" src="sounds\mech\walk3.ogg" preload="auto"></audio> <audio id="walk3" src="sounds\mech\walk3.ogg" preload="auto"></audio>
<audio id="walk4" src="sounds\mech\walk4.ogg" preload="auto"></audio> <audio id="walk4" src="sounds\mech\walk4.ogg" preload="auto"></audio>
@@ -63,265 +63,265 @@
<audio id="walk9" src="sounds\mech\walk9.ogg" preload="auto"></audio> <audio id="walk9" src="sounds\mech\walk9.ogg" preload="auto"></audio>
<audio id="walk10" src="sounds\mech\walk10.ogg" preload="auto"></audio> --> <audio id="walk10" src="sounds\mech\walk10.ogg" preload="auto"></audio> -->
<!-- player dmg --> <!-- player dmg -->
<!-- <audio id="dmg0" src="sounds\dmg\dmg0.ogg" preload="auto"></audio> <!-- <audio id="dmg0" src="sounds\dmg\dmg0.ogg" preload="auto"></audio>
<audio id="dmg1" src="sounds\dmg\dmg1.ogg" preload="auto"></audio> <audio id="dmg1" src="sounds\dmg\dmg1.ogg" preload="auto"></audio>
<audio id="dmg2" src="sounds\dmg\dmg2.ogg" preload="auto"></audio> <audio id="dmg2" src="sounds\dmg\dmg2.ogg" preload="auto"></audio>
<audio id="dmg3" src="sounds\dmg\dmg3.ogg" preload="auto"></audio> --> <audio id="dmg3" src="sounds\dmg\dmg3.ogg" preload="auto"></audio> -->
<!-- other --> <!-- other -->
<!-- <audio id="boom" src="sounds\boom.ogg" preload="auto"></audio> <!-- <audio id="boom" src="sounds\boom.ogg" preload="auto"></audio>
<audio id="powerup" src="sounds\powerup4.ogg" preload="auto"></audio> <audio id="powerup" src="sounds\powerup4.ogg" preload="auto"></audio>
<audio id="no" src="sounds\no.ogg" preload="auto"></audio> <audio id="no" src="sounds\no.ogg" preload="auto"></audio>
<audio id="click" src="sounds\click.ogg" preload="auto"></audio> <audio id="click" src="sounds\click.ogg" preload="auto"></audio>
<audio id="ammo" src="sounds\ammo.ogg" preload="auto"></audio> --> <audio id="ammo" src="sounds\ammo.ogg" preload="auto"></audio> -->
<canvas id="canvas"></canvas> <canvas id="canvas"></canvas>
<!-- ********** intro page *********************************************** <!-- ********** intro page ***********************************************
******************************************************************************* --> ******************************************************************************* -->
<div id="choose-grid"></div> <div id="choose-grid"></div>
<div id="build-grid"></div> <div id="build-grid"></div>
<div style="position: absolute; top:0;left:0;"> <div style="position: absolute; top:0;left:0;">
<div id="pause-grid-left" class="pause-grid"></div> <div id="pause-grid-left" class="pause-grid"></div>
</div> </div>
<div style="position: absolute; top:0;right:0;"> <div style="position: absolute; top:0;right:0;">
<div id="pause-grid-right" class="pause-grid"></div> <div id="pause-grid-right" class="pause-grid"></div>
</div> </div>
<svg class="SVG-button" id="build-button" width="110" height="40"> <svg class="SVG-button" id="build-button" width="110" height="40">
<g stroke='none' fill='#333' stroke-width="2" font-size="28px" font-family="Arial, sans-serif"> <g stroke='none' fill='#333' stroke-width="2" font-size="28px" font-family="Arial, sans-serif">
<text x="10" y="30">custom</text> <text x="10" y="30">custom</text>
</g> </g>
</svg> </svg>
<div id='info'> <div id='info'>
<div id="settings"> <div id="settings">
<details> <details>
<summary>settings</summary> <summary>settings</summary>
<div style="line-height: 150%;" id="details-div"> <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> <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"> <select name="difficulty-select" id="difficulty-select">
<option value="1">easy</option> <option value="1">easy</option>
<option value="2" selected>normal</option> <option value="2" selected>normal</option>
<option value="4">hard</option> <option value="4">hard</option>
<option value="6">why?</option> <option value="6">why?</option>
</select> </select>
<br> <br>
<label for="community-maps" title="adds in maps written by n-gon player: Francois">include community maps:</label> <label for="community-maps" title="adds in maps written by n-gon player: Francois">include community maps:</label>
<input type="checkbox" id="community-maps" name="community-maps" style="width:17px; height:17px;"> <input type="checkbox" id="community-maps" name="community-maps" style="width:17px; height:17px;">
<!-- <br> <!-- <br>
<label for="body-damage" title="allow damage from the ground and large fast moving blocks">collision damage from blocks:</label> <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:17px; height:17px;"> --> <input type="checkbox" id="body-damage" name="body-damage" checked style="width:17px; height:17px;"> -->
<br> <br>
<label for="classic-select" title="play older versions of n-gon">classic n-gon:</label> <label for="classic-select" title="play older versions of n-gon">classic n-gon:</label>
<select name="classic-select" id="classic-select" onChange="window.location.href=this.value"> <select name="classic-select" id="classic-select" onChange="window.location.href=this.value">
<option value="https://codepen.io/lilgreenland/full/ozXNWZ" selected>9-6-2016</option> <option value="https://codepen.io/lilgreenland/full/ozXNWZ" selected>9-6-2016</option>
<option value="https://codepen.io/lilgreenland/full/wzARJY">10-2-2016</option> <option value="https://codepen.io/lilgreenland/full/wzARJY">10-2-2016</option>
<option value="classic/7-1-2017/">7-1-2017</option> <option value="classic/7-1-2017/">7-1-2017</option>
<option value="classic/1-4-2018/">1-4-2018</option> <option value="classic/1-4-2018/">1-4-2018</option>
<option value="classic/7-11-2019/">7-11-2019</option> <option value="classic/7-11-2019/">7-11-2019</option>
<option value="classic/9-8-2019/">9-8-2019</option> <option value="classic/9-8-2019/">9-8-2019</option>
</select> </select>
<br> <br>
<label for="fps-select" title="use this to slow the game down">limit frames per second:</label> <label for="fps-select" title="use this to slow the game down">limit frames per second:</label>
<select name="fps-select" id="fps-select"> <select name="fps-select" id="fps-select">
<option value="max" selected>no cap</option> <option value="max" selected>no cap</option>
<option value="72">72 fps</option> <option value="72">72 fps</option>
<option value="60">60 fps</option> <option value="60">60 fps</option>
<option value="45">45 fps</option> <option value="45">45 fps</option>
<option value="30">30 fps</option> <option value="30">30 fps</option>
</select> </select>
</div> </div>
</details> </details>
</div> </div>
<div> <div>
<details id="control-details"> <details id="control-details">
<summary>controls</summary> <summary>controls</summary>
<div id="details-div"> <div id="details-div">
To change controls click a box<br> To change controls click a box<br>
and press an unused key. and press an unused key.
<br><br> <br><br>
<table id="control-table"> <table id="control-table">
<tr> <tr>
<th>FIRE</th> <th>FIRE</th>
<td></td> <td></td>
<td class='key-used'>MouseLeft</td> <td class='key-used'>MouseLeft</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<th>FIELD</th> <th>FIELD</th>
<td id='key-field' class='key-input'>SPACE</td> <td id='key-field' class='key-input'>SPACE</td>
<td class='key-used'>MouseRight</td> <td class='key-used'>MouseRight</td>
</tr> </tr>
<tr> <tr>
<th>JUMP</th> <th>JUMP</th>
<td id='key-up' class='key-input'>W</td> <td id='key-up' class='key-input'>W</td>
<td class='key-used'>ArrowUp</td> <td class='key-used'>ArrowUp</td>
</tr> </tr>
<tr> <tr>
<th>CROUCH</th> <th>CROUCH</th>
<td id='key-down' class='key-input'>S</td> <td id='key-down' class='key-input'>S</td>
<td class='key-used'>ArrowDown</td> <td class='key-used'>ArrowDown</td>
</tr> </tr>
<tr> <tr>
<th>LEFT</th> <th>LEFT</th>
<td id='key-left' class='key-input'>A</td> <td id='key-left' class='key-input'>A</td>
<td class='key-used'>ArrowLeft</td> <td class='key-used'>ArrowLeft</td>
</tr> </tr>
<tr> <tr>
<th>RIGHT</th> <th>RIGHT</th>
<td id='key-right' class='key-input'>D</td> <td id='key-right' class='key-input'>D</td>
<td class='key-used'>ArrowRight</td> <td class='key-used'>ArrowRight</td>
</tr> </tr>
<tr> <tr>
<th>GUN →</th> <th>GUN →</th>
<td id='key-next-gun' class='key-input'>Q</td> <td id='key-next-gun' class='key-input'>Q</td>
<td class='key-used'>MouseWheel</td> <td class='key-used'>MouseWheel</td>
</tr> </tr>
<tr> <tr>
<th>GUN ←</th> <th>GUN ←</th>
<td id='key-previous-gun' class='key-input'>E</td> <td id='key-previous-gun' class='key-input'>E</td>
<td class='key-used'>MouseWheel</td> <td class='key-used'>MouseWheel</td>
</tr> </tr>
<tr> <tr>
<th>PAUSE</th> <th>PAUSE</th>
<td id='key-pause' class='key-input'>P</td> <td id='key-pause' class='key-input'>P</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<th>TESTING</th> <th>TESTING</th>
<td id='key-testing' class='key-input'>T</td> <td id='key-testing' class='key-input'>T</td>
<td></td> <td></td>
</tr> </tr>
</table> </table>
<button id="control-reset" type="button">reset</button><span style="font-size: 60%;"> to default keys</span> <button id="control-reset" type="button">reset</button><span style="font-size: 60%;"> to default keys</span>
</div> </div>
</details> </details>
</div> </div>
<div> <div>
<details> <details>
<summary>about</summary> <summary>about</summary>
<div id="details-div"> <div id="details-div">
<!-- <p> <!-- <p>
n-gon is a 2-D physics platformer / shooter n-gon is a 2-D physics platformer / shooter
<br>it has <br>it has
</p> --> </p> -->
<a href="https://discord.gg/2eC9pgJ"> <a href="https://discord.gg/2eC9pgJ">
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 235"> <svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 235">
<style> <style>
.st0 { .st0 {
fill: #1B1F23; fill: #1B1F23;
} }
</style> </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="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" /> <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> </svg>
</a> </a>
Chat about n-gon in the <a href="https://discord.gg/2eC9pgJ">discord</a>.<br> Let me know about ideas, Chat about n-gon in the <a href="https://discord.gg/2eC9pgJ">discord</a>.<br> Let me know about ideas,
or bugs. or bugs.
<br> <br>
<br> <br>
<br> <br>
<a href="https://github.com/landgreen/n-gon"> <a href="https://github.com/landgreen/n-gon">
<svg viewBox="0 0 100 16" xmlns="http://www.w3.org/2000/svg" fill="#1B1F23"> <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" /> <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"> <g stroke='none' font-size="8px" font-family="Arial Black, sans-serif">
<text x="19" y="11">Github</text> <text x="19" y="11">Github</text>
</g> </g>
</svg> </svg>
</a> </a>
<a href="https://github.com/landgreen/n-gon">Github</a> hosts the source code for n-gon.<br> It's <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. written in JavaScript, CSS, and HTML.
<!-- <br> <!-- <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> </div>
<style> <style>
.fade-in { .fade-in {
opacity: 0; opacity: 0;
animation: 4s ease 3s normal forwards 1 fadein; animation: 4s ease 3s normal forwards 1 fadein;
} }
@keyframes fadein { @keyframes fadein {
0% { 0% {
opacity: 0; opacity: 0;
} }
100% { 100% {
opacity: 1; opacity: 1;
} }
} }
@keyframes dash { @keyframes dash {
to { to {
stroke-dashoffset: 0; stroke-dashoffset: 0;
} }
} }
.draw-lines { .draw-lines {
stroke-dasharray: 20; stroke-dasharray: 20;
stroke-dashoffset: 20; stroke-dashoffset: 20;
animation: dash 4.8s ease-in forwards; animation: dash 4.8s ease-in forwards;
} }
.draw-lines-dash { .draw-lines-dash {
stroke-dasharray: 4; stroke-dasharray: 4;
stroke-dashoffset: 4; stroke-dashoffset: 4;
animation: dash 4.8s ease-in forwards; animation: dash 4.8s ease-in forwards;
} }
.draw-lines-o { .draw-lines-o {
stroke-dasharray: 11; stroke-dasharray: 11;
stroke-dashoffset: 11; stroke-dashoffset: 11;
animation: dash 4.8s ease-in forwards; animation: dash 4.8s ease-in forwards;
} }
.draw-lines-g { .draw-lines-g {
stroke-dasharray: 17; stroke-dasharray: 17;
stroke-dashoffset: 17; stroke-dashoffset: 17;
animation: dash 4.8s ease-in forwards; animation: dash 4.8s ease-in forwards;
} }
.draw-lines-box-1 { .draw-lines-box-1 {
stroke-dasharray: 1000; stroke-dasharray: 1000;
stroke-dashoffset: 1000; stroke-dashoffset: 1000;
animation: dash 10s ease-in forwards; animation: dash 10s ease-in forwards;
animation-delay: 0s; animation-delay: 0s;
} }
.draw-lines-box-2 { .draw-lines-box-2 {
stroke-dasharray: 1000; stroke-dasharray: 1000;
stroke-dashoffset: 1000; stroke-dashoffset: 1000;
animation: dash 5.2s ease-in forwards; animation: dash 5.2s ease-in forwards;
animation-delay: 2s; animation-delay: 2s;
} }
.draw-lines-box-3 { .draw-lines-box-3 {
stroke-dasharray: 1000; stroke-dasharray: 1000;
stroke-dashoffset: 1000; stroke-dashoffset: 1000;
animation: dash 2.3s ease-in forwards; animation: dash 2.3s ease-in forwards;
animation-delay: 3.1s; animation-delay: 3.1s;
} }
.draw-lines3 { .draw-lines3 {
stroke-dasharray: 3000; stroke-dasharray: 3000;
stroke-dashoffset: 3000; stroke-dashoffset: 3000;
animation: dash 6.2s ease-in forwards; animation: dash 6.2s ease-in forwards;
} }
.draw-lines4 { .draw-lines4 {
stroke-dasharray: 300; stroke-dasharray: 300;
stroke-dashoffset: 300; stroke-dashoffset: 300;
animation: dash 5s ease-in forwards; animation: dash 5s ease-in forwards;
} }
</style> </style>
<svg id='splash' class="intro" viewBox="0 0 800 800" onclick="game.startGame()"> <svg id='splash' class="intro" viewBox="0 0 800 800" onclick="game.startGame()">
<!-- title --> <!-- title -->
<!-- <g class="fade-in" transform="translate(100,210) scale(34)" fill='#bbb' stroke='none'> <!-- <g class="fade-in" transform="translate(100,210) scale(34)" fill='#bbb' stroke='none'>
<path d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" fill="rgb(50,200,255)" /> <path d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" fill="rgb(50,200,255)" />
<rect x="4" y="1.25" width="1" height="0.5" rx='0.03' /> <rect x="4" y="1.25" width="1" height="0.5" rx='0.03' />
<path transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" <path transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z"
@@ -331,136 +331,136 @@
<path transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" fill='rgb(10,220,190)' <path transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" fill='rgb(10,220,190)'
/> />
</g> --> </g> -->
<g class="fade-in" transform="translate(100,210) scale(34)" fill='#bbb' stroke='none'> <g class="fade-in" transform="translate(100,210) scale(34)" fill='#bbb' stroke='none'>
<path d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" /> <path d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" />
<rect x="4" y="1.25" width="1" height="0.5" rx='0.03' /> <rect x="4" y="1.25" width="1" height="0.5" rx='0.03' />
<path transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" /> <path transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" />
<path transform="translate(10.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v1 l -0.7 0.7 h-1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" /> <path transform="translate(10.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v1 l -0.7 0.7 h-1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" />
<path transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" /> <path transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" />
</g> </g>
<g transform="translate(100,210) scale(34)" fill='none' stroke='#222' stroke-linejoin="round" stroke-linecap="round"> <g transform="translate(100,210) scale(34)" fill='none' stroke='#222' stroke-linejoin="round" stroke-linecap="round">
<path class="draw-lines" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" stroke-width='0.0875' /> <path class="draw-lines" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" stroke-width='0.0875' />
<rect class="draw-lines-dash" x="4" y="1.25" width="1" height="0.5" stroke-width='0.0875' rx='0.03' /> <rect class="draw-lines-dash" x="4" y="1.25" width="1" height="0.5" stroke-width='0.0875' rx='0.03' />
<path class="draw-lines-g" transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" stroke-width='0.07' /> <path class="draw-lines-g" transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" stroke-width='0.07' />
<path class="draw-lines-o" transform="translate(10.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v1 l -0.7 0.7 h-1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" stroke-width='0.07' /> <path class="draw-lines-o" transform="translate(10.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v1 l -0.7 0.7 h-1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" stroke-width='0.07' />
<path class="draw-lines" transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" stroke-width='0.0875' /> <path class="draw-lines" transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" stroke-width='0.0875' />
</g> </g>
<!-- <g class="draw-lines" transform="translate(100,210) scale(34)" fill='none' stroke='#222' stroke-linejoin="round" stroke-linecap="round"> <!-- <g class="draw-lines" transform="translate(100,210) scale(34)" fill='none' stroke='#222' stroke-linejoin="round" stroke-linecap="round">
<path d="M0 0 v3.1 h1 v-1.7 h1 v1.7 h1 v-2.6 l-0.3-0.3 h-1.7 v-0.2 h-1" stroke-width='0.0875' /> <path d="M0 0 v3.1 h1 v-1.7 h1 v1.7 h1 v-2.6 l-0.3-0.3 h-1.7 v-0.2 h-1" stroke-width='0.0875' />
<rect x="4" y="1.25" width="1" height="0.5" stroke-width='0.0875' rx='0.03' /> <rect x="4" y="1.25" width="1" height="0.5" stroke-width='0.0875' rx='0.03' />
<path transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" stroke-width='0.07' /> <path transform="translate(6.9,0) scale(1.25)" d="M0 0 h1 l 0.7 0.7 v2.3 l-0.2 0.2 h-1.8 v-0.5 h1.4 L 1.1 2.4 h-1.1 l -0.7 -0.7 v-1 l 0.7 -0.7 Z" stroke-width='0.07' />
<path transform="translate(10.9,0) scale(1.25)" d="M0 0 l-0.7 0.7 v1 l0.7 0.7 h1 l0.7 -0.7 v-1 l-0.7 -0.7 h-1 Z" stroke-width='0.07' /> <path transform="translate(10.9,0) scale(1.25)" d="M0 0 l-0.7 0.7 v1 l0.7 0.7 h1 l0.7 -0.7 v-1 l-0.7 -0.7 h-1 Z" stroke-width='0.07' />
<path transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" stroke-width='0.0875' /> <path transform="translate(14,0)" d="M0 0 h1 v0.2 h1.7 l0.3 0.3 v2.6 h-1 v-1.7 h-1 v1.7 h-1 z" stroke-width='0.0875' />
</g> --> </g> -->
<!-- mouse --> <!-- mouse -->
<g class="draw-lines3" transform="translate(290,430) scale(0.28)" stroke-linecap="round" stroke-linejoin="round" stroke-width="10px" stroke="#222" fill="none"> <g class="draw-lines3" transform="translate(290,430) scale(0.28)" stroke-linecap="round" stroke-linejoin="round" stroke-width="10px" stroke="#222" fill="none">
<path class="fade-in" d="M832.41,106.64 V323.55 H651.57 V256.64 c0-82.5,67.5-150,150-150 Z" fill="rgb(0, 200, 255)" stroke="none" /> <path class="fade-in" d="M832.41,106.64 V323.55 H651.57 V256.64 c0-82.5,67.5-150,150-150 Z" fill="rgb(0, 200, 255)" stroke="none" />
<!-- <path class="fade-in" d="M832.41,106.64 V323.55 H651.57 V256.64 c0-82.5,67.5-150,150-150 Z" fill="#789" stroke="none" /> <!-- <path class="fade-in" d="M832.41,106.64 V323.55 H651.57 V256.64 c0-82.5,67.5-150,150-150 Z" fill="#789" stroke="none" />
<path class="fade-in" d="M827,112 h30 a140,140,0,0,1,140,140 v68 h-167 z" fill="#7ce" stroke="none" /> --> <path class="fade-in" d="M827,112 h30 a140,140,0,0,1,140,140 v68 h-167 z" fill="#7ce" stroke="none" /> -->
<path d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" /> <path d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" />
<path d="M657 317 h 340 h-170 v-207 s 21 -59, -5 -59 S 807 7, 807 7" /> <path d="M657 317 h 340 h-170 v-207 s 21 -59, -5 -59 S 807 7, 807 7" />
<ellipse fill="#fff" cx="827.57" cy="218.64" rx="29" ry="68" /> <ellipse fill="#fff" cx="827.57" cy="218.64" rx="29" ry="68" />
</g> </g>
<!-- keys --> <!-- keys -->
<g transform="translate(195,480) scale(0.8)"> <g transform="translate(195,480) scale(0.8)">
<g fill='none' stroke='#222' stroke-width="3.5" stroke-linejoin="round"> <g fill='none' stroke='#222' stroke-width="3.5" stroke-linejoin="round">
<path d="M0 60 h60 v-60 h-60 v60" class="draw-lines-box-1" /> <path d="M0 60 h60 v-60 h-60 v60" class="draw-lines-box-1" />
<path d="M70 60 h60 v-60 h-60 v60" class="draw-lines-box-2" /> <path d="M70 60 h60 v-60 h-60 v60" class="draw-lines-box-2" />
<path d="M140 60 h60 v-60 h-60 v60" class="draw-lines-box-3" /> <path d="M140 60 h60 v-60 h-60 v60" class="draw-lines-box-3" />
<path d="M0 70 h60 v60 h-60 v-60" class="draw-lines-box-1" /> <path d="M0 70 h60 v60 h-60 v-60" class="draw-lines-box-1" />
<path d="M70 70 h60 v60 h-60 v-60" class="draw-lines-box-2" /> <path d="M70 70 h60 v60 h-60 v-60" class="draw-lines-box-2" />
<path d="M140 70 h60 v60 h-60 v-60" class="draw-lines-box-3" /> <path d="M140 70 h60 v60 h-60 v-60" class="draw-lines-box-3" />
<!-- <rect x="0" y="0" width="60" height="60" rx='3' /> --> <!-- <rect x="0" y="0" width="60" height="60" rx='3' /> -->
<!-- <rect x="140" y="0" width="60" height="60" rx='3' /> --> <!-- <rect x="140" y="0" width="60" height="60" rx='3' /> -->
<!-- <rect x="0" y="70" width="60" height="60" rx='3' /> --> <!-- <rect x="0" y="70" width="60" height="60" rx='3' /> -->
<!-- <rect x="70" y="0" width="60" height="60" rx='3' /> --> <!-- <rect x="70" y="0" width="60" height="60" rx='3' /> -->
<!-- <rect x="70" y="70" width="60" height="60" rx='3' /> --> <!-- <rect x="70" y="70" width="60" height="60" rx='3' /> -->
<!-- <rect x="140" y="70" width="60" height="60" rx='3' /> --> <!-- <rect x="140" y="70" width="60" height="60" rx='3' /> -->
</g> </g>
<g class="draw-lines4" text-anchor="middle" stroke='#000' fill='none' stroke-width="2" font-size="38px" font-family="Arial Black, sans-serif"> <g class="draw-lines4" text-anchor="middle" stroke='#000' fill='none' stroke-width="2" font-size="38px" font-family="Arial Black, sans-serif">
<!-- <text class="fade-in" fill='#aaa' stroke="none" x="30" y="45">Q</text> <!-- <text class="fade-in" fill='#aaa' stroke="none" x="30" y="45">Q</text>
<text class="fade-in" fill='#aaa' stroke="none" x="170" y="45">E</text> --> <text class="fade-in" fill='#aaa' stroke="none" x="170" y="45">E</text> -->
<text x="30" y="45" id="splash-previous-gun" stroke-width="2">Q</text> <text x="30" y="45" id="splash-previous-gun" stroke-width="2">Q</text>
<text x="170" y="45" id="splash-next-gun" stroke-width="2">E</text> <text x="170" y="45" id="splash-next-gun" stroke-width="2">E</text>
<text x="100" y="45" id="splash-up">W</text> <text x="100" y="45" id="splash-up">W</text>
<text x="100" y="113" id="splash-down">S</text> <text x="100" y="113" id="splash-down">S</text>
<text x="30" y="113" id="splash-left">A</text> <text x="30" y="113" id="splash-left">A</text>
<text x="170" y="113" id="splash-right">D</text> <text x="170" y="113" id="splash-right">D</text>
<!-- <text class="fade-in" fill='#999' x="100" y="45">W</text> <!-- <text class="fade-in" fill='#999' x="100" y="45">W</text>
<text class="fade-in" fill='#999' x="100" y="113">S</text> <text class="fade-in" fill='#999' x="100" y="113">S</text>
<text class="fade-in" fill='#999' x="170" y="113">D</text> <text class="fade-in" fill='#999' x="170" y="113">D</text>
<text class="fade-in" fill='#999' x="30" y="113">A</text> --> <text class="fade-in" fill='#999' x="30" y="113">A</text> -->
</g> </g>
</g> </g>
<g class="fade-in" fill="none" stroke="#aaa" stroke-width="1"> <g class="fade-in" fill="none" stroke="#aaa" stroke-width="1">
<path d="M 254 433.5 h-35.5 v40" /> <path d="M 254 433.5 h-35.5 v40" />
<path d="M 295 433.5 h36.5 v40" /> <path d="M 295 433.5 h36.5 v40" />
<path d="M 274 625 v-35" /> <path d="M 274 625 v-35" />
<path d="M 430.5 442 v50 h38" /> <path d="M 430.5 442 v50 h38" />
<path d="M 612.5 442 v50 h-38" /> <path d="M 612.5 442 v50 h-38" />
</g> </g>
<g class="fade-in" stroke="none" fill="#aaa" font-size="16px"> <g class="fade-in" stroke="none" fill="#aaa" font-size="16px">
<text x="253" y="422">switch</text> <text x="253" y="422">switch</text>
<text x="257" y="438">guns</text> <text x="257" y="438">guns</text>
<text x="255" y="638">move</text> <text x="255" y="638">move</text>
<text x="420" y="438">fire</text> <text x="420" y="438">fire</text>
<text x="599" y="438">field</text> <text x="599" y="438">field</text>
</g> </g>
<g id="gamepad" transform="translate(700,700) scale(0.2)" style="display: none;" stroke="#333" stroke-width="0.5" fill="#444"> <g id="gamepad" transform="translate(700,700) scale(0.2)" style="display: none;" stroke="#333" stroke-width="0.5" fill="#444">
<path style="fill:#FB7686;" d="M122.578,86.897H68.276c-6.184,0-11.196,5.013-11.196,11.196v12.126h76.692V98.091 <path style="fill:#FB7686;" d="M122.578,86.897H68.276c-6.184,0-11.196,5.013-11.196,11.196v12.126h76.692V98.091
C133.772,91.908,128.76,86.897,122.578,86.897z" /> C133.772,91.908,128.76,86.897,122.578,86.897z" />
<rect x="57.08" y="100.766" style="opacity:0.4;fill:#FF4E64;enable-background:new ;" width="76.69" height="9.453" /> <rect x="57.08" y="100.766" style="opacity:0.4;fill:#FF4E64;enable-background:new ;" width="76.69" height="9.453" />
<path style="fill:#FB7686;" d="M389.422,86.897h54.303c6.182,0,11.194,5.013,11.194,11.196v12.126h-76.693V98.091 <path style="fill:#FB7686;" d="M389.422,86.897h54.303c6.182,0,11.194,5.013,11.194,11.196v12.126h-76.693V98.091
C378.228,91.908,383.241,86.897,389.422,86.897z" /> C378.228,91.908,383.241,86.897,389.422,86.897z" />
<rect x="378.229" y="100.766" style="opacity:0.4;fill:#FF4E64;enable-background:new ;" width="76.69" height="9.453" /> <rect x="378.229" y="100.766" style="opacity:0.4;fill:#FF4E64;enable-background:new ;" width="76.69" height="9.453" />
<rect x="101.947" y="130.449" style="fill:#89BBE4;" width="308.094" height="144.099" /> <rect x="101.947" y="130.449" style="fill:#89BBE4;" width="308.094" height="144.099" />
<path style="opacity:0.1;fill:#145587;enable-background:new ;" d="M336.726,130.443l-6.391,28.154 <path style="opacity:0.1;fill:#145587;enable-background:new ;" d="M336.726,130.443l-6.391,28.154
c-6.438,28.363-7.324,57.602-2.745,86.134H184.41c4.577-28.531,3.692-57.77-2.746-86.134l-6.39-28.154h-73.323v144.103h308.097 c-6.438,28.363-7.324,57.602-2.745,86.134H184.41c4.577-28.531,3.692-57.77-2.746-86.134l-6.39-28.154h-73.323v144.103h308.097
V130.443H336.726z" /> V130.443H336.726z" />
<g> <g>
<path style="fill:#89BBE4;" d="M168.235,158.598l-6.39-28.154c-4.031-12.081-15.338-20.226-28.073-20.226H57.08 <path style="fill:#89BBE4;" d="M168.235,158.598l-6.39-28.154c-4.031-12.081-15.338-20.226-28.073-20.226H57.08
c-4.862,0-9.582,1.835-13.034,5.259c-9.65,9.571-15.848,22.071-17.629,35.539L0.612,346.264 c-4.862,0-9.582,1.835-13.034,5.259c-9.65,9.571-15.848,22.071-17.629,35.539L0.612,346.264
c-5.519,41.762,26.979,78.838,69.103,78.838c31.406,0,58.935-21.004,67.23-51.296l27.18-99.262l0,0 c-5.519,41.762,26.979,78.838,69.103,78.838c31.406,0,58.935-21.004,67.23-51.296l27.18-99.262l0,0
C175.524,236.906,176.94,196.95,168.235,158.598z" /> C175.524,236.906,176.94,196.95,168.235,158.598z" />
<path style="fill:#89BBE4;" d="M511.387,346.264l-25.806-195.25c-1.78-13.468-7.978-25.967-17.629-35.539 <path style="fill:#89BBE4;" d="M511.387,346.264l-25.806-195.25c-1.78-13.468-7.978-25.967-17.629-35.539
c-3.452-3.424-8.172-5.259-13.034-5.259h-76.693c-12.734,0-24.041,8.146-28.072,20.226l-6.39,28.154 c-3.452-3.424-8.172-5.259-13.034-5.259h-76.693c-12.734,0-24.041,8.146-28.072,20.226l-6.39,28.154
c-8.706,38.353-7.288,78.308,4.109,115.948l0,0l27.18,99.262c8.296,30.292,35.823,51.296,67.23,51.296 c-8.706,38.353-7.288,78.308,4.109,115.948l0,0l27.18,99.262c8.296,30.292,35.823,51.296,67.23,51.296
C484.408,425.102,516.908,388.026,511.387,346.264z" /> C484.408,425.102,516.908,388.026,511.387,346.264z" />
</g> </g>
<circle style="fill:#ACDFEA;" cx="189.252" cy="285.582" r="52.611" /> <circle style="fill:#ACDFEA;" cx="189.252" cy="285.582" r="52.611" />
<circle style="opacity:0.3;fill:#145587;enable-background:new ;" cx="183.371" cy="293.273" r="25.611" /> <circle style="opacity:0.3;fill:#145587;enable-background:new ;" cx="183.371" cy="293.273" r="25.611" />
<circle style="fill:#ACDFEA;" cx="322.747" cy="285.582" r="52.611" /> <circle style="fill:#ACDFEA;" cx="322.747" cy="285.582" r="52.611" />
<circle style="opacity:0.3;fill:#145587;enable-background:new ;" cx="316.866" cy="293.273" r="25.611" /> <circle style="opacity:0.3;fill:#145587;enable-background:new ;" cx="316.866" cy="293.273" r="25.611" />
<circle style="fill:#384148;" cx="322.747" cy="285.582" r="25.611" /> <circle style="fill:#384148;" cx="322.747" cy="285.582" r="25.611" />
<g> <g>
<path style="fill:#1F84CE;" d="M108.027,142.799H86.073c-4.334,0-7.848,3.514-7.848,7.849v9.17c0,2.082,0.826,4.077,2.298,5.549 <path style="fill:#1F84CE;" d="M108.027,142.799H86.073c-4.334,0-7.848,3.514-7.848,7.849v9.17c0,2.082,0.826,4.077,2.298,5.549
l11.3,11.3c3.064,3.065,8.034,3.065,11.1,0l10.653-10.652c1.471-1.472,2.298-3.469,2.298-5.549v-9.818 l11.3,11.3c3.064,3.065,8.034,3.065,11.1,0l10.653-10.652c1.471-1.472,2.298-3.469,2.298-5.549v-9.818
C115.875,146.314,112.361,142.799,108.027,142.799z" /> C115.875,146.314,112.361,142.799,108.027,142.799z" />
<path style="fill:#1F84CE;" d="M76.951,190.893l-10.653-10.652c-1.472-1.472-3.468-2.3-5.549-2.3h-9.818 <path style="fill:#1F84CE;" d="M76.951,190.893l-10.653-10.652c-1.472-1.472-3.468-2.3-5.549-2.3h-9.818
c-4.334,0-7.849,3.514-7.849,7.849v21.953c0,4.335,3.514,7.849,7.849,7.849h9.17c2.082,0,4.077-0.828,5.549-2.3l11.302-11.3 c-4.334,0-7.849,3.514-7.849,7.849v21.953c0,4.335,3.514,7.849,7.849,7.849h9.17c2.082,0,4.077-0.828,5.549-2.3l11.302-11.3
C80.016,198.929,80.016,193.96,76.951,190.893z" /> C80.016,198.929,80.016,193.96,76.951,190.893z" />
<path style="fill:#1F84CE;" d="M113.576,228.168l-11.3-11.3c-3.065-3.065-8.034-3.065-11.1,0l-10.653,10.652 <path style="fill:#1F84CE;" d="M113.576,228.168l-11.3-11.3c-3.065-3.065-8.034-3.065-11.1,0l-10.653,10.652
c-1.472,1.472-2.298,3.468-2.298,5.55v9.817c0,4.334,3.514,7.848,7.849,7.848h21.953c4.334,0,7.849-3.513,7.849-7.848v-9.171 c-1.472,1.472-2.298,3.468-2.298,5.55v9.817c0,4.334,3.514,7.848,7.849,7.848h21.953c4.334,0,7.849-3.513,7.849-7.848v-9.171
C115.875,231.636,115.048,229.64,113.576,228.168z" /> C115.875,231.636,115.048,229.64,113.576,228.168z" />
<path style="fill:#1F84CE;" d="M143.169,177.943h-9.171c-2.081,0-4.077,0.826-5.549,2.298l-11.3,11.3 <path style="fill:#1F84CE;" d="M143.169,177.943h-9.171c-2.081,0-4.077,0.826-5.549,2.298l-11.3,11.3
c-3.064,3.064-3.064,8.034,0,11.1l10.653,10.653c1.472,1.471,3.468,2.298,5.55,2.298h9.818c4.334,0,7.848-3.513,7.848-7.848 c-3.064,3.064-3.064,8.034,0,11.1l10.653,10.653c1.472,1.471,3.468,2.298,5.55,2.298h9.818c4.334,0,7.848-3.513,7.848-7.848
v-21.953C151.018,181.457,147.504,177.943,143.169,177.943z" /> v-21.953C151.018,181.457,147.504,177.943,143.169,177.943z" />
<circle style="fill:#1F84CE;" cx="414.952" cy="155.839" r="18.825" /> <circle style="fill:#1F84CE;" cx="414.952" cy="155.839" r="18.825" />
</g> </g>
<circle style="fill:#F9C526;" cx="374.025" cy="196.766" r="18.825" /> <circle style="fill:#F9C526;" cx="374.025" cy="196.766" r="18.825" />
<circle style="fill:#54B8AC;" cx="414.952" cy="237.693" r="18.825" /> <circle style="fill:#54B8AC;" cx="414.952" cy="237.693" r="18.825" />
<circle style="fill:#FFFFFF;" cx="455.879" cy="196.766" r="18.825" /> <circle style="fill:#FFFFFF;" cx="455.879" cy="196.766" r="18.825" />
<circle style="fill:#384148;" cx="189.252" cy="285.582" r="25.611" /> <circle style="fill:#384148;" cx="189.252" cy="285.582" r="25.611" />
<g> <g>
<path style="fill:#FFFFFF;" d="M226.267,190.234h-23.773c-4.57,0-8.276-3.705-8.276-8.276s3.705-8.276,8.276-8.276h23.773 <path style="fill:#FFFFFF;" d="M226.267,190.234h-23.773c-4.57,0-8.276-3.705-8.276-8.276s3.705-8.276,8.276-8.276h23.773
c4.57,0,8.276,3.705,8.276,8.276S230.838,190.234,226.267,190.234z" /> c4.57,0,8.276,3.705,8.276,8.276S230.838,190.234,226.267,190.234z" />
<path style="fill:#FFFFFF;" d="M309.506,190.234h-23.773c-4.572,0-8.276-3.705-8.276-8.276s3.704-8.276,8.276-8.276h23.773 <path style="fill:#FFFFFF;" d="M309.506,190.234h-23.773c-4.572,0-8.276-3.705-8.276-8.276s3.704-8.276,8.276-8.276h23.773
c4.572,0,8.276,3.705,8.276,8.276S314.077,190.234,309.506,190.234z" /> c4.572,0,8.276,3.705,8.276,8.276S314.077,190.234,309.506,190.234z" />
</g> </g>
</g> </g>
<!-- <g id="gamepad" transform="translate(640,640) scale(0.3)" style="display: none;" stroke="#333" stroke-width="0.5" fill="#444"> <!-- <g id="gamepad" transform="translate(640,640) scale(0.3)" style="display: none;" stroke="#333" stroke-width="0.5" fill="#444">
<path d="M115.824,187.891c-2.95,2.95-4.576,6.872-4.576,11.045c0,4.172,1.625,8.095,4.575,11.045l10.322,10.322 <path d="M115.824,187.891c-2.95,2.95-4.576,6.872-4.576,11.045c0,4.172,1.625,8.095,4.575,11.045l10.322,10.322
c2.95,2.949,6.872,4.573,11.042,4.573h9.511c8.612,0,15.619-7.007,15.619-15.619v-21.268c0-8.612-7.007-15.619-15.619-15.619 c2.95,2.949,6.872,4.573,11.042,4.573h9.511c8.612,0,15.619-7.007,15.619-15.619v-21.268c0-8.612-7.007-15.619-15.619-15.619
h-8.884c-4.171,0-8.093,1.625-11.044,4.575L115.824,187.891z M137.986,188.403h8.298v20.438h-8.926l-9.905-9.906L137.986,188.403 h-8.884c-4.171,0-8.093,1.625-11.044,4.575L115.824,187.891z M137.986,188.403h8.298v20.438h-8.926l-9.905-9.906L137.986,188.403
@@ -529,7 +529,7 @@
C399.76,153.343,404.345,148.758,409.979,148.758z" /> C399.76,153.343,404.345,148.758,409.979,148.758z" />
</g> --> </g> -->
<!-- <g id="gamepad" transform="translate(640,640) scale(2)" style="display: none;"> <!-- <g id="gamepad" transform="translate(640,640) scale(2)" style="display: none;">
<path d="M44.3,49.8v-3.7c0-0.3-0.1-0.5-0.3-0.7s-0.4-0.3-0.7-0.3h-5.5v-5.5c0-0.3-0.1-0.5-0.3-0.7 <path d="M44.3,49.8v-3.7c0-0.3-0.1-0.5-0.3-0.7s-0.4-0.3-0.7-0.3h-5.5v-5.5c0-0.3-0.1-0.5-0.3-0.7
s-0.4-0.3-0.7-0.3h-3.7c-0.3,0-0.5,0.1-0.7,0.3s-0.3,0.4-0.3,0.7v5.5h-5.5c-0.3,0-0.5,0.1-0.7,0.3S26,45.9,26,46.2v3.7 s-0.4-0.3-0.7-0.3h-3.7c-0.3,0-0.5,0.1-0.7,0.3s-0.3,0.4-0.3,0.7v5.5h-5.5c-0.3,0-0.5,0.1-0.7,0.3S26,45.9,26,46.2v3.7
c0,0.3,0.1,0.5,0.3,0.7s0.4,0.3,0.7,0.3h5.5v5.5c0,0.3,0.1,0.5,0.3,0.7s0.4,0.3,0.7,0.3H37c0.3,0,0.5-0.1,0.7-0.3s0.3-0.4,0.3-0.7 c0,0.3,0.1,0.5,0.3,0.7s0.4,0.3,0.7,0.3h5.5v5.5c0,0.3,0.1,0.5,0.3,0.7s0.4,0.3,0.7,0.3H37c0.3,0,0.5-0.1,0.7-0.3s0.3-0.4,0.3-0.7
@@ -540,22 +540,22 @@
c-2.9,2.9-6.3,4.3-10.4,4.3c-3.7,0-6.9-1.2-9.7-3.7h-6.3c-2.8,2.4-6,3.7-9.7,3.7c-4,0-7.5-1.4-10.4-4.3c-2.9-2.9-4.3-6.3-4.3-10.4 c-2.9,2.9-6.3,4.3-10.4,4.3c-3.7,0-6.9-1.2-9.7-3.7h-6.3c-2.8,2.4-6,3.7-9.7,3.7c-4,0-7.5-1.4-10.4-4.3c-2.9-2.9-4.3-6.3-4.3-10.4
s1.4-7.5,4.3-10.4c2.9-2.9,6.3-4.3,10.4-4.3h25.7c4,0,7.5,1.4,10.4,4.3C74.1,40.5,75.5,44,75.5,48z" fill="#888" stroke="#222" /> s1.4-7.5,4.3-10.4c2.9-2.9,6.3-4.3,10.4-4.3h25.7c4,0,7.5,1.4,10.4,4.3C74.1,40.5,75.5,44,75.5,48z" fill="#888" stroke="#222" />
</g> --> </g> -->
</svg> </svg>
<script src='lib/matter.min.js'></script> <script src='lib/matter.min.js'></script>
<script src='lib/decomp.min.js'></script> <script src='lib/decomp.min.js'></script>
<script src='lib/randomColor.min.js'></script> <script src='lib/randomColor.min.js'></script>
<script src="js/game.js"></script> <script src="js/game.js"></script>
<script src="js/player.js"></script> <script src="js/player.js"></script>
<script src="js/powerup.js"></script> <script src="js/powerup.js"></script>
<script src="js/mods.js"></script> <script src="js/mods.js"></script>
<script src="js/bullet.js"></script> <script src="js/bullet.js"></script>
<script src="js/mob.js"></script> <script src="js/mob.js"></script>
<script src="js/spawn.js"></script> <script src="js/spawn.js"></script>
<script src="js/level.js"></script> <script src="js/level.js"></script>
<script src="js/visibility.js"></script> <script src="js/visibility.js"></script>
<script src="js/engine.js"></script> <script src="js/engine.js"></script>
<script src="js/index.js"></script> <script src="js/index.js"></script>
</body> </body>
</html> </html>

View File

@@ -3223,6 +3223,7 @@ const b = {
ctx.stroke(); ctx.stroke();
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
} else if (mod.beamSplitter) { } else if (mod.beamSplitter) {
const divergence = mech.crouch ? 0.15 : 0.2
let dmg = mod.laserDamage * 0.9 let dmg = mod.laserDamage * 0.9
const where = { const where = {
x: mech.pos.x + 20 * Math.cos(mech.angle), x: mech.pos.x + 20 * Math.cos(mech.angle),
@@ -3234,12 +3235,12 @@ const b = {
}, dmg) }, dmg)
for (let i = 1; i < 1 + mod.beamSplitter; i++) { for (let i = 1; i < 1 + mod.beamSplitter; i++) {
b.laser(where, { b.laser(where, {
x: where.x + 3000 * Math.cos(mech.angle + i * 0.2), x: where.x + 3000 * Math.cos(mech.angle + i * divergence),
y: where.y + 3000 * Math.sin(mech.angle + i * 0.2) y: where.y + 3000 * Math.sin(mech.angle + i * divergence)
}, dmg) }, dmg)
b.laser(where, { b.laser(where, {
x: where.x + 3000 * Math.cos(mech.angle - i * 0.2), x: where.x + 3000 * Math.cos(mech.angle - i * divergence),
y: where.y + 3000 * Math.sin(mech.angle - i * 0.2) y: where.y + 3000 * Math.sin(mech.angle - i * divergence)
}, dmg) }, dmg)
dmg *= 0.9 dmg *= 0.9
} }

View File

@@ -1,16 +1,16 @@
//matter.js *********************************************************** //matter.js ***********************************************************
// module aliases // module aliases
const Engine = Matter.Engine, const Engine = Matter.Engine,
World = Matter.World, World = Matter.World,
Events = Matter.Events, Events = Matter.Events,
Composites = Matter.Composites, Composites = Matter.Composites,
Composite = Matter.Composite, Composite = Matter.Composite,
Constraint = Matter.Constraint, Constraint = Matter.Constraint,
Vertices = Matter.Vertices, Vertices = Matter.Vertices,
Query = Matter.Query, Query = Matter.Query,
Body = Matter.Body, Body = Matter.Body,
Bodies = Matter.Bodies, Bodies = Matter.Bodies,
Vector = Matter.Vector; Vector = Matter.Vector;
// create an engine // create an engine
const engine = Engine.create(); const engine = Engine.create();
@@ -21,38 +21,38 @@ engine.world.gravity.scale = 0; //turn off gravity (it's added back in later)
// matter events // matter events
function playerOnGroundCheck(event) { function playerOnGroundCheck(event) {
//runs on collisions events //runs on collisions events
function enter() { function enter() {
mech.numTouching++; mech.numTouching++;
if (!mech.onGround) mech.enterLand(); if (!mech.onGround) mech.enterLand();
}
const pairs = event.pairs;
for (let i = 0, j = pairs.length; i != j; ++i) {
let pair = pairs[i];
if (pair.bodyA === jumpSensor) {
mech.standingOn = pair.bodyB; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter();
} else if (pair.bodyB === jumpSensor) {
mech.standingOn = pair.bodyA; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter();
} }
} const pairs = event.pairs;
mech.numTouching = 0; for (let i = 0, j = pairs.length; i != j; ++i) {
let pair = pairs[i];
if (pair.bodyA === jumpSensor) {
mech.standingOn = pair.bodyB; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter();
} else if (pair.bodyB === jumpSensor) {
mech.standingOn = pair.bodyA; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter();
}
}
mech.numTouching = 0;
} }
function playerOffGroundCheck(event) { function playerOffGroundCheck(event) {
//runs on collisions events //runs on collisions events
function enter() { function enter() {
if (mech.onGround && mech.numTouching === 0) mech.enterAir(); if (mech.onGround && mech.numTouching === 0) mech.enterAir();
} }
const pairs = event.pairs; const pairs = event.pairs;
for (let i = 0, j = pairs.length; i != j; ++i) { for (let i = 0, j = pairs.length; i != j; ++i) {
if (pairs[i].bodyA === jumpSensor) { if (pairs[i].bodyA === jumpSensor) {
enter(); enter();
} else if (pairs[i].bodyB === jumpSensor) { } else if (pairs[i].bodyB === jumpSensor) {
enter(); enter();
}
} }
}
} }
// function playerHeadCheck(event) { // function playerHeadCheck(event) {
@@ -71,158 +71,158 @@ function playerOffGroundCheck(event) {
// } // }
function collisionChecks(event) { function collisionChecks(event) {
const pairs = event.pairs; const pairs = event.pairs;
for (let i = 0, j = pairs.length; i != j; i++) { for (let i = 0, j = pairs.length; i != j; i++) {
// //map + bullet collisions // //map + bullet collisions
// if (pairs[i].bodyA.collisionFilter.category === cat.map && pairs[i].bodyB.collisionFilter.category === cat.bullet) { // if (pairs[i].bodyA.collisionFilter.category === cat.map && pairs[i].bodyB.collisionFilter.category === cat.bullet) {
// collideBulletStatic(pairs[i].bodyB) // collideBulletStatic(pairs[i].bodyB)
// } else if (pairs[i].bodyB.collisionFilter.category === cat.map && pairs[i].bodyA.collisionFilter.category === cat.bullet) { // } else if (pairs[i].bodyB.collisionFilter.category === cat.map && pairs[i].bodyA.collisionFilter.category === cat.bullet) {
// collideBulletStatic(pairs[i].bodyA) // collideBulletStatic(pairs[i].bodyA)
// } // }
// //triggers when the bullets hits something static // //triggers when the bullets hits something static
// function collideBulletStatic(obj, speedThreshold = 12, massThreshold = 2) { // function collideBulletStatic(obj, speedThreshold = 12, massThreshold = 2) {
// if (obj.onWallHit) obj.onWallHit(); // if (obj.onWallHit) obj.onWallHit();
// } // }
// function collidePlayer(obj) { // function collidePlayer(obj) {
// //player dmg from hitting a body // //player dmg from hitting a body
// if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) { // if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) {
// const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26) // const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26)
// if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference // if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference
// const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity)) // const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity))
// if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold) // if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold)
// } else { //block is below player only look at horizontal momentum difference // } else { //block is below player only look at horizontal momentum difference
// const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x) // const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x)
// if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold) // if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold)
// } // }
// function hit(dmg) { // function hit(dmg) {
// mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles // mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
// dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15); // dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15);
// mech.damage(dmg); // mech.damage(dmg);
// game.drawList.push({ //add dmg to draw queue // game.drawList.push({ //add dmg to draw queue
// x: pairs[i].activeContacts[0].vertex.x, // x: pairs[i].activeContacts[0].vertex.x,
// y: pairs[i].activeContacts[0].vertex.y, // y: pairs[i].activeContacts[0].vertex.y,
// radius: dmg * 500, // radius: dmg * 500,
// color: game.mobDmgColor, // color: game.mobDmgColor,
// time: game.drawTime // time: game.drawTime
// }); // });
// } // }
// } // }
// } // }
//mob + (player,bullet,body) collisions //mob + (player,bullet,body) collisions
for (let k = 0; k < mob.length; k++) { for (let k = 0; k < mob.length; k++) {
if (mob[k].alive && mech.alive) { if (mob[k].alive && mech.alive) {
if (pairs[i].bodyA === mob[k]) { if (pairs[i].bodyA === mob[k]) {
collideMob(pairs[i].bodyB); collideMob(pairs[i].bodyB);
break; break;
} else if (pairs[i].bodyB === mob[k]) { } else if (pairs[i].bodyB === mob[k]) {
collideMob(pairs[i].bodyA); collideMob(pairs[i].bodyA);
break; break;
} }
function collideMob(obj) { function collideMob(obj) {
//player + mob collision //player + mob collision
if ( if (
mech.immuneCycle < mech.cycle && mech.immuneCycle < mech.cycle &&
(obj === playerBody || obj === playerHead) && (obj === playerBody || obj === playerHead) &&
!(mod.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned)) !(mod.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned))
) { ) {
mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
mob[k].foundPlayer(); mob[k].foundPlayer();
let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0 let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * game.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0
if (mod.isPiezo) mech.energy = mech.maxEnergy; if (mod.isPiezo && mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3
mech.damage(dmg); mech.damage(dmg);
if (mod.isBayesian) powerUps.ejectMod() if (mod.isBayesian) powerUps.ejectMod()
if (mob[k].onHit) mob[k].onHit(k); if (mob[k].onHit) mob[k].onHit(k);
//extra kick between player and mob //this section would be better with forces but they don't work... //extra kick between player and mob //this section would be better with forces but they don't work...
let angle = Math.atan2(player.position.y - mob[k].position.y, player.position.x - mob[k].position.x); let angle = Math.atan2(player.position.y - mob[k].position.y, player.position.x - mob[k].position.x);
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x + 8 * Math.cos(angle), x: player.velocity.x + 8 * Math.cos(angle),
y: player.velocity.y + 8 * Math.sin(angle) y: player.velocity.y + 8 * Math.sin(angle)
}); });
Matter.Body.setVelocity(mob[k], { Matter.Body.setVelocity(mob[k], {
x: mob[k].velocity.x - 8 * Math.cos(angle), x: mob[k].velocity.x - 8 * Math.cos(angle),
y: mob[k].velocity.y - 8 * Math.sin(angle) y: mob[k].velocity.y - 8 * Math.sin(angle)
}); });
if (mod.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mech.energy > 0.34 * mech.maxEnergy) { if (mod.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mech.energy > 0.34 * mech.maxEnergy) {
mech.energy -= 0.33 * mech.maxEnergy mech.energy -= 0.33 * mech.maxEnergy
mech.immuneCycle = 0; //player doesn't go immune to collision damage mech.immuneCycle = 0; //player doesn't go immune to collision damage
mob[k].death(); mob[k].death();
game.drawList.push({ //add dmg to draw queue game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x, x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y, y: pairs[i].activeContacts[0].vertex.y,
radius: dmg * 2000, radius: dmg * 2000,
color: "rgba(255,0,255,0.2)", color: "rgba(255,0,255,0.2)",
time: game.drawTime time: game.drawTime
}); });
} else { } else {
game.drawList.push({ //add dmg to draw queue game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x, x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y, y: pairs[i].activeContacts[0].vertex.y,
radius: dmg * 500, radius: dmg * 500,
color: game.mobDmgColor, color: game.mobDmgColor,
time: game.drawTime time: game.drawTime
}); });
}
return;
// }
}
//mob + bullet collisions
if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) {
obj.beforeDmg(mob[k]); //some bullets do actions when they hits things, like despawn //forces don't seem to work here
let dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
if (mod.isCrit && mob[k].isStunned) dmg *= 4
mob[k].foundPlayer();
mob[k].damage(dmg);
game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y,
radius: Math.log(2 * dmg + 1.1) * 40,
color: game.playerDmgColor,
time: game.drawTime
});
return;
}
//mob + body collisions
if (obj.classType === "body" && obj.speed > 6) {
const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity));
if (v > 9) {
let dmg = 0.05 * b.dmgScale * v * obj.mass * mod.throwChargeRate;
if (mob[k].isShielded) dmg *= 0.35
mob[k].damage(dmg, true);
const stunTime = dmg / Math.sqrt(obj.mass)
if (stunTime > 0.5) mobs.statusStun(mob[k], 30 + 60 * Math.sqrt(stunTime))
if (mob[k].distanceToPlayer2() < 1000000 && !mech.isCloak) mob[k].foundPlayer();
game.drawList.push({
x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y,
radius: Math.log(2 * dmg + 1.1) * 40,
color: game.playerDmgColor,
time: game.drawTime
});
return;
}
}
}
} }
return;
// }
}
//mob + bullet collisions
if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) {
obj.beforeDmg(mob[k]); //some bullets do actions when they hits things, like despawn //forces don't seem to work here
let dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
if (mod.isCrit && mob[k].isStunned) dmg *= 4
mob[k].foundPlayer();
mob[k].damage(dmg);
game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y,
radius: Math.log(2 * dmg + 1.1) * 40,
color: game.playerDmgColor,
time: game.drawTime
});
return;
}
//mob + body collisions
if (obj.classType === "body" && obj.speed > 6) {
const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity));
if (v > 9) {
let dmg = 0.05 * b.dmgScale * v * obj.mass * mod.throwChargeRate;
if (mob[k].isShielded) dmg *= 0.35
mob[k].damage(dmg, true);
const stunTime = dmg / Math.sqrt(obj.mass)
if (stunTime > 0.5) mobs.statusStun(mob[k], 30 + 60 * Math.sqrt(stunTime))
if (mob[k].distanceToPlayer2() < 1000000 && !mech.isCloak) mob[k].foundPlayer();
game.drawList.push({
x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y,
radius: Math.log(2 * dmg + 1.1) * 40,
color: game.playerDmgColor,
time: game.drawTime
});
return;
}
}
} }
}
} }
}
} }
//determine if player is on the ground //determine if player is on the ground
Events.on(engine, "collisionStart", function (event) { Events.on(engine, "collisionStart", function(event) {
playerOnGroundCheck(event); playerOnGroundCheck(event);
// playerHeadCheck(event); // playerHeadCheck(event);
collisionChecks(event); collisionChecks(event);
}); });
Events.on(engine, "collisionActive", function (event) { Events.on(engine, "collisionActive", function(event) {
playerOnGroundCheck(event); playerOnGroundCheck(event);
// playerHeadCheck(event); // playerHeadCheck(event);
}); });
Events.on(engine, "collisionEnd", function (event) { Events.on(engine, "collisionEnd", function(event) {
playerOffGroundCheck(event); playerOffGroundCheck(event);
}); });

View File

@@ -499,6 +499,7 @@ const game = {
mech.spawn(); //spawns the player mech.spawn(); //spawns the player
level.levels = level.playableLevels.slice(0) //copy array, not by just by assignment
if (game.isCommunityMaps) { if (game.isCommunityMaps) {
level.levels.push("stronghold"); level.levels.push("stronghold");
level.levels.push("basement"); level.levels.push("basement");
@@ -681,26 +682,10 @@ const game = {
checks() { checks() {
if (!(mech.cycle % 60)) { //once a second if (!(mech.cycle % 60)) { //once a second
//every second energy above max energy loses 25% //energy overfill
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy + (mech.energy - mech.maxEnergy) * 0.75 if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy + (mech.energy - mech.maxEnergy) * 0.8 //every second energy above max energy loses 25%
if (mech.pos.y > game.fallHeight) { // if 4000px deep if (mech.pos.y > game.fallHeight) { // if 4000px deep
// Matter.Body.setPosition(player, {
// x: player.position.x,
// y: level.enter.y - 5000
// });
// mech.pos.x = player.position.x;
// mech.pos.y = playerBody.position.y - mech.yOff;
// const scale = 0.8;
// const velocityScale = 12
// mech.transSmoothX = canvas.width2 - mech.pos.x - (game.mouse.x - canvas.width2) * scale + player.velocity.x * velocityScale;
// mech.transSmoothY = canvas.height2 - mech.pos.y - (game.mouse.y - canvas.height2) * scale + player.velocity.y * velocityScale;
// mech.transX += (mech.transSmoothX - mech.transX) * 1;
// mech.transY += (mech.transSmoothY - mech.transY) * 1;
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: 0, x: 0,
y: 0 y: 0
@@ -738,7 +723,7 @@ const game = {
// } // }
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
if (mod.isEnergyRecovery && mech.energy < mech.maxEnergy) mech.energy += mech.maxEnergy * 0.06 if (mod.isEnergyRecovery) mech.energy += mech.maxEnergy * 0.05
if (mod.isHealthRecovery) mech.addHealth(0.01) if (mod.isHealthRecovery) mech.addHealth(0.01)
} }

View File

@@ -8,7 +8,8 @@ const level = {
onLevel: -1, onLevel: -1,
levelsCleared: 0, levelsCleared: 0,
bossKilled: false, bossKilled: false,
levels: ["skyscrapers", "rooftops", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"], playableLevels: ["skyscrapers", "rooftops", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"],
levels: [],
start() { start() {
if (level.levelsCleared === 0) { //this code only runs on the first level if (level.levelsCleared === 0) { //this code only runs on the first level
// level.difficultyIncrease(8) // level.difficultyIncrease(8)
@@ -17,7 +18,7 @@ const level = {
// game.setZoom(); // game.setZoom();
// mech.isCloak = true; // mech.isCloak = true;
// mech.setField("wormhole") // mech.setField("wormhole")
// b.giveGuns("grenades") // b.giveGuns("laser")
// for (let i = 0; i < 10; i++) { // for (let i = 0; i < 10; i++) {
// mod.giveMod("laser-bot"); // mod.giveMod("laser-bot");
// } // }
@@ -3796,26 +3797,19 @@ const level = {
} }
}, },
nextLevel() { nextLevel() {
if (level.bossKilled) { if (level.bossKilled) level.levelsCleared++;
level.levelsCleared++;
// level.levels.unshift("gauntlet"); //add bosses level to the end of the randomized levels list
// level.levels.unshift("finalBoss"); //add bosses level to the end of the randomized levels list
}
level.difficultyIncrease(game.difficultyMode) //increase difficulty based on modes level.difficultyIncrease(game.difficultyMode) //increase difficulty based on modes
if (level.levelsCleared > level.levels.length) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length) level.difficultyIncrease(game.difficultyMode)
if (level.levelsCleared > level.levels.length * 1.25) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length * 1.25) level.difficultyIncrease(game.difficultyMode)
if (level.levelsCleared > level.levels.length * 1.5) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length * 1.5) level.difficultyIncrease(game.difficultyMode)
if (level.levelsCleared > level.levels.length * 2) level.difficultyIncrease(game.difficultyMode) if (level.levelsCleared > level.levels.length * 2) level.difficultyIncrease(game.difficultyMode)
level.onLevel++; //cycles map to next level level.onLevel++; //cycles map to next level
if (level.onLevel > level.levels.length - 1) level.onLevel = 0; if (level.onLevel > level.levels.length - 1) level.onLevel = 0;
//reset lost mod display //reset lost mod display
for (let i = 0; i < mod.mods.length; i++) { for (let i = 0; i < mod.mods.length; i++) {
if (mod.mods[i].isLost) mod.mods[i].isLost = false; if (mod.mods[i].isLost) mod.mods[i].isLost = false;
} }
mod.isDeathAvoidedThisLevel = false;
game.updateModHUD(); game.updateModHUD();
game.clearNow = true; //triggers in game.clearMap to remove all physics bodies and setup for new map game.clearNow = true; //triggers in game.clearMap to remove all physics bodies and setup for new map
}, },

2250
js/mob.js

File diff suppressed because it is too large Load Diff

View File

@@ -92,7 +92,7 @@ const mod = {
if (mod.restDamage > 1 && player.speed < 1) dmg *= mod.restDamage if (mod.restDamage > 1 && player.speed < 1) dmg *= mod.restDamage
if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5; if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5;
if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038 if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038
if (mod.isRerollDamage) dmg *= 1 + 0.06 * powerUps.reroll.rerolls if (mod.isRerollDamage) dmg *= 1 + 0.05 * powerUps.reroll.rerolls
if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25 if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25
if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5 if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5
return dmg * mod.slowFire * mod.aimDamage return dmg * mod.slowFire * mod.aimDamage
@@ -245,7 +245,7 @@ const mod = {
}, },
{ {
name: "perturbation theory", name: "perturbation theory",
description: "increase <strong class='color-d'>damage</strong> by <strong>6%</strong><br>for each of your <strong class='color-r'>rerolls</strong>", description: "increase <strong class='color-d'>damage</strong> by <strong>5%</strong><br>for each of your <strong class='color-r'>rerolls</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -934,7 +934,7 @@ const mod = {
}, },
{ {
name: "piezoelectricity", name: "piezoelectricity",
description: "<strong>colliding</strong> with mobs fills your <strong class='color-f'>energy</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>", description: "<strong>colliding</strong> with mobs overfills <strong class='color-f'>energy</strong> by <strong>300%</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -943,7 +943,7 @@ const mod = {
requires: "not mass-energy equivalence", requires: "not mass-energy equivalence",
effect() { effect() {
mod.isPiezo = true; mod.isPiezo = true;
mech.energy = mech.maxEnergy; if (mech.energy < mech.maxEnergy * 3) mech.energy = mech.maxEnergy * 3;
}, },
remove() { remove() {
mod.isPiezo = false; mod.isPiezo = false;
@@ -1042,7 +1042,7 @@ const mod = {
}, },
{ {
name: "energy conservation", name: "energy conservation",
description: "<strong>10%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>", description: "<strong>7%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -1050,7 +1050,7 @@ const mod = {
}, },
requires: "", requires: "",
effect() { effect() {
mod.energySiphon += 0.1; mod.energySiphon += 0.07;
}, },
remove() { remove() {
mod.energySiphon = 0; mod.energySiphon = 0;
@@ -1058,7 +1058,7 @@ const mod = {
}, },
{ {
name: "waste energy recovery", name: "waste energy recovery",
description: "if a mob has <strong>died</strong> in the last <strong>5 seconds</strong><br>regen <strong>6%</strong> of max <strong class='color-f'>energy</strong> every second", description: "if a mob has <strong>died</strong> in the last <strong>5 seconds</strong><br>regen <strong>5%</strong> of max <strong class='color-f'>energy</strong> every second",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1182,7 +1182,7 @@ const mod = {
powerUps.reroll.changeRerolls(0) powerUps.reroll.changeRerolls(0)
}, 1000); }, 1000);
}, },
description: "instead of <strong>dying</strong> consume a <strong class='color-r'>reroll</strong><br>and spawn <strong>4</strong> <strong class='color-h'>heal</strong> power ups", description: "consume a <strong class='color-r'>reroll</strong> to avoid <strong>dying</strong> once a level <br>and spawn <strong>6</strong> <strong class='color-h'>heal</strong> power ups",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1191,6 +1191,7 @@ const mod = {
requires: "at least 1 reroll", requires: "at least 1 reroll",
effect() { effect() {
mod.isDeathAvoid = true; mod.isDeathAvoid = true;
mod.isDeathAvoidedThisLevel = false;
setTimeout(function() { setTimeout(function() {
powerUps.reroll.changeRerolls(0) powerUps.reroll.changeRerolls(0)
}, 1000); }, 1000);
@@ -2432,7 +2433,7 @@ const mod = {
} }
}, },
{ {
name: "beam splitter", name: "diffraction grating",
description: `your <strong>laser</strong> gains <strong>2 diverging</strong> beams<br>decrease laser <strong class='color-d'>damage</strong> by <strong>10%</strong>`, description: `your <strong>laser</strong> gains <strong>2 diverging</strong> beams<br>decrease laser <strong class='color-d'>damage</strong> by <strong>10%</strong>`,
maxCount: 9, maxCount: 9,
count: 0, count: 0,
@@ -3098,6 +3099,7 @@ const mod = {
isHealthRecovery: null, isHealthRecovery: null,
isEnergyLoss: null, isEnergyLoss: null,
isDeathAvoid: null, isDeathAvoid: null,
isDeathAvoidedThisLevel: null,
waveSpeedMap: null, waveSpeedMap: null,
waveSpeedBody: null, waveSpeedBody: null,
isSporeField: null, isSporeField: null,

View File

@@ -498,11 +498,15 @@ const mech = {
if (mod.isEnergyHealth) { if (mod.isEnergyHealth) {
mech.energy -= dmg; mech.energy -= dmg;
if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage
if (mod.isDeathAvoid && powerUps.reroll.rerolls) { if (mod.isDeathAvoid && powerUps.reroll.rerolls && !mod.isDeathAvoidedThisLevel) {
mod.isDeathAvoidedThisLevel = true
powerUps.reroll.changeRerolls(-1) powerUps.reroll.changeRerolls(-1)
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420) game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
for (let i = 0; i < 6; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false);
}
mech.energy = mech.maxEnergy mech.energy = mech.maxEnergy
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds mech.immuneCycle = mech.cycle + 360 //disable this.immuneCycle bonus seconds
game.wipe = function() { //set wipe to have trails game.wipe = function() { //set wipe to have trails
ctx.fillStyle = "rgba(255,255,255,0.03)"; ctx.fillStyle = "rgba(255,255,255,0.03)";
ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -511,7 +515,7 @@ const mech = {
game.wipe = function() { //set wipe to normal game.wipe = function() { //set wipe to normal
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
} }
}, 2000); }, 3000);
return; return;
} else { //death } else { //death
@@ -525,14 +529,15 @@ const mech = {
dmg *= mech.harmReduction() dmg *= mech.harmReduction()
mech.health -= dmg; mech.health -= dmg;
if (mech.health < 0 || isNaN(mech.health)) { if (mech.health < 0 || isNaN(mech.health)) {
if (mod.isDeathAvoid && powerUps.reroll.rerolls > 0) { //&& Math.random() < 0.5 if (mod.isDeathAvoid && powerUps.reroll.rerolls > 0 && !mod.isDeathAvoidedThisLevel) { //&& Math.random() < 0.5
mod.isDeathAvoidedThisLevel = true
mech.health = 0.05 mech.health = 0.05
powerUps.reroll.changeRerolls(-1) powerUps.reroll.changeRerolls(-1)
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420) game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
for (let i = 0; i < 4; i++) { for (let i = 0; i < 6; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false); powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false);
} }
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds mech.immuneCycle = mech.cycle + 360 //disable this.immuneCycle bonus seconds
// game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420) // game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
game.wipe = function() { //set wipe to have trails game.wipe = function() { //set wipe to have trails
@@ -543,7 +548,7 @@ const mech = {
game.wipe = function() { //set wipe to normal game.wipe = function() { //set wipe to normal
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
} }
}, 2000); }, 3000);
} else { } else {
mech.health = 0; mech.health = 0;
mech.death(); mech.death();
@@ -1038,7 +1043,7 @@ const mech = {
if (mech.energy < 0) { if (mech.energy < 0) {
mech.energy = 0; mech.energy = 0;
} }
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy; // if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
if (mod.blockDmg) { if (mod.blockDmg) {
who.damage(mod.blockDmg * b.dmgScale) who.damage(mod.blockDmg * b.dmgScale)
@@ -1709,7 +1714,7 @@ const mech = {
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(180); mech.lookForPickUp(180);
const DRAIN = 0.0008 const DRAIN = 0.0011
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
if (mech.energy < DRAIN) { if (mech.energy < DRAIN) {
@@ -1719,11 +1724,9 @@ const mech = {
} }
//draw field everywhere //draw field everywhere
ctx.globalCompositeOperation = "saturation" ctx.globalCompositeOperation = "saturation"
// ctx.fillStyle = "rgba(100,200,230," + (0.25 + 0.06 * Math.random()) + ")";
ctx.fillStyle = "#ccc"; ctx.fillStyle = "#ccc";
ctx.fillRect(-100000, -100000, 200000, 200000) ctx.fillRect(-100000, -100000, 200000, 200000)
ctx.globalCompositeOperation = "source-over" ctx.globalCompositeOperation = "source-over"
//stop time //stop time
mech.isBodiesAsleep = true; mech.isBodiesAsleep = true;

View File

@@ -94,17 +94,17 @@ const spawn = {
me.frictionAir = 0.01; me.frictionAir = 0.01;
me.memory = Infinity; me.memory = Infinity;
me.locatePlayer(); me.locatePlayer();
const density = 5 const density = 1
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
spawn.shield(me, x, y, 1); // spawn.shield(me, x, y, 1);
me.onDeath = function() { me.onDeath = function() {
level.bossKilled = true; level.bossKilled = true;
level.exit.x = 5500; level.exit.x = 5500;
level.exit.y = -330; level.exit.y = -330;
}; };
me.onDamage = function() {}; me.onDamage = function() {};
me.cycle = 300; me.cycle = 420;
me.endCycle = 600; me.endCycle = 720;
me.mode = 0; me.mode = 0;
me.do = function() { me.do = function() {
//hold position //hold position
@@ -118,56 +118,54 @@ const spawn = {
}); });
this.modeDo(); //this does different things based on the mode this.modeDo(); //this does different things based on the mode
this.checkStatus(); this.checkStatus();
if (!mech.isBodiesAsleep) { this.cycle++; //switch modes÷
this.cycle++; //switch modes // if (!mech.isBodiesAsleep) {
if (this.health > 0.33) { if (this.health > 0.25) {
if (this.cycle > this.endCycle) { if (this.cycle > this.endCycle) {
this.cycle = 0; this.cycle = 0;
this.mode++ this.mode++
if (this.mode > 2) { if (this.mode > 2) {
this.mode = 0; this.mode = 0;
this.fill = "#50f"; this.fill = "#50f";
this.rotateVelocity = Math.abs(this.rotateVelocity) * (player.position.x > this.position.x ? 1 : -1) //rotate so that the player can get away this.rotateVelocity = Math.abs(this.rotateVelocity) * (player.position.x > this.position.x ? 1 : -1) //rotate so that the player can get away
this.modeDo = this.modeLasers this.modeDo = this.modeLasers
//push blocks and player away, since this is the end of suck, and suck causes blocks to fall on the boss and stun it //push blocks and player away, since this is the end of suck, and suck causes blocks to fall on the boss and stun it
Matter.Body.scale(this, 10, 10); Matter.Body.scale(this, 10, 10);
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
if (!this.isShielded) spawn.shield(this, x, y, 1); // regen shield to also prevent stun if (!this.isShielded) spawn.shield(this, x, y, 1); // regen shield to also prevent stun
for (let i = 0, len = body.length; i < len; ++i) { for (let i = 0, len = body.length; i < len; ++i) {
if (body[i].position.x > this.position.x) { if (body[i].position.x > this.position.x) {
body[i].force.x = 0.5 body[i].force.x = 0.5
} else { } else {
body[i].force.x = -0.5 body[i].force.x = -0.5
}
} }
} else if (this.mode === 1) {
this.fill = "rgb(150,150,255)";
this.endCycle = 360
this.modeDo = this.modeSpawns
} else if (this.mode === 2) {
this.fill = "#000";
this.endCycle = 720
this.modeDo = this.modeSuck
Matter.Body.scale(this, 0.1, 0.1);
Matter.Body.setDensity(me, 100 * density); //extra dense //normal is 0.001 //makes effective life much larger
} }
} else if (this.mode === 1) {
this.fill = "#50f"; // this.fill = "rgb(150,150,255)";
this.modeDo = this.modeSpawns
} else if (this.mode === 2) {
this.fill = "#000";
this.modeDo = this.modeSuck
Matter.Body.scale(this, 0.1, 0.1);
Matter.Body.setDensity(me, 100 * density); //extra dense //normal is 0.001 //makes effective life much larger
} }
} else if (this.mode !== 3) { //all three modes at once
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
if (this.mode === 2) {
Matter.Body.scale(this, 5, 5);
} else {
Matter.Body.scale(this, 0.5, 0.5);
}
this.mode = 3
this.fill = "#000";
this.eventHorizon = 1200
this.rotateVelocity = Math.abs(this.rotateVelocity) * (player.position.x > this.position.x ? 1 : -1) //rotate so that the player can get away
if (!this.isShielded) spawn.shield(this, x, y, 1); //regen shield here ?
this.modeDo = this.modeAll
} }
} else if (this.mode !== 3) { //all three modes at once
this.cycle = 0;
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
if (this.mode === 2) {
Matter.Body.scale(this, 5, 5);
} else {
Matter.Body.scale(this, 0.5, 0.5);
}
this.mode = 3
this.fill = "#000";
this.eventHorizon = 1200
this.rotateVelocity = Math.abs(this.rotateVelocity) * (player.position.x > this.position.x ? 1 : -1) //rotate so that the player can get away
if (!this.isShielded) spawn.shield(this, x, y, 1); //regen shield here ?
this.modeDo = this.modeAll
} }
// }
}; };
me.modeDo = function() {} me.modeDo = function() {}
me.modeAll = function() { me.modeAll = function() {
@@ -176,25 +174,32 @@ const spawn = {
this.modeLasers() this.modeLasers()
} }
me.modeSpawns = function() { me.modeSpawns = function() {
if (!(this.cycle % 320) && !mech.isBodiesAsleep && mob.length < 40) { if ((this.cycle === 2 || this.cycle === 300) && !mech.isBodiesAsleep && mob.length < 40) {
Matter.Body.setAngularVelocity(this, 0.11) Matter.Body.setAngularVelocity(this, 0.1)
//fire a bullet from each vertex //fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) { for (let i = 0, len = this.vertices.length; i < len; i++) {
let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]; let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
spawn[whoSpawn](this.vertices[i].x, this.vertices[i].y); spawn[whoSpawn](this.vertices[i].x, this.vertices[i].y);
//give the bullet a rotational velocity as if they were attached to a vertex //give the bullet a rotational velocity as if they were attached to a vertex
const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -20) const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -18)
Matter.Body.setVelocity(mob[mob.length - 1], { Matter.Body.setVelocity(mob[mob.length - 1], {
x: this.velocity.x + velocity.x, x: this.velocity.x + velocity.x,
y: this.velocity.y + velocity.y y: this.velocity.y + velocity.y
}); });
} }
if (game.difficulty > 60) {
spawn.randomLevelBoss(3000, -1100)
if (game.difficulty > 100) {
spawn.randomLevelBoss(3000, -1300)
}
}
} }
} }
me.eventHorizon = 1400 me.eventHorizon = 1300
me.eventHorizonCycleRate = 4 * Math.PI / me.endCycle
me.modeSuck = function() { me.modeSuck = function() {
//eventHorizon waves in and out //eventHorizon waves in and out
eventHorizon = this.eventHorizon * (1 + 0.2 * Math.sin(game.cycle * 0.015)) if (!mech.isBodiesAsleep) eventHorizon = this.eventHorizon * (1 - 0.25 * Math.cos(this.cycle * this.eventHorizonCycleRate)) //0.014
//draw darkness //draw darkness
ctx.beginPath(); ctx.beginPath();
ctx.arc(this.position.x, this.position.y, eventHorizon * 0.2, 0, 2 * Math.PI); ctx.arc(this.position.x, this.position.y, eventHorizon * 0.2, 0, 2 * Math.PI);
@@ -242,58 +247,56 @@ const spawn = {
me.rotateVelocity = 0.0025 me.rotateVelocity = 0.0025
me.rotateCount = 0; me.rotateCount = 0;
me.modeLasers = function() { me.modeLasers = function() {
if (!this.isStunned) { if (!mech.isBodiesAsleep && !this.isStunned) {
if (!mech.isBodiesAsleep) { let slowed = false //check if slowed
let slowed = false //check if slowed for (let i = 0; i < this.status.length; i++) {
for (let i = 0; i < this.status.length; i++) { if (this.status[i].type === "slow") {
if (this.status[i].type === "slow") { slowed = true
slowed = true break
break
}
}
if (!slowed) {
this.rotateCount++
Matter.Body.setAngle(this, this.rotateCount * this.rotateVelocity)
Matter.Body.setAngularVelocity(this, 0)
Matter
} }
} }
if (this.cycle < 180) { //damage scales up over 2 seconds to give player time to move if (!slowed) {
const scale = this.cycle / 180 this.rotateCount++
const dmg = 0.14 * game.dmgScale * scale Matter.Body.setAngle(this, this.rotateCount * this.rotateVelocity)
ctx.beginPath(); Matter.Body.setAngularVelocity(this, 0)
this.laser(this.vertices[0], this.angle + Math.PI / 6, dmg); Matter
this.laser(this.vertices[1], this.angle + 3 * Math.PI / 6, dmg);
this.laser(this.vertices[2], this.angle + 5 * Math.PI / 6, dmg);
this.laser(this.vertices[3], this.angle + 7 * Math.PI / 6, dmg);
this.laser(this.vertices[4], this.angle + 9 * Math.PI / 6, dmg);
this.laser(this.vertices[5], this.angle + 11 * Math.PI / 6, dmg);
ctx.strokeStyle = "#50f";
ctx.lineWidth = 1.5 * scale;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.lineWidth = 20;
ctx.strokeStyle = `rgba(80,0,255,${0.07*scale})`;
ctx.stroke(); // Draw it
} else {
ctx.beginPath();
this.laser(this.vertices[0], this.angle + Math.PI / 6);
this.laser(this.vertices[1], this.angle + 3 * Math.PI / 6);
this.laser(this.vertices[2], this.angle + 5 * Math.PI / 6);
this.laser(this.vertices[3], this.angle + 7 * Math.PI / 6);
this.laser(this.vertices[4], this.angle + 9 * Math.PI / 6);
this.laser(this.vertices[5], this.angle + 11 * Math.PI / 6);
ctx.strokeStyle = "#50f";
ctx.lineWidth = 1.5;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.lineWidth = 20;
ctx.strokeStyle = "rgba(80,0,255,0.07)";
ctx.stroke(); // Draw it
} }
} }
if (this.cycle < 240) { //damage scales up over 2 seconds to give player time to move
const scale = this.cycle / 180
const dmg = 0.14 * game.dmgScale * scale
ctx.beginPath();
this.laser(this.vertices[0], this.angle + Math.PI / 6, dmg);
this.laser(this.vertices[1], this.angle + 3 * Math.PI / 6, dmg);
this.laser(this.vertices[2], this.angle + 5 * Math.PI / 6, dmg);
this.laser(this.vertices[3], this.angle + 7 * Math.PI / 6, dmg);
this.laser(this.vertices[4], this.angle + 9 * Math.PI / 6, dmg);
this.laser(this.vertices[5], this.angle + 11 * Math.PI / 6, dmg);
ctx.strokeStyle = "#50f";
ctx.lineWidth = 1.5 * scale;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.lineWidth = 20;
ctx.strokeStyle = `rgba(80,0,255,${0.07*scale})`;
ctx.stroke(); // Draw it
} else {
ctx.beginPath();
this.laser(this.vertices[0], this.angle + Math.PI / 6);
this.laser(this.vertices[1], this.angle + 3 * Math.PI / 6);
this.laser(this.vertices[2], this.angle + 5 * Math.PI / 6);
this.laser(this.vertices[3], this.angle + 7 * Math.PI / 6);
this.laser(this.vertices[4], this.angle + 9 * Math.PI / 6);
this.laser(this.vertices[5], this.angle + 11 * Math.PI / 6);
ctx.strokeStyle = "#50f";
ctx.lineWidth = 1.5;
ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]);
ctx.stroke(); // Draw it
ctx.setLineDash([0, 0]);
ctx.lineWidth = 20;
ctx.strokeStyle = "rgba(80,0,255,0.07)";
ctx.stroke(); // Draw it
}
me.laser = function(where, angle, dmg = 0.14 * game.dmgScale) { me.laser = function(where, angle, dmg = 0.14 * game.dmgScale) {
const vertexCollision = function(v1, v1End, domain) { const vertexCollision = function(v1, v1End, domain) {
for (let i = 0; i < domain.length; ++i) { for (let i = 0; i < domain.length; ++i) {

View File

@@ -1,31 +1,34 @@
missile moves slightly differently
it used to slow when locked on to a target
now it slows when turning
missiles explode when near any mob
wormhole mod: cosmic string - now stuns mobs and applies radiation damage update to mod: anthropic principle - only works once per level
mod time dilation: - quadruple your default energy regeneration but gives 6 seconds of damage immunity and 2 extra heal power ups
added final boss level, it's still in progress so I'd love some feedback most energy regeneration effects now overfill energy above the max by default
also the game loops back to the intro level after the boss piezo electricity over fills energy by 300% (was 100%)
I'll be working on the ending in the next patch, so the intro level is just a placeholder
************** TODO - n-gon ************** ************** TODO - n-gon **************
final boss has elements of other bosses add an ending to the game
laser mode maybe the game ending should ask you to open the console and type in some commands
if player is on left rotate counter clockwise mirror ending (if no cheats)
if player is on right rotate clockwise level after final boss battle is the intro level, but flipped left right, with a fake player
start of laser mode damage the fake player to end the game
push block either left or right, not away message about go outside
vibrating shape no ending (if cheats)
grow and shrink game goes on forever
oscillate elliptical deformation (not sure how) also game goes on if player attacks, the fake player
game never ends if you have used cheats
laser mod - your laser beam fires from your last position, not your current position
or apply to all guns?
mod: While in the air, time is slowed.
or something else while in air
a bot that eats ammo and converts them into rerolls a bot that eats ammo and converts them into rerolls
or 2 ammo power ups = 1 reroll or 2 ammo power ups = 1 reroll
been getting some fps slow down after playing for a few minutes been getting some fps slow down after playing for a few minutes
this seems to be caused by capping the fps at 60, but 60 fps shouldn't have any slowdown
new status effect: fear - push mob away from player for a time new status effect: fear - push mob away from player for a time
@@ -47,17 +50,6 @@ mod - explosions apply radiation damage over time
mod self destruct - drones explode when they die mod self destruct - drones explode when they die
drones lose extra time on collisions drones lose extra time on collisions
add an ending to the game
add a final boss battle level
mirror ending (if no cheats)
level after final boss battle is the intro level, but flipped left right, with a fake player
damage the fake player to end the game
message about go outside
no ending (if cheats)
game goes on forever
also game goes on if player attacks, the fake player
game never ends if you have used cheats
foam or spore bullet on dmg shrink effect foam or spore bullet on dmg shrink effect
it might mess with the foam position of other bullets on the mob it might mess with the foam position of other bullets on the mob
shrink when foam bullets end while attached, or shrink on collision? shrink when foam bullets end while attached, or shrink on collision?