-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathindex.html
1 lines (1 loc) · 58.9 KB
/
index.html
1
<!doctype html><html><head><meta charset="utf-8" /><title>SpacePi</title><style>*{margin:0;padding:0}body{background:#000;color:#aaa;font:100%/20px 'helvetica neue',helvetica,arial,sans-serif;text-align:center;text-shadow:0 -1px 0 #000}h2{color:#fff;font-size:20px;font-weight:normal;margin:0 0 20px}a{color:#fff;font-weight:bold;text-decoration:none}a:focus{outline:0}#game-wrap{background:#000;background:-webkit-radial-gradient(center center,circle contain,#111 0,#000 100%);background:-moz-radial-gradient(center center,circle contain,#111 0,#000 100%);background:-o-radial-gradient(center center,circle contain,#111 0,#000 100%);background:radial-gradient(center center,circle contain,#111 0,#000 100%);border:1px solid #222;height:600px;left:50%;margin:-301px 0 0 -481px;position:absolute;top:50%;width:960px}canvas{cursor:crosshair;display:block;left:0;position:absolute;top:0}h1{color:#2f2;font-size:30px;font-weight:normal;line-height:30px;margin:0 0 10px}h1 strong{color:#fff}p.desc{color:#666;font-size:11px;margin:0 0 20px}p.desc a{color:#999}p.desc a:hover{color:#fff}.menu{background:#111;height:550px;left:0;padding:50px 50px 0;position:absolute;top:0;width:860px;z-index:2}#pause,#upgrades-levels,#level-stats,#retry-level,#overall-stats{display:none}#pause{background:rgba(20,20,20,.5)}#upgrades-levels{text-align:left}#upgrades-levels h2{text-align:left}#level-stats .divider,#overall-stats .divider{margin:0 auto 20px;width:350px}#guide{margin:0 auto;text-align:left;width:auto}#guide .left{float:left;width:440px}#guide h3{color:#2f2;font-size:18px;font-weight:normal;margin:0 0 10px}#guide ul{font-size:11px;margin:0 0 20px}#guide li{list-style:none;margin:0 0 7px}#guide li strong{color:#fff}#guide .pwrup1,#guide .pwrup2,#guide .pwrup3,#guide .pwrup4{cursor:help;padding:0;position:relative}#guide .pwrup1:hover .tip,#guide .pwrup2:hover .tip,#guide .pwrup3:hover .tip,#guide .pwrup4:hover .tip{display:block;font-style:normal}#guide .pwrup1{color:hsl(205,100%,50%)}#guide .pwrup2{color:hsl(0,100%,50%)}#guide .pwrup3{color:hsl(300,100%,50%)}#guide .pwrup4{color:hsl(60,100%,50%)}#map{background:#000;border:1px solid #222;float:right;height:236px;margin:0 0 20px;position:relative;width:378px}#map div{background:#999;position:absolute}#map span{color:#999;font-size:10px;line-height:10px;position:absolute;width:100%}#map .completion{height:4px;left:10px;top:10px;width:70px}#map .completion span{left:0;top:8px}#map .power{height:4px;left:90px;top:10px;width:70px}#map .power span{left:0;top:8px}#map .score{height:4px;right:60px;top:10px;width:40px}#map .score span{left:0;top:8px}#map .profit{height:4px;right:10px;top:10px;width:40px}#map .profit span{left:0;top:8px}#map .base{background:#2f2;border-radius:100%;height:20px;left:50%;margin:-10px 0 0 -10px;top:50%;width:20px}#map .base span{left:0;top:24px}#map .base-goal{background:0;border:2px solid #131;border-radius:100%;height:76px;left:50%;margin:-40px 0 0 -40px;top:50%;width:76px}#map .base-goal span{left:100%;padding:0 0 0 6px;top:33px}#map .good-line{height:60px;left:115px;margin:-30px 0 0 0;top:50%;width:1px}#map .good-line span{left:-25px;text-align:center;top:64px;width:50px}#map .bad-line{background:#f22;height:1px;left:20px;top:50%;width:60px}#map .bad-line span{left:0;text-align:center;top:5px}#map .bad-line:after{border-left:5px solid #f22;border-bottom:5px solid transparent;border-top:5px solid transparent;content:'';display:block;margin:-5px 0 0 0;position:absolute;right:-5px;top:50%}.button{background:#171717;background:-webkit-linear-gradient(#222,#111);background:-moz-linear-gradient(#222,#111);background:-o-linear-gradient(#222,#111);background:linear-gradient(#222,#111);border:1px solid #000;border-radius:2px;box-shadow:0 1px 0 #222;display:block;height:30px;line-height:30px;margin:0 auto 10px;text-align:center;width:348px}.button span{border-radius:2px;box-shadow:inset 0 1px 0 #333;color:#ccc;display:block;font-size:11px;font-weight:bold;padding:0 20px}.button:hover span{background:rgba(255,255,255,.05);color:#fff}.button:active span{background:#111;box-shadow:inset 0 0 10px #000;color:#999}.button.disabled{cursor:default;opacity:.25}.button.disabled span{color:#999}.button.disabled:hover span{background:0;color:#999;cursor:default}.button.max:hover span{background:0;color:#ccc;cursor:default}.button.disabled:active span,.button.max:active span{background:0;box-shadow:none;cursor:default}#funds{color:#fff;display:block;float:right;font-size:20px;line-height:20px;position:relative}#funds.not-enough{color:#f22;top:-10px}.up-list{margin:0 0 20px}.up-list .upgrade-group{float:left;margin:0 15px 0 0}.up-list .upgrade-group.last{margin-right:0}.up-list .button{height:auto;line-height:20px;margin:0 0 15px 0;position:relative;width:158px}.up-list .button:last-child{margin-bottom:0}.up-list .button span{padding:10px 18px}.up-list .button .cost{font-weight:normal;margin:0 0 5px}.up-list .button i{font-size:11px;font-style:normal}.up-list .button .available{color:#2f2}.up-list .button .unavailable{color:#f22}.up-list .button .lev{background:#292929;background:-webkit-linear-gradient(#444,#111);background:-moz-linear-gradient(#444,#111);background:-o-linear-gradient(#444,#111);background:linear-gradient(#444,#111);border:1px solid #000;border-radius:50%;display:inline-block;height:7px;margin:0 4px;width:7px}.up-list .upg1 .lev.lev1,.up-list .upg2 .lev.lev1,.up-list .upg2 .lev.lev2,.up-list .upg3 .lev.lev1,.up-list .upg3 .lev.lev2,.up-list .upg3 .lev.lev3,.up-list .upg4 .lev.lev1,.up-list .upg4 .lev.lev2,.up-list .upg4 .lev.lev3,.up-list .upg4 .lev.lev4{background:#fff;background:-webkit-linear-gradient(#eee,#444);background:-moz-linear-gradient(#eee,#444);background:-o-linear-gradient(#eee,#444);background:linear-gradient(#eee,#444);box-shadow:inset 0 1px 0 #fff,0 0 14px rgba(255,255,255,.4)}.up-list .upg5 .lev.lev1,.up-list .upg5 .lev.lev2,.up-list .upg5 .lev.lev3,.up-list .upg5 .lev.lev4,.up-list .upg5 .lev.lev5{background:#4f4;background:-webkit-linear-gradient(#4f4,#050);background:-moz-linear-gradient(#4f4,#050);background:-o-linear-gradient(#4f4,#050);background:linear-gradient(#4f4,#050);box-shadow:inset 0 1px 0 rgba(255,255,255,.85),0 0 14px rgba(0,255,0,.4)}.up-list .value{color:#777;display:none}.up-list .upg0 .value.lev0,.up-list .upg1 .value.lev1,.up-list .upg2 .value.lev2,.up-list .upg3 .value.lev3,.up-list .upg4 .value.lev4,.up-list .upg5 .value.lev5{display:block}.tip{background:#111;background:-webkit-linear-gradient(#222,#000);background:-moz-linear-gradient(#222,#000);background:-o-linear-gradient(#222,#000);background:linear-gradient(#222,#000);border:1px solid #333;border-radius:2px;bottom:100%;box-shadow:0 0 10px 1px #000;color:#ccc;display:none;font-size:11px;font-weight:normal;left:50%;line-height:16px;margin:0 0 16px -101px;padding:8px 20px;position:absolute;text-align:left;width:160px;z-index:2}.tip strong{color:#fff}.tip:before,.tip:after{border:1px solid transparent;content:'';height:0;left:50%;position:absolute;top:100%;width:0}.tip:before{border-top-color:#333;border-width:7px;margin-left:-7px;z-index:1}.tip:after{border-top-color:#000;border-width:5px;margin-left:-5px;z-index:2}.up-list .button:hover .tip{display:block}.up-list .button.disabled{cursor:default;opacity:1}.up-list .button.disabled span .availability{color:#f22}.up-list .button.disabled:hover span{background:0;color:#999;cursor:default}.up-list .button.max:hover span{background:0;color:#ccc;cursor:default}.up-list .button.disabled:active span,.up-list .button.max:active span{background:0;box-shadow:inset 0 1px 0 #333;cursor:default}.up-list .button:hover .value{color:#aaa}.up-list .button.max:hover .value{color:#777}#level-status{color:#aaa;display:block;float:right;font-size:11px;line-height:20px;position:relative;text-align:right}#level-status strong{color:#fff;font-weight:bold}#level-status em{color:#181;font-style:normal}#level-status em strong{color:#2f2}.level-list{clear:both;margin:0 0 20px;position:relative}.level{clear:none;float:left;height:54px;margin:0 11px 0 0;position:relative;width:54px}.level:last-child{margin-right:0}.level span{font-size:14px;height:44px;line-height:18px;padding:10px 0 0 0;position:relative;text-align:center}.level span i{display:none}.level.perfect-level span i{background:#222;background:-webkit-linear-gradient(#333,#111);background:-moz-linear-gradient(#333,#111);background:-o-linear-gradient(#333,#111);background:linear-gradient(#333,#111);border:1px solid #000;border-radius:100%;box-shadow:0 0 3px rgba(0,0,0,.5);color:#999;display:block;font-style:normal;left:-6px;font-size:10px;height:16px;line-height:16px;position:absolute;text-align:center;top:-6px;width:16px}.level.perfect-level:hover span i{color:#2f2}.level.disabled .level-score{color:#444}.level .level-score{color:#999;bottom:12px;display:block;font-style:normal;font-weight:normal;left:0;font-size:10px;width:54px}.level:hover .level-score{color:#fff}.level.disabled:hover .level-score{color:#444}.level-list .level.disabled span{color:#999}.level:nth-child(1) span{color:hsl(27,100%,50%)}.level:nth-child(2) span{color:hsl(55,100%,50%)}.level:nth-child(3) span{color:hsl(83,100%,50%)}.level:nth-child(4) span{color:hsl(110,100%,50%)}.level:nth-child(5) span{color:hsl(138,100%,50%)}.level:nth-child(6) span{color:hsl(166,100%,50%)}.level:nth-child(7) span{color:hsl(193,100%,50%)}.level:nth-child(8) span{color:hsl(221,100%,55%)}.level:nth-child(9) span{color:hsl(249,100%,60%)}.level:nth-child(10) span{color:hsl(276,100%,55%)}.level:nth-child(11) span{color:hsl(304,100%,50%)}.level:nth-child(12) span{color:hsl(332,100%,50%)}.level:nth-child(13) span{color:hsl(0,100%,50%)}.level-list .button .tip{text-align:center}.level-list .button:hover .tip{display:block}.level-list .button.disabled:hover .tip{display:none}.level-notes{background:#222;border:1px solid #000;border-radius:100%;cursor:help;color:#ccc;display:inline-block;font-size:11px;font-weight:bold;height:16px;line-height:16px;position:relative;text-align:center;vertical-align:middle;width:16px}.level-notes:hover{background:#333;color:#fff}.level-notes:hover .tip{display:block}.level-success{color:#2f2}.level-fail{color:#f22}.perfect{color:#2f2;font-weight:bold;margin:0 0 0 5px}table{border-collapse:separate;border-radius:2px;border-spacing:0;box-shadow:0 1px 0 #222;margin:0 auto 20px;width:348px}th{background:#171717;background:-webkit-linear-gradient(#222,#111);background:-moz-linear-gradient(#222,#111);background:-o-linear-gradient(#222,#111);background:linear-gradient(#222,#111);border:1px solid #000;border-radius:2px 2px 0 0;box-shadow:inset 0 1px 0 #333;color:#fff;font-size:14px;padding:6px 16px}td{border-bottom:1px solid #000;border-right:1px solid #000;box-shadow:inset 0 1px 0 #333;color:#fff;font-size:11px;font-weight:bold;padding:6px 16px;text-align:left;width:50%}td:first-child{border-left:1px solid #000;color:#ccc;font-weight:normal;text-align:right}td .td-note{color:#ccc;font-style:italic;font-weight:normal}td .td-note.na{color:#f22}td .best-score{color:#2f2;font-weight:bold}tr{background:#222;background:-webkit-linear-gradient(#292929,#1a1a1a);background:-moz-linear-gradient(#292929,#1a1a1a);background:-o-linear-gradient(#292929,#1a1a1a);background:linear-gradient(#292929,#1a1a1a)}tr:last-child td:first-child{border-radius:0 0 0 2px}tr:last-child td:last-child{border-radius:0 0 2px 0}tr:hover td{background:#333;box-shadow:inset 0 1px 0 #444}.clearfix:before,.clearfix:after{content:'';display:table}.clearfix:after{clear:both}.clearfix{zoom:1}.divider{background:#000;border-bottom:1px solid #222;clear:both;height:1px;margin:0 0 20px}a,.button span,#funds,td,.level-notes,.level-score,.value{-webkit-transition:all 300ms;-moz-transition:all 300ms;-o-transition:all 300ms;transition:all 300ms}#no-can{display:none;margin:0 auto;width:500px}#no-can p{font-size:12px;text-align:center}#no-can a{color:#4f4}#no-can a:hover{color:#afa}</style></head><body><div id="game-wrap"><div id="main" class="menu"><h1><strong>Space</strong>Pi</h1><p class="desc">Created by <a href="http://jackrugile.com" target="_blank">Jack Rugile</a> for <a href="http://js13kgames.com/" target="_blank">js13kGames</a></p><div id="no-can"><div class="divider"></div><p>Your browser does not support canvas. To play the game, download the latest version of a browser that supports canvas, such as <a href="https://google.com/chrome" target="_blank">Google Chrome</a> or <a href="http://mozilla.org/firefox" target="_blank">Mozilla Firefox</a>.</p></div><div id="home-wrap"><div id="guide" class="clearfix"><div class="divider"></div><div class="left"><h3>Overview</h3><ul><li><strong>Objective</strong> - Create lines to defend against enemy lines. Protect your base until it has grown to its target radius. Collect coins to purchase upgrades. Collect powerups to gain benefits: <span class="pwrup1">Slow Enemies<i class="tip">Enemy movement and spawning are slowed to half speed</i></span>, <span class="pwrup2">Unlimited Power<i class="tip">Unlimited line creation power</i></span>, <span class="pwrup3">Base Generation Boost<i class="tip">Base growth is doubled</i></span>, and <span class="pwrup4">Coin Scatter<i class="tip">Coins are scattered across the level</i></span>. </li><li><strong>Controls</strong> - Click and drag to create defensive lines, which is limited by your available power. Press the spacebar to pause.</li><li><strong>Saving</strong> - Game data is saved automatically at the end of levels and after upgrade purchases.<li><li><strong>Scoring</strong> - The lower the better. Beat the levels faster, create fewer lines, create shorter lines, and take less damage to get a better score.<li></ul></div><div id="map"><div class="completion"><span>Completion</span></div><div class="power"><span>Power</span></div><div class="score"><span>Score</span></div><div class="profit"><span>Profit</span></div><div class="base"><span>Base</span></div><div class="base-goal"><span>Target Radius</span></div><div class="good-line"><span>Defensive Line</span></div><div class="bad-line"><span>Enemy Line</span></div></div><div class="divider"></div></div><a href="#" class="button" id="play-game-button"><span>Play Game</span></a><a href="#" class="button" id="overall-stats-button"><span>Overall Stats</span></a><a href="#" class="button" id="reset-game-data-button"><span>Reset Game Data</span></a></div></div><div id="pause" class="menu"><h2 id="paused-title">Paused</h2><a href="#" class="button" id="resume-level-button"><span>Resume Level</span></a><a href="#" class="button" id="quit-level-button"><span>Quit Level</span></a></div><div id="upgrades-levels" class="menu"><p id="funds">$100</p><h2>Upgrades</h2><div class="up-list clearfix"><div class="upgrade-group"><a href="#" class="upgrade button" data-parent="power" data-specific="capacity"><span class="clearfix"><div class="title">Power Capacity</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">100px Total</div><div class="value lev1">200px Total</div><div class="value lev2">350px Total</div><div class="value lev3">500px Total</div><div class="value lev4">750px Total</div><div class="value lev5">1000px Total</div><p class="tip">Increases the capacity of your power, which is used to create defensive lines.</p></span></a><a href="#" class="upgrade button" data-parent="power" data-specific="generation"><span class="clearfix"><div class="title">Power Generation</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">30px/Second</div><div class="value lev1">60px/Second</div><div class="value lev2">90px/Second</div><div class="value lev3">120px/Second</div><div class="value lev4">150px/Second</div><div class="value lev5">180px/Second</div><p class="tip">Increases the generation of your power, which is used to create defensive lines.</p></span></a></div><div class="upgrade-group"><a href="#" class="upgrade button" data-parent="base" data-specific="resistance"><span class="clearfix"><div class="title">Base Resistance</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">0 Damage</div><div class="value lev1">-1 Damage</div><div class="value lev2">-2 Damage</div><div class="value lev3">-3 Damage</div><div class="value lev4">-4 Damage</div><div class="value lev5">-5 Damage</div><p class="tip">Increases the resistance of your base, which decreases damage from enemy lines.</p></span></a><a href="#" class="upgrade button" data-parent="base" data-specific="generation"><span class="clearfix"><div class="title">Base Generation</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">1.2px/Second</div><div class="value lev1">1.8px/Second</div><div class="value lev2">2.4px/Second</div><div class="value lev3">3px/Second</div><div class="value lev4">3.6px/Second</div><div class="value lev5">4.2px/Second</div><p class="tip">Increases the generation of your base, allowing it to reach its target radius faster.</p></span></a></div><div class="upgrade-group"><a href="#" class="upgrade button" data-parent="powerups" data-specific="chance"><span class="clearfix"><div class="title">Powerup Chance</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">2% Chance</div><div class="value lev1">3% Chance</div><div class="value lev2">4% Chance</div><div class="value lev3">5% Chance</div><div class="value lev4">6% Chance</div><div class="value lev5">7% Chance</div><p class="tip">Increases the chance of enemy lines dropping powerups.</p></span></a><a href="#" class="upgrade button" data-parent="powerups" data-specific="duration"><span class="clearfix"><div class="title">Powerup Duration</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">3 Seconds</div><div class="value lev1">3.5 Seconds</div><div class="value lev2">4 Seconds</div><div class="value lev3">4.5 Seconds</div><div class="value lev4">5 Seconds</div><div class="value lev5">5.5 Seconds</div><p class="tip">Increases the duration of powerups.</p></span></a></div><div class="upgrade-group"><a href="#" class="upgrade button" data-parent="magnet" data-specific="range"><span class="clearfix"><div class="title">Magnet Range</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">50px Radius</div><div class="value lev1">100px Radius</div><div class="value lev2">150px Radius</div><div class="value lev3">200px Radius</div><div class="value lev4">300px Radius</div><div class="value lev5">400px Radius</div><p class="tip">Increases the range of your magnet, which collects coins and powerups.</p></span></a><a href="#" class="upgrade button" data-parent="magnet" data-specific="power"><span class="clearfix"><div class="title">Magnet Power</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">60px/Second</div><div class="value lev1">120px/Second</div><div class="value lev2">180px/Second</div><div class="value lev3">240px/Second</div><div class="value lev4">300px/Second</div><div class="value lev5">360px/Second</div><p class="tip">Increases the power of your magnet, which collects coins and powerups.</p></span></a></div><div class="upgrade-group last"><a href="#" class="upgrade button" data-parent="coins" data-specific="chance"><span class="clearfix"><div class="title">Coin Chance</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">50% Chance</div><div class="value lev1">55% Chance</div><div class="value lev2">60% Chance</div><div class="value lev3">65% Chance</div><div class="value lev4">70% Chance</div><div class="value lev5">75% Chance</div><p class="tip">Increases the chance of enemy lines dropping coins.</p></span></a><a href="#" class="upgrade button" data-parent="coins" data-specific="amount"><span class="clearfix"><div class="title">Coin Amount</div><div class="cost"></div><div class="lev lev1"></div><div class="lev lev2"></div><div class="lev lev3"></div><div class="lev lev4"></div><div class="lev lev5"></div><div class="value lev0">1 Coin</div><div class="value lev1">1-2 Coins</div><div class="value lev2">1-3 Coins</div><div class="value lev3">1-4 Coins</div><div class="value lev4">1-5 Coins</div><div class="value lev5">1-6 Coins</div><p class="tip">Increases the amount of coins dropped by enemy lines.</p></span></a></div></div><div class="divider"></div><p id="level-status"><strong><span id="completed-levels"></span>/13</strong> Completed - <em><strong><span id="perfect-levels"></span>/13</strong> Perfect</em></p><h2>Levels <span class="level-notes">i<p class="tip">Best scores are shown for each level. <strong>Lower is better.</strong> Levels marked with a "P", for Perfect, were beaten without any base hits.</p></span></h2><div class="level-list clearfix"><a href="#" rel="0" class="level button"><span>1<i>P</i><small class="level-score"></small></span><p class="tip">"Noobs Welcome"<br/><strong>$5</strong>/Coin</p></a><a href="#" rel="1" class="level button"><span>2<i>P</i><small class="level-score"></small></span><p class="tip">"No Sweat"</strong><br/><strong>$10</strong>/Coin</p></a><a href="#" rel="2" class="level button"><span>3<i>P</i><small class="level-score"></small></span><p class="tip">"Yep, Still Easy"<br/><strong>$15</strong>/Coin</p></a><a href="#" rel="3" class="level button"><span>4<i>P</i><small class="level-score"></small></span><p class="tip">"Piece of js13cake"<br/><strong>$20</strong>/Coin</p></a><a href="#" rel="4" class="level button"><span>5<i>P</i><small class="level-score"></small></span><p class="tip">"You Got This"<br/><strong>$25</strong>/Coin</p></a><a href="#" rel="5" class="level button"><span>6<i>P</i><small class="level-score"></small></span><p class="tip">"Ok, Some Sweat"<br/><strong>$30</strong>/Coin</p></a><a href="#" rel="6" class="level button"><span>7<i>P</i><small class="level-score"></small></span><p class="tip">"Wait, Hold On"<br/><strong>$35</strong>/Coin</p></a><a href="#" rel="7" class="level button"><span>8<i>P</i><small class="level-score"></small></span><p class="tip">"Beware"<br/><strong>$40</strong>/Coin</p></a><a href="#" rel="8" class="level button"><span>9<i>P</i><small class="level-score"></small></span><p class="tip">"Lots of Sweat"<br/><strong>$45</strong>/Coin</p></a><a href="#" rel="9" class="level button"><span>10<i>P</i><small class="level-score"></small></span><p class="tip">"Clickfest"<br/><strong>$50</strong>/Coin</p></a><a href="#" rel="10" class="level button"><span>11<i>P</i><small class="level-score"></small></span><p class="tip">"Don't Break Your Mouse"<br/><strong>$55</strong>/Coin</p></a><a href="#" rel="11" class="level button"><span>12<i>P</i><small class="level-score"></small></span><p class="tip">"No Light at the End<br />of the Carpal Tunnel"<br/><strong>$60</strong>/Coin</p></a><a href="#" rel="12" class="level button"><span>13<i>P</i><small class="level-score"></small></span><p class="tip">"Hope You're Not as<br />Sensitive as Your Mouse"<br/><strong>$65</strong>/Coin</p></a></div><div class="divider"></div><a href="#" class="button" id="return-to-menu-button"><span>Return to Menu</span></a></div><div id="level-stats" class="menu"><h2 id="stats-status"></h2><table><tr><th colspan="2">Level Stats</th></tr><tr><td>Duration:</td><td id="stats-duration"></td></tr><tr><td>Lines Created:</td><td id="stats-lines-created"></td></tr><tr><td>Total Line Length:</td><td id="stats-total-line-length"></td></tr><tr><td>Base Hits:</td><td id="stats-base-hits"></td></tr><tr><td>Powerups Collected:</td><td id="stats-powerups-collected"></td></tr><tr><td>Coins Collected:</td><td id="stats-coins-collected"></td></tr><tr><td>Profit:</td><td id="stats-profit"></td></tr><tr><td>Score:</td><td id="stats-score"></td></tr></table><div class="divider"></div><a href="#" class="button" id="retry-level-button"><span>Retry Level</span></a><a href="#" class="button" id="return-to-upgrades-levels-button"><span>Return to Upgrades/Levels</span></a></div><div id="overall-stats" class="menu"><h1><strong>Space</strong>Pi</h1><p class="desc">Created by <a href="http://jackrugile.com" target="_blank">Jack Rugile</a> for <a href="http://js13kgames.com/" target="_blank">js13kGames</a></p><div class="divider"></div><table><tr><th colspan="2">Overall Stats</th></tr><tr><td>Total Lines Created:</td><td id="overall-lines-created"></td></tr><tr><td>Total Line Length:</td><td id="overall-line-length"></td></tr><tr><td>Total Base Hits:</td><td id="overall-base-hits"></td></tr><tr><td>Total Levels Played:</td><td id="overall-levels-played"></td></tr><tr><td>Total Time Played:</td><td id="overall-time-played"></td></tr></table><div class="divider"></div><a href="#" class="button" id="return-to-menu-button2"><span>Return to Menu</span></a></div><canvas id="c" height="600" width="960"></canvas></div><script>var SpacePi=function(){var a=this,h=document;a.rand=function(a,d){return~~(Math.random()*(d-a+1)+a)};a.intersection=function(a,d,e,f){var g=(f.x-e.x)*(a.y-e.y)-(f.y-e.y)*(a.x-e.x),k=(d.x-a.x)*(a.y-e.y)-(d.y-a.y)*(a.x-e.x),e=(f.y-e.y)*(d.x-a.x)-(f.x-e.x)*(d.y-a.y);0!=e?(g/=e,k/=e,a=0<=g&&1>=g&&0<=k&&1>=k?{x:a.x+g*(d.x-a.x),y:a.y+g*(d.y-a.y)}:!1):a=!1;return a};a.dToR=function(a){return a*(Math.PI/180)};a.arcInRect=function(a,d,e,f,g,k,h){return!(a+e<=f||a-e>=f+k||d+e<=g||d-e>=g+h)};a.pi2=2*Math.PI;a.updateAll=function(a){for(var d=a.length;d--;)a[d]&&a[d].update(d)};a.renderAll=function(a){for(var d=a.length;d--;)a[d]&&a[d].render(d)};a.destroyAll=function(a){for(var d=a.length;d--;)a[d]&&a[d].destroy(d)};a.clear=function(){a.ctx.clearRect(0,0,a.cw,a.ch)};a.commas=function(a){x=(a+"").split(".");x1=x[0];x2=1<x.length?"."+x[1]:"";for(a=/(\d+)(\d{3})/;a.test(x1);)x1=x1.replace(a,"$1,$2");return x1+x2};a.hasClass=function(a,d){return a.className.match(RegExp("(\\s|^)"+d+"(\\s|$)"))};a.addClass=function(b,d){a.hasClass(b,d)||(b.className+=" "+d)};a.rmvClass=function(b,d){a.hasClass(b,d)&&(b.className=b.className.replace(RegExp("(\\s|^)"+d+"(\\s|$)")," "))};a.get=function(a){return h.getElementById(a)};Storage.prototype.setObject=function(a,d){this.setItem(a,JSON.stringify(d))};Storage.prototype.getObject=function(a){return(a=this.getItem(a))&&JSON.parse(a)};Storage.prototype.removeObject=function(a){this.removeItem(a)};a.initGame=function(){a.gameWrap=a.get("game-wrap");a.c=a.get("c");h.onselectstart=function(){return!1};a.cw=c.width;a.ch=c.height;a.ctx=c.getContext("2d");a.ctx.lineWidth=1.5;a.ctx.globalCompositeOperation="lighter";a.setupUser();a.bindMenuEvents();a.bindGameplayEvents();a.initialDelay=140;a.menuMode=!0};a.setupUser=function(){a.user=localStorage.getObject("spacePiJS13kUser")||{highestLevelBeaten:0,levels:[{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1},{score:0,perfect:!1}],funds:0,upgrades:{power:{capacity:0,generation:0},base:{resistance:0,generation:0},magnet:{range:0,power:0},coins:{chance:0,amount:0},powerups:{chance:0,duration:0}},overall:{linesCreated:0,lineLength:0,baseHits:0,levelsPlayed:0,timePlayed:0}};a.syncDOM()};a.updateUser=function(){localStorage.setObject("spacePiJS13kUser",a.user);a.syncDOM()};a.clearUser=function(){localStorage.removeObject("spacePiJS13kUser");a.setupUser();a.syncDOM()};a.upgrades={power:{capacity:{value:[100,200,350,500,750,1E3],cost:[100,1E3,2E3,8E3,12E3]},generation:{value:[0.5,1,1.5,2,2.5,3],cost:[100,1E3,2E3,8E3,12E3]}},base:{resistance:{value:[0,1,2,3,4,5],cost:[100,1E3,2E3,8E3,12E3]},generation:{value:[0.02,0.03,0.04,0.05,0.06,0.07],cost:[100,1E3,2E3,8E3,12E3]}},powerups:{chance:{value:[2,3,4,5,6,7],cost:[50,500,2E3,4E3,8E3]},duration:{value:[3,3.5,4,4.5,5,5.5],cost:[50,500,2E3,4E3,8E3]}},magnet:{range:{value:[50,100,150,200,300,400],cost:[50,500,2E3,4E3,8E3]},power:{value:[1,2,3,4,5,6],cost:[50,500,2E3,4E3,8E3]}},coins:{chance:{value:[50,55,60,65,70,75],cost:[50,500,2E3,4E3,8E3]},amount:{value:[1,2,3,4,5,6],cost:[50,500,2E3,4E3,8E3]}}};a.checkMaxUpgrades=function(){return 5===a.user.upgrades.power.capacity&&5===a.user.upgrades.power.generation&&5===a.user.upgrades.base.resistance&&5===a.user.upgrades.base.generation&&5===a.user.upgrades.powerups.chance&&5===a.user.upgrades.powerups.duration&&5===a.user.upgrades.magnet.range&&5===a.user.upgrades.magnet.power&&5===a.user.upgrades.coins.chance&&5===a.user.upgrades.coins.amount};a.powerupRef=[{name:"Slow Enemies",hue:205},{name:"Unlimited Power",hue:0},{name:"Base Generation Boost",hue:300},{name:"Coin Scatter",hue:60}];a.levels=[];for(var i=0;13>i;i++)a.levels.push({badTick:0,badTickMax:90-6*i,badSpeedMin:80+14*i,badSpeedMax:120+14*i,badLengthMin:142-8*i,badLengthMax:132-8*i,badDamage:7+i,goal:30+11*i});a.initLevel=function(b){a.level=b;a.levelPlaying=!0;a.menuMode=!1;a.mousedown=!1;a.mx=a.cw/2;a.my=a.ch/ 2;a.dt=0;a.oldTime=Date.now();a.rumble=!1;a.rumbleLevel=0;a.tempPointLength=0;a.tempPointStart={x:0,y:0};a.tempPointEnd={x:0,y:0};a.goodLines=[];a.goodLines.length=0;a.badLines=[];a.badLines.length=0;a.coins=[];a.coins.length=0;a.powerups=[];a.powerups.length=0;a.blasts=[];a.blasts.length=0;a.debris=[];a.debris.length=0;a.stars=[];a.stars.length=0;a.orbs=[];a.orbs.length=0;a.base={x:a.cw/2,y:a.ch/2,radius:2.1,goal:a.levels[a.level].goal,goalPulseAngle:0,generation:a.upgrades.base.generation.value[a.user.upgrades.base.generation],flicker:0};a.ui={};a.power={capacity:a.upgrades.power.capacity.value[a.user.upgrades.power.capacity],current:a.upgrades.power.capacity.value[a.user.upgrades.power.capacity],rate:a.upgrades.power.generation.value[a.user.upgrades.power.generation]};a.pwrupTimer=0;a.pwrupTimerMax=0;a.pwrupActive=!1;a.upgradesMaxed=a.checkMaxUpgrades()?!0:!1;a.makeStarfield();a.levelStats={startTime:Date.now(),endTime:0,pauseStartTime:0,pauseTimeTotal:0,goodLineTotal:0,goodLineLength:0,coinsCollected:0,profit:0,baseHits:0,powerupsCollected:0,score:0,ticks:0};a.coinPowerupTick=0;a.coinPowerupTickMax=8;a.levelHue=(a.level+1)*(360/13);a.levelEndStatus=[!1,!1];a.levelEndTick=0;a.levelEndTickMax=100;a.syncDOM();a.loop()};a.updateDelta=function(){var b=Date.now();a.dt=(b-a.oldTime)/16;a.dt=10<a.dt?10:a.dt;a.oldTime=b};a.updateRumble=function(){if((!a.levelEndStatus[0]||a.levelEndStatus[0]&&!a.levelEndStatus[1])&&0<a.rumbleLevel)a.rumbleLevel-=1*a.dt};a.updateBase=function(){a.base.goalPulseAngle=360>a.base.goalPulseAngle? a.base.goalPulseAngle+10*(a.base.radius/a.base.goal)*a.dt:0;a.levelStats.ticks>a.initialDelay&&(a.base.radius<a.base.goal&&!a.levelEndStatus[0])&&(a.base.radius+=(a.pwrupActive&&2===a.powerupType?a.base.generation+a.base.generation/2:a.base.generation)*a.dt);for(var b=a.badLines.length;b--;){var d=a.badLines[b],e=d.p1,f=a.base.x-e.x,g=a.base.y-e.y;Math.sqrt(f*f+g*g)<=a.base.radius&&!a.levelEndStatus[0]&&(a.base.radius-=d.damage,a.rumbleLevel=45,a.makeDebrisgroup(a.badLines[b].p1.x,a.badLines[b].p1.y,a.levelHue,50,1,15),a.makeDebrisgroup(a.badLines[b].p1.x,a.badLines[b].p1.y,a.pwrupActive&&0===a.powerupType?205:0,50,1,15),a.makeDebrisLine(a.badLines[b].p1.x,a.badLines[b].p1.y,a.pwrupActive&&0===a.powerupType?205:0,50,a.badLines[b].angle,a.badLines[b].length,30),a.makeBlastgroup(e.x,e.y),a.base.flicker=a.rand(5,12),a.levelStats.baseHits++,a.badLines.splice(b,1))}0===a.rand(0,2)&&a.orbs.push(new a.Orb);0<a.base.flicker&&(a.base.flicker-=1*a.dt);a.base.radius>=a.base.goal&&(a.levelEndStatus=[!0,!0]);2>=a.base.radius&&(a.levelEndStatus=[!0,!1])};a.renderBase=function(){var b=1<=a.base.flicker?a.base.x+a.rand(0,3)-1.5:a.base.x,d=1<=a.base.flicker?a.base.y+a.rand(0,3)-1.5:a.base.y;a.ctx.beginPath();a.ctx.arc(b,d,0>a.base.radius?0:a.base.radius,0,a.pi2,!1);a.ctx.fillStyle=a.pwrupActive&&2===a.powerupType?"hsl("+360*(a.levelStats.ticks%20/20)+", "+(50+50*(a.base.radius/a.base.goal))+"%, "+(50+20*(Math.abs(180-a.base.goalPulseAngle)/180))+"%)":"hsl("+a.levelHue+", "+(50+50*(a.base.radius/a.base.goal))+"%, "+(50+20*(Math.abs(180-a.base.goalPulseAngle)/180))+"%)";a.ctx.fill();a.ctx.save();a.ctx.beginPath();a.ctx.arc(b,d,0>a.base.radius?0:a.base.radius,0,a.pi2,!1);a.ctx.clip();a.ctx.beginPath();a.ctx.arc(b-a.base.radius/3,d-a.base.radius/3,0>a.base.radius?0:1.3*a.base.radius,0,a.pi2,!1);var e=a.ctx.createRadialGradient(b-a.base.radius/3,d-a.base.radius/3,0,b-a.base.radius/3,d-a.base.radius/2,0>a.base.radius?0:1.3*a.base.radius);e.addColorStop(0,"rgba(255,255,255,.3)");e.addColorStop(1,"rgba(255,255,255,0)");a.ctx.fillStyle=e;a.ctx.fill();a.ctx.restore();a.pwrupActive&&2===a.powerupType&&(e=a.base.radius*(a.base.goalPulseAngle/360),e=0>=e?0.01:e,a.ctx.beginPath(),a.ctx.arc(a.base.x,a.base.y,0>e?0:e,0,a.pi2,!1),a.ctx.strokeStyle="rgba(255,255,255,.5)",a.ctx.stroke());1<=a.base.flicker&&(a.ctx.beginPath(),a.ctx.arc(b,d,0>a.base.radius?0:a.base.radius,0,a.pi2,!1),a.ctx.fillStyle="hsla(0, 0%, 100%, "+a.rand(25,100)/100+")",a.ctx.fill(),a.ctx.fillStyle="hsla(0, 0%, 100%, "+a.rand(1,10)/100+")",a.ctx.fillRect(0,0,a.cw,a.ch))};a.renderBaseGoal=function(){var b=0,b=a.levelStats.ticks<=a.initialDelay?a.levelStats.ticks/a.initialDelay*a.base.goal:a.base.goal;a.ctx.beginPath();a.ctx.arc(a.base.x,a.base.y,0>b?0:b,0,a.pi2,!1);a.ctx.strokeStyle="hsla("+a.levelHue+", 100%, 20%, .35)";a.ctx.stroke();a.ctx.lineWidth=2;a.ctx.beginPath();a.ctx.arc(a.base.x,a.base.y,0>b?0:b,a.dToR(a.base.goalPulseAngle),a.dToR(a.base.goalPulseAngle)+Math.PI/3,!1);a.ctx.strokeStyle="hsl("+a.levelHue+", 100%, "+(10+20*(Math.abs(180-a.base.goalPulseAngle)/ 180))+"%)";a.ctx.stroke();a.ctx.beginPath();a.ctx.arc(a.base.x,a.base.y,0>b?0:b,a.dToR(a.base.goalPulseAngle+180),a.dToR(a.base.goalPulseAngle+180)+Math.PI/3,!1);a.ctx.stroke();a.ctx.lineWidth=1.5};a.updatePower=function(){0>a.power.current&&(a.power.current=0);a.power.current<a.power.capacity&&(a.power.current+=a.power.rate*a.dt);a.power.current>a.power.capacity&&(a.power.current=a.power.capacity);a.pwrupActive&&1===a.powerupType&&(a.power.current=a.power.capacity);if(a.mousedown){var b=a.mx-a.tempPointStart.x,d=a.my-a.tempPointStart.y,e=Math.sqrt(b*b+d*d);e<=a.power.current||a.pwrupActive&&1===a.powerupType?(a.tempPointEnd={x:a.mx,y:a.my},a.tempPointLength=e):(b=Math.atan2(d,b),a.tempPointEnd={x:a.tempPointStart.x+Math.cos(b)*a.power.current,y:a.tempPointStart.y+Math.sin(b)*a.power.current},b=a.tempPointEnd.x-a.tempPointStart.x,d=a.tempPointEnd.y-a.tempPointStart.y,a.temptPointLength=Math.sqrt(b*b+d*d))}};a.renderTracer=function(){a.mousedown&&(a.ctx.beginPath(),a.ctx.moveTo(a.tempPointStart.x,a.tempPointStart.y),a.ctx.lineTo(a.mx,a.my),a.ctx.strokeStyle="#222",a.ctx.stroke(),a.ctx.beginPath(),a.ctx.moveTo(a.tempPointStart.x,a.tempPointStart.y),a.ctx.lineTo(a.tempPointEnd.x,a.tempPointEnd.y),a.ctx.strokeStyle="#fff",a.ctx.stroke())};a.goodLine=function(b,d){this.p1=b;this.p2=d;var e=b.x-d.x,f=b.y-d.y;this.length=Math.sqrt(e*e+f*f);this.angle=Math.atan2(f,e);this.pulse=100;this.pulseToggle=!1;this.pulseMin=70;this.pulseMax=100;a.levelStats.goodLineTotal++;a.levelStats.goodLineLength+=this.length};a.goodLine.prototype={update:function(b){this.pulseToggle?(this.pulse+=2,this.pulse>=this.pulseMax&&(this.pulseToggle=!1)):(this.pulse-=2,this.pulse<=this.pulseMin&&(this.pulseToggle=!0));for(var d=a.badLines.length;d--;){var e=a.intersection(this.p1,this.p2,a.badLines[d].p1,a.badLines[d].p2);e&&(a.rumbleLevel=20,a.makeBlastgroup(e.x,e.y),a.badLines[d].destroy(d,e.x,e.y),this.destroy(b,e.x,e.y))}},render:function(){a.ctx.beginPath();a.ctx.moveTo(this.p1.x,this.p1.y);a.ctx.lineTo(this.p2.x,this.p2.y);a.ctx.strokeStyle="hsl(0, 0%, "+this.pulse+"%)";a.ctx.stroke()},destroy:function(b,d,e){d&&e&&a.makeDebrisgroup(d,e,0,100,1,15);a.makeDebrisLine(this.p1.x,this.p1.y,0,100,this.angle,this.length,30);a.goodLines.splice(b,1)}};a.badLine=function(){switch(a.rand(1,4)){case 1:this.p1={x:a.rand(0,a.cw),y:0};break;case 2:this.p1={x:a.cw,y:a.rand(0,a.ch)};break;case 3:this.p1={x:a.rand(0,a.cw),y:a.ch};break;case 4:this.p1={x:0,y:a.rand(0,a.ch)}}this.angle=Math.atan2(a.ch/2-this.p1.y,a.cw/2-this.p1.x);this.length=a.rand(a.levels[a.level].badLengthMin,a.levels[a.level].badLengthMax);this.p2={x:this.p1.x-Math.cos(this.angle)*this.length,y:this.p1.y-Math.sin(this.angle)*this.length};this.speed=a.rand(a.levels[a.level].badSpeedMin,a.levels[a.level].badSpeedMax)/100;this.damage=a.levels[a.level].badDamage-a.upgrades.base.resistance.value[a.user.upgrades.base.resistance];1>this.damage&&(this.damage=1);this.pulse=45;this.pulseToggle=!1;this.pulseMin=30;this.pulseMax=60};a.badLine.prototype={update:function(){var b=a.pwrupActive&&0===a.powerupType?this.speed/ 2:this.speed;this.p1.x+=Math.cos(this.angle)*b*a.dt;this.p2.x+=Math.cos(this.angle)*b*a.dt;this.p1.y+=Math.sin(this.angle)*b*a.dt;this.p2.y+=Math.sin(this.angle)*b*a.dt;this.speed+=a.base.radius/a.base.goal/100;this.pulseToggle?(this.pulse+=2,this.pulse>=this.pulseMax&&(this.pulseToggle=!1)):(this.pulse-=2,this.pulse<=this.pulseMin&&(this.pulseToggle=!0))},render:function(){a.ctx.beginPath();a.ctx.moveTo(this.p1.x,this.p1.y);a.ctx.lineTo(this.p2.x,this.p2.y);a.ctx.strokeStyle=a.pwrupActive&&0===a.powerupType? "hsl("+a.powerupRef[a.powerupType].hue+", 100%, "+this.pulse+"%)":"hsl(0, 100%, "+this.pulse+"%)";a.ctx.stroke()},destroy:function(b,d,e){d&&e&&a.makeDebrisgroup(d,e,a.pwrupActive&&0===a.powerupType?205:0,50,1,15);a.makeDebrisLine(this.p1.x,this.p1.y,a.pwrupActive&&0===a.powerupType?205:0,50,this.angle,this.length,30);a.rand(1,100)<=a.upgrades.coins.chance.value[a.user.upgrades.coins.chance]&&!a.upgradesMaxed&&a.makeCoins(d||this.p1.x,e||this.p1.y,5*(a.level+1),a.rand(1,a.upgrades.coins.amount.value[a.user.upgrades.coins.amount]));if(d&&e&&a.rand(1,100)<=a.upgrades.powerups.chance.value[a.user.upgrades.powerups.chance]&&!a.pwrupActive){var f=a.upgradesMaxed?a.rand(0,2):a.rand(0,3);a.powerups.push(new a.Powerup(d,e,f))}a.badLines.splice(b,1)}};a.makebadLines=function(){a.levelStats.ticks>a.initialDelay&&(a.levels[a.level].badTick>=(a.pwrupActive&&0===a.powerupType?2*a.levels[a.level].badTickMax:a.levels[a.level].badTickMax)?(a.badLines.push(new a.badLine),a.levels[a.level].badTick=0):a.levels[a.level].badTick+=1*a.dt)};a.Coin=function(b,d,e){this.x=b;this.y=d;this.vx=(a.rand(0,100)-50)/100;this.vy=(a.rand(0,100)-50)/100;this.radius=4;this.value=e;this.magnetized=!1;this.xScale=1;this.xScaleGrow=!0;this.collected=!1};a.Coin.prototype={update:function(b){this.xScaleGrow&&1<=this.xScale?this.xScaleGrow=!1:!this.xScaleGrow&&0.1>=this.xScale&&(this.xScaleGrow=!0);this.xScale=this.xScaleGrow?this.xScale+0.05:this.xScale-0.05;if(this.collected)d=a.cw+4-this.x,e=-4-this.y,Math.sqrt(d*d+e*e),e=Math.atan2(e,d),d=Math.cos(e),e=Math.sin(e),this.x+=40*d*a.dt,this.y+=40*e*a.dt;else{var d=a.mx-this.x,e=a.my-this.y,f=Math.sqrt(d*d+e*e);f<=a.upgrades.magnet.range.value[a.user.upgrades.magnet.range]?(this.magnetized=!0,e=Math.atan2(e,d),d=Math.cos(e),e=Math.sin(e),this.x+=d*a.upgrades.magnet.power.value[a.user.upgrades.magnet.power]*a.dt,this.y+=e*a.upgrades.magnet.power.value[a.user.upgrades.magnet.power]*a.dt):(this.magnetized=!1,this.x+=this.vx*a.dt,this.y+=this.vy*a.dt);15>=f&&(a.levelStats.coinsCollected++,a.levelStats.profit+=this.value,this.collected=!0,this.magnetized=!1)}a.arcInRect(this.x,this.y,this.radius,0,0,a.cw,a.ch)||a.coins.splice(b,1)},render:function(){a.ctx.save();a.ctx.translate(this.x,this.y);a.ctx.scale(this.xScale,1);a.ctx.beginPath();a.ctx.arc(0,0,0>this.radius?0:this.radius,0,a.pi2,!1);a.ctx.fillStyle=this.magnetized?"hsl(60, 0%, "+140*this.xScale+"%)":"hsl("+a.levelHue+", 100%, "+70*this.xScale+"%)";a.ctx.fill();a.ctx.restore()}};a.makeCoins=function(b,d,e,f){for(;f--;)setTimeout(function(){a.coins.push(new a.Coin(b+a.rand(0,40)-20,d+a.rand(0,40)-20,e))},10*f)};a.checkCoinPowerup=function(){a.pwrupActive&&3===a.powerupType&&!a.upgradesMaxed?a.coinPowerupTick<a.coinPowerupTickMax?a.coinPowerupTick+=1*a.dt:(a.coinPowerupTick=0,a.makeCoins(a.rand(0,a.cw),a.rand(0,a.ch),5*(a.level+1),1)):a.coinPowerupTick=0};a.Powerup=function(b,d,e){this.x=b;this.y=d;this.vx=(a.rand(0,100)-50)/50;this.vy=(a.rand(0,100)-50)/50;this.radius=12;this.type=e;this.magnetized=!1;this.angle=0};a.Powerup.prototype={update:function(b){this.angle=360>this.angle?this.angle+5:0;var d=a.mx-this.x,e=a.my-this.y,f=Math.sqrt(d*d+e*e);f<=a.upgrades.magnet.range.value[a.user.upgrades.magnet.range]?(this.magnetized=!0,e=Math.atan2(e,d),d=Math.cos(e),e=Math.sin(e),this.x+=d*a.upgrades.magnet.power.value[a.user.upgrades.magnet.power]/4*a.dt,this.y+=e*a.upgrades.magnet.power.value[a.user.upgrades.magnet.power]/4*a.dt):(this.magnetized=!1,this.x+=this.vx*a.dt,this.y+=this.vy*a.dt);15>=f&&(a.levelStats.powerupsCollected++,a.pwrupActive=!0,a.powerupType=this.type,a.pwrupTimer=60*a.upgrades.powerups.duration.value[a.user.upgrades.powerups.duration],a.pwrupTimerMax=60*a.upgrades.powerups.duration.value[a.user.upgrades.powerups.duration],a.powerups.length=0);a.arcInRect(this,this.y,this.radius,0,0,a.cw,a.ch)||a.powerups.splice(b,1)},render:function(){a.ctx.save();a.ctx.translate(this.x,this.y);a.ctx.rotate(a.dToR(this.angle));a.ctx.lineWidth=6;var b=50+15*(Math.abs(180-this.angle)/180);a.ctx.strokeStyle="hsl("+a.powerupRef[this.type].hue+", 100%, "+b+"%)";a.ctx.beginPath();a.ctx.arc(0,0,0>this.radius?0:this.radius,0,a.dToR(60),!1);a.ctx.stroke();a.ctx.beginPath();a.ctx.arc(0,0,0>this.radius?0:this.radius,a.dToR(120),a.dToR(180),!1);a.ctx.stroke();a.ctx.beginPath();a.ctx.arc(0,0,0>this.radius?0:this.radius,a.dToR(240),a.dToR(300),!1);a.ctx.stroke();a.ctx.restore()}};a.updateActivePowerup=function(){a.pwrupActive&&(0<a.pwrupTimer?a.pwrupTimer-=1*a.dt:(a.pwrupTimer=0,a.pwrupTimerMax=0,a.pwrupActive=!1))};a.Blast=function(b,d){this.x=b;this.y=d;this.radius=a.rand(4,18)};a.Blast.prototype={update:function(b){this.radius-=0.65*a.dt;0>=this.radius&&a.blasts.splice(b,1)},render:function(){var b=this.radius+a.rand(0,2)/3;a.ctx.beginPath();a.ctx.arc(this.x+a.rand(0,2)-1,this.y+a.rand(0,2)-1,0>b?0:b,0,a.pi2,!1);a.ctx.fillStyle="hsla("+a.levelHue+", 100%, "+a.rand(50,80)+"%, "+a.rand(50,100)/100+")";a.ctx.fill()}};a.makeBlastgroup=function(b,d){a.blasts.push(new a.Blast(b,d));a.blasts.push(new a.Blast(b+a.rand(0,10)-5,d+a.rand(0,10)-5));a.blasts.push(new a.Blast(b+a.rand(0,10)-5,d+a.rand(0,10)-5))};a.Debris=function(b,d,e,f,g){this.x=b;this.y=d;this.size=a.rand(1,3)/2;this.speed=(a.rand(0,g)-g/2)/20;this.angle=a.rand(0,360);this.hue=e;this.saturation=100;this.lightness=f;this.alpha=a.rand(75,100)/100;this.decay=a.rand(50,100)/5E3};a.Debris.prototype={update:function(b){var d=a.dToR(this.angle),e=Math.cos(d)*this.speed*this.alpha,d=Math.sin(d)*this.speed*this.alpha;this.x+=e*a.dt;this.y+=d*a.dt;this.alpha-=this.decay*a.dt;0>=this.alpha&&a.debris.splice(b,1)},render:function(){a.ctx.fillStyle="hsla("+this.hue+", "+this.saturation+"%, "+this.lightness+"%, "+this.alpha+")";a.ctx.fillRect(this.x,this.y,this.size,this.size)}};a.makeDebrisgroup=function(b,d,e,f,g,h){for(;h--;){var i=Math.random()*g,j=Math.random()*a.pi2,l=b+Math.cos(j)*i,i=d+Math.sin(j)*i;a.debris.push(new a.Debris(l,i,e,f,100))}};a.makeDebrisLine=function(b,d,e,f,g,h,i){for(;i--;){var j=a.rand(0,h),l=b-Math.cos(g)*j,j=d-Math.sin(g)*j;a.debris.push(new a.Debris(l,j,e,f,20))}};a.Orb=function(){this.x=a.base.x;this.y=a.base.y;this.vx=(a.rand(0,100)-50)/2E4*a.base.radius;this.vy=(a.rand(0,100)-50)/2E4*a.base.radius;this.radius=a.rand(1,4)/4;this.alpha=0;this.alphaMax=a.rand(75,100)/100;this.alphaTrigger=!1;this.decay=a.rand(50,100)/4E3;this.growth=a.rand(50,100)/5E3};a.Orb.prototype={update:function(b){this.x+=this.vx*a.dt;this.y+=this.vy*a.dt;this.alphaTrigger?(this.alpha-=this.decay*a.dt,0>=this.alpha&&a.orbs.splice(b,1)):(this.alpha+=this.growth*a.dt,this.alpha>=this.alphaMax&&(this.alphaTrigger=!0))},render:function(){a.ctx.beginPath();a.ctx.arc(this.x,this.y,0>this.radius?0:this.radius,0,a.pi2,!1);a.ctx.fillStyle="hsla("+a.levelHue+", "+(50+50*(a.base.radius/a.base.goal))+"%, "+(50+20*(Math.abs(180-a.base.goalPulseAngle)/180))+"%, "+this.alpha+")";a.ctx.fill()}};a.Star=function(a,d,e,f){this.x=a;this.y=d;this.speed=f/25;this.radius=e;this.saturation=30+5*this.radius;this.lightness=8+3*this.radius};a.Star.prototype={update:function(){this.y+=this.speed*a.dt;this.y-this.radius>=a.ch&&(this.x=a.rand(0,a.cw-this.radius),this.y=-this.radius)},render:function(){a.ctx.beginPath();a.ctx.arc(this.x,this.y,0>this.radius?0:this.radius,0,a.pi2,!1);var b=0===a.rand(0,30)?a.rand(5,15):0;a.ctx.fillStyle="hsl("+a.levelHue+", "+this.saturation+"%, "+(this.lightness+b)+"%)";a.ctx.fill()}};a.makeStarfield=function(){for(var b=7;b--;){var d=1;a.stars.push(new a.Star(a.rand(0,a.cw-d),a.rand(0,a.ch-d),d,0.75));d+=0.25;a.stars.push(new a.Star(a.rand(0,a.cw-d),a.rand(0,a.ch-d),d,2));d+=0.25;a.stars.push(new a.Star(a.rand(0,a.cw-d),a.rand(0,a.ch-d),d,3.25));d+=0.25;a.stars.push(new a.Star(a.rand(0,a.cw-d),a.rand(0,a.ch-d),d,4.5));d+=0.25;a.stars.push(new a.Star(a.rand(0,a.cw-d),a.rand(0,a.ch-d),d,5.75));d+=0.25;a.stars.push(new a.Star(a.rand(0,a.cw-d),a.rand(0,a.ch-d),d,7))}};a.updateUI=function(){var b=2<=a.base.radius?Math.round(a.base.radius):0;a.ui.ratioComplete=b+"/"+a.base.goal;a.ui.percentComplete=Math.round(100*(b/a.base.goal))};a.renderUI=function(){if(a.levelStats.ticks<=a.initialDelay){a.ctx.save();var b=(a.initialDelay-a.levelStats.ticks)/100;a.ctx.globalAlpha=1<b?1:b;a.ctx.globalCompositeOperation="source-over";b=32+a.level;a.ctx.font="bold "+b+"px arial";a.ctx.textBaseline="middle";a.ctx.textAlign="center";a.ctx.beginPath();a.ctx.arc(a.cw/2,a.ch/2,0>a.base.goal?0:a.base.goal,0,a.pi2,!1);a.ctx.fillStyle="#000";a.ctx.fill();a.ctx.strokeStyle="#171717";a.ctx.stroke();b=a.ctx.createLinearGradient(a.cw/2,a.ch/2-b/2,a.cw/2,a.ch/2+b/2);b.addColorStop(0,"hsla("+a.levelHue+", 100%, 70%, 1)");b.addColorStop(1,"hsla("+a.levelHue+", 100%, 40%, 1)");a.ctx.fillStyle=b;a.ctx.fillText(a.level+1,a.cw/2,a.ch/2);a.ctx.restore()}a.ctx.fillStyle="#aaa";a.ctx.textAlign="left";a.ctx.font="bold 10px arial";a.ctx.fillText("Completion: "+a.ui.ratioComplete+" ("+a.ui.percentComplete+"%)",12,20);a.ctx.fillText("Power: "+Math.round(a.power.current)+"/"+a.power.capacity+" ("+Math.round(100*(a.power.current/a.power.capacity))+"%)",156,20);var b=Date.now()-a.levelStats.startTime-a.levelStats.pauseTimeTotal,d=Math.floor(b/1E3)% 60,b="",b=0+100*d+100*a.levelStats.goodLineTotal,b=b+a.levelStats.goodLineLength,b=b+500*a.levelStats.baseHits,d=0;a.ctx.fillStyle="#aaa";a.ctx.textAlign="right";a.ctx.font="bold 10px arial";d=a.ctx.measureText("Profit");a.ctx.fillText("Profit",a.cw-12,20);a.ctx.fillStyle="#fff";a.ctx.font="bold 12px arial";var e=a.ctx.measureText("$"+a.commas(a.levelStats.profit));a.ctx.fillText("$"+a.commas(a.levelStats.profit),a.cw-12,37);d=Math.max(d.width,e.width);a.ctx.fillStyle="#aaa";a.ctx.textAlign="right";a.ctx.font="bold 10px arial";a.ctx.fillText("Score",a.cw-d-36,20);a.ctx.fillStyle="#fff";a.ctx.font="bold 12px arial";a.ctx.fillText(a.commas(Math.round(b)),a.cw-d-36,37);a.ctx.fillStyle="#222";a.ctx.fillRect(12,30,120,8);a.ctx.fillStyle="hsl("+a.levelHue+", "+(50+50*(a.base.radius/a.base.goal))+"%, "+(50+20*(Math.abs(180-a.base.goalPulseAngle)/180))+"%)";a.ctx.fillRect(12,30,120*(a.base.radius/a.base.goal),8);b=a.ctx.createLinearGradient(12,30,12,34);b.addColorStop(0,"rgba(255,255,255,0)");b.addColorStop(1,"rgba(255,255,255,.2)");a.ctx.fillStyle=b;a.ctx.fillRect(12,30,120,4);a.ctx.fillStyle="#222";a.ctx.fillRect(156,30,120,8);a.ctx.fillStyle="hsl(0, 0%, "+60*(a.power.current/a.power.capacity)+"%)";a.ctx.fillRect(156,30,120*(a.power.current/a.power.capacity),8);b=a.ctx.createLinearGradient(156,30,156,34);b.addColorStop(0,"rgba(255,255,255,0)");b.addColorStop(1,"rgba(255,255,255,.2)");a.ctx.fillStyle=b;a.ctx.fillRect(156,30,120,4);a.pwrupActive&&(a.ctx.fillStyle="#aaa",a.ctx.textAlign="left",a.ctx.font="bold 10px arial",a.ctx.fillText(a.powerupRef[a.powerupType].name,300,20),a.ctx.fillStyle="#222",a.ctx.fillRect(300,30,120,8),a.ctx.fillStyle="hsl("+a.powerupRef[a.powerupType].hue+", 100%, "+(20+30*(a.pwrupTimer/a.pwrupTimerMax))+"%)",a.ctx.fillRect(300,30,120*(a.pwrupTimer/a.pwrupTimerMax),8),b=a.ctx.createLinearGradient(300,30,300,34),b.addColorStop(0,"rgba(255,255,255,0)"),b.addColorStop(1,"rgba(255,255,255,.2)"),a.ctx.fillStyle=b,a.ctx.fillRect(300,30,120,4))};a.levelEndCycle=function(){a.levelEndStatus[0]&&(a.levelEndTick>=a.levelEndTickMax?a.endLevel():a.levelEndTick+=1*a.dt,a.ctx.globalCompositeOperation="source-over",a.levelEndStatus[1]?(a.destroyAll(a.badLines),a.rumbleLevel+=0.01*a.dt,a.ctx.fillStyle="rgba(255,255,255,"+a.levelEndTick/100+")"):(a.destroyAll(a.goodLines),a.ctx.fillStyle="rgba(70,0,0,"+a.levelEndTick/100+")"),a.ctx.fillRect(0,0,a.cw,a.ch),a.ctx.globalCompositeOperation="lighter")};a.endLevel=function(){clearTimeout(a.loopTimeout);a.levelPlaying=!1;a.levelStats.endTime=Date.now();a.levelStatsCB(a.levelEndStatus[1]);a.level>=a.user.highestLevelBeaten&&a.levelEndStatus[1]&&(a.user.highestLevelBeaten=a.level+1);a.levelEndStatus[1]&&0===a.levelStats.baseHits&&(a.user.levels[a.level].perfect=!0);a.user.funds+=a.levelStats.profit;a.user.overall.linesCreated+=a.levelStats.goodLineTotal;a.user.overall.lineLength+=Math.round(a.levelStats.goodLineLength);a.user.overall.baseHits+=a.levelStats.baseHits;a.user.overall.levelsPlayed+=1;a.user.overall.timePlayed+=a.levelStats.endTime-a.levelStats.startTime- a.levelStats.pauseTimeTotal;a.updateUser()};a.mousedownCB=function(){a.mousedown=!0;a.menuMode||(a.tempPointStart={x:a.mx,y:a.my})};a.mouseupCB=function(){a.mousedown=!1;if(!a.menuMode&&(a.tempPointStart.x!=a.tempPointEnd.x||a.tempPointStart.y!=a.tempPointEnd.y))a.goodLines.push(new a.goodLine(a.tempPointStart,a.tempPointEnd)),a.power.current-=a.tempPointLength};a.mousemoveCB=function(b){a.mx=b.pageX-a.c.offsetLeft-a.gameWrap.offsetLeft;a.my=b.pageY-a.c.offsetTop-a.gameWrap.offsetTop};a.bindGameplayEvents=function(){h.addEventListener("mousedown",a.mousedownCB,!1);h.addEventListener("mouseup",a.mouseupCB,!1);h.addEventListener("mousemove",a.mousemoveCB,!1)};a.syncDOM=function(){a.fundsDisplay.innerHTML=a.checkMaxUpgrades()?"$ Maxed":"$"+a.commas(a.user.funds);for(var b=a.upgradeButtons.length;b--;){var d=a.upgradeButtons[b],e=d.getAttribute("data-parent"),f=d.getAttribute("data-specific"),g=a.user.upgrades[e][f],e=a.upgrades[e][f].cost[g]||!1;a.rmvClass(d,"upg0");a.rmvClass(d,"upg1");a.rmvClass(d,"upg2");a.rmvClass(d,"upg3");a.rmvClass(d,"upg4");a.rmvClass(d,"upg5");a.addClass(d,"upg"+g);var g=d.querySelectorAll(".cost"),h=(f=!e||e<=a.user.funds)?'<i class="available">Available</i>':'<i class="unavailable">Unavailable</i>';g[0].innerHTML=!e?"Maxed":"$"+a.commas(e)+" - "+h;f?a.rmvClass(d,"disabled"):a.addClass(d,"disabled");e?a.rmvClass(d,"max"):a.addClass(d,"max")}for(b=a.levelButtons.length;b--;)b>a.user.highestLevelBeaten?a.addClass(a.levelButtons[b],"disabled"):a.rmvClass(a.levelButtons[b],"disabled"),a.user.levels[b].perfect?a.addClass(a.levelButtons[b],"perfect-level"):a.rmvClass(a.levelButtons[b],"perfect-level"),a.levelScores[b].innerHTML=0==a.user.levels[b].score?"∅":a.commas(a.user.levels[b].score);d=0;e=a.user.levels.length;for(b=0;b<e;b++)a.user.levels[b].perfect&&d++;a.completedLevelsDisplay.innerHTML=a.user.highestLevelBeaten;a.perfectLevelsDisplay.innerHTML=d};a.menus=h.querySelectorAll(".menu");a.mainMenu=a.get("main");a.pauseMenu=a.get("pause");a.upgradesLevelsMenu=a.get("upgrades-levels");a.levelStatsMenu=a.get("level-stats");a.overallStatsMenu=a.get("overall-stats");a.statsStatus=a.get("stats-status");a.statsDuration=a.get("stats-duration");a.statsLinesCreated=a.get("stats-lines-created");a.statsTotalLineLength=a.get("stats-total-line-length");a.statsBaseHits=a.get("stats-base-hits");a.statsPowerupsCollected=a.get("stats-powerups-collected");a.statsCoinsCollected=a.get("stats-coins-collected");a.statsProfit=a.get("stats-profit");a.statsScore=a.get("stats-score");a.overallStatsLinesCreated=a.get("overall-lines-created");a.overallStatsLineLength=a.get("overall-line-length");a.overallStatsLevelsPlayed=a.get("overall-levels-played");a.overallStatsTimePlayed=a.get("overall-time-played");a.overallStatsBaseHits=a.get("overall-base-hits");a.playGameButton=a.get("play-game-button");a.retryLevelButton=a.get("retry-level-button");a.returnToMenuButton=a.get("return-to-menu-button");a.returnToMenuButton2=a.get("return-to-menu-button2");a.returnToUpgradesLevelsButton=a.get("return-to-upgrades-levels-button");a.resumeLevelButton=a.get("resume-level-button");a.quitLevelButton=a.get("quit-level-button");a.resetGameDataButton=a.get("reset-game-data-button");a.overallStatsButton=a.get("overall-stats-button");a.upgradeButtons=h.querySelectorAll(".upgrade");a.levelButtons=h.querySelectorAll(".level");a.levelScores=h.querySelectorAll(".level-score");a.completedLevelsDisplay=a.get("completed-levels");a.perfectLevelsDisplay=a.get("perfect-levels");a.fundsDisplay=a.get("funds");a.pausedTitle=a.get("paused-title");a.hideMenus=function(){for(var b=a.menus.length;b--;)a.menus[b].style.display="none"};a.playGameCB=function(b){b.preventDefault();a.hideMenus();a.upgradesLevelsMenu.style.display="block"};a.startLevelCB=function(b){b.preventDefault();a.hasClass(this,"disabled")||(a.hideMenus(),b=parseInt(this.getAttribute("rel"),10),a.initLevel(b))};a.pauseLevelCB=function(b){if(("32"==b.keyCode||"click"==b.type)&&a.levelPlaying)b.preventDefault(),a.menuMode?(a.hideMenus(),a.menuMode=!1,a.oldTime=Date.now(),a.loop(),a.levelStats.pauseTimeTotal+=Date.now()-a.levelStats.pauseStartTime):(a.pausedTitle.innerHTML="Level "+(a.level+1)+" Paused",a.levelStats.pauseStartTime=Date.now(),a.menuMode=!0,a.pauseMenu.style.display="block")};a.retryLevelCB=function(b){b.preventDefault();clearTimeout(a.loopTimeout);a.hideMenus();a.initLevel(a.level)};a.returnToMenuCB=function(b){b.preventDefault();clearTimeout(a.loopTimeout);a.hideMenus();a.mainMenu.style.display="block"};a.returnToUpgradesLevelsCB=function(b){b.preventDefault();clearTimeout(a.loopTimeout);a.hideMenus();a.upgradesLevelsMenu.style.display="block"};a.quitLevelCB=function(b){b.preventDefault();a.hideMenus();a.menuMode=!1;a.base.radius=0;a.levelEndTick=a.levelEndTickMax;a.loop()};a.resetGameDataCB=function(b){b.preventDefault();confirm("Are you sure you want to reset your game data? This cannot be undone.")&&a.clearUser()};a.upgradeButtonCB=function(b){b.preventDefault();if("tip"!=b.target.className&&(a.hasClass(this,"disabled")&&(a.addClass(a.fundsDisplay,"not-enough"),setTimeout(function(){a.rmvClass(a.fundsDisplay,"not-enough")},300)),!a.hasClass(this,"disabled")&&!a.hasClass(this,"max"))){var b=this.getAttribute("data-parent"),d=this.getAttribute("data-specific"),e=a.upgrades[b][d].cost[a.user.upgrades[b][d]]||!1;a.user.upgrades[b][d]++;a.user.funds-=e;a.updateUser();a.syncDOM()}};a.levelStatsCB=function(b){a.menuMode=!0;a.hideMenus();var d=a.levelStats.endTime-a.levelStats.startTime-a.levelStats.pauseTimeTotal,e=Math.floor(d/ 1E3/60),d=Math.floor(d/1E3)%60,f="";a.levelStats.score=0;a.levelStats.score+=100*d;a.levelStats.score+=100*a.levelStats.goodLineTotal;a.levelStats.score+=a.levelStats.goodLineLength;a.levelStats.score+=500*a.levelStats.baseHits;d=10>d?"0"+d:d;if(b&&(0==a.user.levels[a.level].score||a.levelStats.score<a.user.levels[a.level].score))a.user.levels[a.level].score=Math.round(a.levelStats.score),f='<br /><span class="best-score">New Best Score!</span>';a.retryLevelButton.style.display=b?"none":"block";a.statsStatus.innerHTML=b?'<span class="level-success">Level '+(a.level+1)+" Completed Successfully":'<span class="level-fail">Level '+(a.level+1)+" Failed</span>";a.statsDuration.innerHTML=e+":"+d;a.statsLinesCreated.innerHTML=a.levelStats.goodLineTotal;a.statsTotalLineLength.innerHTML=1<=a.levelStats.goodLineTotal?Math.round(a.levelStats.goodLineLength)+'px <span class="td-note">('+Math.round(a.levelStats.goodLineLength/a.levelStats.goodLineTotal)+" Avg.)</span>":0;a.statsBaseHits.innerHTML=b&&0===a.levelStats.baseHits? a.levelStats.baseHits+' <span class="perfect">Perfect!</span>':a.levelStats.baseHits;a.statsPowerupsCollected.innerHTML=a.levelStats.powerupsCollected;a.statsCoinsCollected.innerHTML=a.levelStats.coinsCollected;a.statsProfit.innerHTML="$"+a.commas(a.levelStats.profit);a.statsScore.innerHTML=b?a.commas(Math.round(a.levelStats.score))+' <span class="td-note">(Lower is Better)</span>'+f:a.commas(Math.round(a.levelStats.score))+' <span class="td-note na">(Not Applied)</span>';a.levelStatsMenu.style.display="block"};a.overallStatsCB=function(b){b.preventDefault();a.menuMode=!0;a.hideMenus();var d=a.user.overall.timePlayed,b=Math.floor(d/1E3/60),d=Math.floor(d/1E3)%60,d=10>d?"0"+d:d;a.overallStatsLinesCreated.innerHTML=a.commas(a.user.overall.linesCreated);a.overallStatsLineLength.innerHTML=a.commas(a.user.overall.lineLength)+' <em class="td-note">(pixels)</em><br /><em class="td-note">That\'s</em> '+(a.user.overall.lineLength/72/12).toFixed(1)+' <em class="td-note">feet at 72ppi</em>';a.overallStatsLevelsPlayed.innerHTML=a.commas(a.user.overall.levelsPlayed);a.overallStatsTimePlayed.innerHTML=b+":"+d+' <em class="td-note">(minutes:seconds)</em>';a.overallStatsBaseHits.innerHTML=a.commas(a.user.overall.baseHits);a.overallStatsMenu.style.display="block"};a.bindMenuEvents=function(){h.addEventListener("keydown",a.pauseLevelCB,!1);a.playGameButton.addEventListener("click",a.playGameCB,!1);a.retryLevelButton.addEventListener("click",a.retryLevelCB,!1);a.returnToMenuButton.addEventListener("click",a.returnToMenuCB,!1);a.returnToMenuButton2.addEventListener("click",a.returnToMenuCB,!1);a.returnToUpgradesLevelsButton.addEventListener("click",a.returnToUpgradesLevelsCB,!1);a.resumeLevelButton.addEventListener("click",a.pauseLevelCB,!1);a.quitLevelButton.addEventListener("click",a.quitLevelCB,!1);a.resetGameDataButton.addEventListener("click",a.resetGameDataCB,!1);a.overallStatsButton.addEventListener("click",a.overallStatsCB,!1);for(var b=a.upgradeButtons.length;b--;)a.upgradeButtons[b].addEventListener("click",a.upgradeButtonCB,!1);for(b=a.levelButtons.length;b--;)a.levelButtons[b].addEventListener("click",a.startLevelCB,!1)};a.loop=function(){a.updateDelta();0<a.rumbleLevel&&(a.rumble=!0,a.ctx.save(),a.updateRumble(),a.ctx.translate(a.rand(0,a.rumbleLevel/4)-a.rumbleLevel/8,a.rand(0,a.rumbleLevel/4)-a.rumbleLevel/8));a.clear();a.updateAll(a.stars);a.renderAll(a.stars);a.renderBaseGoal();a.updateAll(a.coins);a.renderAll(a.coins);a.checkCoinPowerup();a.updateAll(a.powerups);a.renderAll(a.powerups);a.updateActivePowerup();a.makebadLines();a.updateAll(a.badLines);a.renderAll(a.badLines);a.updatePower();a.updateAll(a.goodLines);a.renderAll(a.goodLines);a.updateBase();a.renderBase();a.updateAll(a.orbs);a.renderAll(a.orbs);a.updateAll(a.blasts);a.renderAll(a.blasts);a.updateAll(a.debris);a.renderAll(a.debris);a.renderTracer();a.updateUI();a.renderUI();a.levelEndCycle();a.rumble&&(a.ctx.restore(),a.rumble=!1);a.levelStats.ticks++;a.menuMode||(a.loopTimeout=setTimeout(a.loop,16))}},z=document.createElement("canvas");if(z.getContext&&z.getContext("2d")){var sp=new SpacePi;sp.initGame()}else{var homeWrap=document.getElementById("home-wrap"),noCanvas=document.getElementById("no-can");homeWrap.style.display="none";noCanvas.style.display="block"};</script></body></html>