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
# developer console | |
inputEle = null # the console's Prompt (an html input) | |
dispEle = null # the console's output (a div, span, etc) | |
submitAction = null # function to run on the input | |
enabled = false | |
exports.enable = () -> | |
# ensures html elements have been specified | |
# ensures that the console is not already active | |
if inputEle && dispEle && !enabled |
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
// a fat hitbox around the player considered the 'relevant' area for a collision | |
var hitArea = new AABB({x: player.x, y: player.y}, { x: 54, y : 54}) | |
var actualHitArea = new AABB({x: player.x, y: player.y}, { x: 36, y : 36}) | |
// how behind the player is, in server time | |
var delay = player.ping + (1000 / player.tickRate) | |
var tickLength = 1000 / TICKS_PER_SECOND | |
var ticksAgo = Math.floor(delay / tickLength) | |
var tickPortion = (delay % tickLength) / tickLength |
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
<script type="text/javascript"> | |
$(document).ready(function() { | |
// your twitch channel name | |
var twitchName = 'yourchannelname' | |
// an element on your page to put the widget into | |
var elementSelector = '#streaming' | |
// HTML to display while waiting for data |
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 id='streaming'></div> |
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
/* Entity Interpolation | |
this code occurs within the draw loop for an entity | |
this.x and this.y represent the most recently received server position of | |
the entity -- though i don't ever intend to use it for drawing | |
when an update is received (roughly every 50ms in my particular game) this.x and this.y get | |
pushed into previousState.x and previousState.y | |
i also continue sloppily onwards to previousPreviousState.x, but I've removed that code | |
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
// a simple game entity having a name and positional data | |
function Entity(name) { | |
this.name = name | |
this.x = 0 | |
this.y = 0 | |
this.speed = 5 | |
} | |
module.exports = Entity |
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
{ | |
"_links":{ | |
"self":"https://api.twitch.tv/kraken/streams/neuronimo", | |
"channel":"https://api.twitch.tv/kraken/channels/neuronimo" | |
}, | |
"stream":{ | |
"_id":11162399536, | |
"game":"Awesomenauts", | |
"viewers":2, | |
"created_at":"2014-09-24T16:31:38Z", |
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
<!-- jQuery, delete this line if you already have jQuery on your page --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<!-- the twitch widget, place code in the <HEAD> --> | |
<script> | |
var twitchUserName = 'timetocode' // your name goes here | |
$(document).ready(function() { | |
$.getJSON("https://api.twitch.tv/kraken/streams/"+twitchUserName+"?callback=?",function(streamData) { | |
console.log('Stream Data:', streamData) // debug message, shows all available data | |
if(streamData && streamData.stream) { |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using SimplexNoise; | |
using System.Drawing; | |
namespace SimplexExample | |
{ |
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 BinarySerializer = require('./BinarySerializer') | |
//var BinaryType = require('./BinaryType') | |
// axis-aligned bounding box | |
/* PARAMS: (Point)center, (Point)half */ | |
function AABB(x, y, halfWidth, halfHeight) { | |
this.initialize(x, y, halfWidth, halfHeight) | |
} | |
AABB.pool = [] |
OlderNewer