This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="hitarea"> | |
| <div id="a-1" class="hitbox"></div> | |
| <div id="a-2" class="hitbox"></div> | |
| <div id="a-3" class="hitbox"></div> | |
| <div id="a-4" class="hitbox"></div> | |
| <div id="a-5" class="hitbox"></div> | |
| <div id="b-1" class="hitbox"></div> | |
| <div id="b-2" class="hitbox"></div> | |
| <div id="b-3" class="hitbox"></div> | |
| <div id="b-4" class="hitbox"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <canvas id="canvas"></canvas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <canvas id="canvas"></canvas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getOffsetRect(elem) { | |
| var box = elem.getBoundingClientRect(), | |
| body = document.body, | |
| docElem = document.documentElement, | |
| scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop, | |
| scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft, | |
| clientTop = docElem.clientTop || body.clientTop || 0, | |
| clientLeft = docElem.clientLeft || body.clientLeft || 0, | |
| top = box.top + scrollTop - clientTop, | |
| left = box.left + scrollLeft - clientLeft, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function post(url, data, callback){ | |
| var ajaxRequest = new XMLHttpRequest(); | |
| ajaxRequest.onreadystatechange = function(){ | |
| if(ajaxRequest.readyState == 4 || ajaxRequest.readyState == 200){ | |
| callback(ajaxRequest.responseText); | |
| } | |
| } | |
| ajaxRequest.open("POST", url); | |
| ajaxRequest.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //FightCode can only understand your robot | |
| //if its class is called Robot | |
| var Robot = function(robot) { | |
| this.rotate = 1; | |
| this.dist = 0; | |
| this.lastAngle = 0; | |
| }; | |
| Robot.prototype.onIdle = function(ev) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Robot = function(robot) { | |
| this.rotate = 360; | |
| this.dist = 0; | |
| this.lastAngle = 0; | |
| }; | |
| Robot.prototype.onIdle = function(ev) { | |
| var robot = ev.robot; | |
| robot.turn(this.rotate); | |
| this.lastAngle = this.rotate; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="attribution"> | |
| <a href="https://soundcloud.com/term-and-conditions-mixes/new-year-dubstep-minimix">New Year Dubstep Minimix By Terms and Conditions</a> | |
| </div><br/> | |
| <canvas id="playCanvas"></canvas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function r() { | |
| return Math.floor(Math.random() * 255); | |
| } | |
| function lemon() { | |
| var cycle = parseFloat(this.dataset.cycle); | |
| if(isNaN(cycle)){ | |
| cycle = ~~(Math.random()*100); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * jGame.update() | |
| * | |
| * Main update loop for the game, updates all objects, and calls the renderer. | |
| **/ | |
| update : function(){ | |
| var curTime = (new Date()).getTime(), | |
| update = this.update; | |
| this.deltaTime = curTime - this.lastTime; |