This file contains 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
/* | |
* | |
* What Im trying to get to work | |
* | |
*/ | |
function playersGameName(options){ | |
// stuff in here to init whatevs. | |
} |
This file contains 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
console.log('%cTHIS IS SO MUCH FUN', 'color:red; background:yellow; font-size: 2em;') |
This file contains 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
javascript:(function(){var script=document.createElement('script');script.src='http://github.com/mrdoob/stats.js/raw/master/build/stats.min.js';document.body.appendChild(script);script=document.createElement('script');script.innerHTML='var interval=setInterval(function(){if(typeof Stats==\'function\'){clearInterval(interval);var stats=new Stats();stats.domElement.style.position=\'fixed\';stats.domElement.style.left=\'0px\';stats.domElement.style.top=\'0px\';stats.domElement.style.zIndex=\'10000\';document.body.appendChild(stats.domElement);setInterval(function(){stats.update();},1000/60);}},100);';document.body.appendChild(script);})(); |
This file contains 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; |
This file contains 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 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 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 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 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 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, |