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
# This function was modeled on jQuery’s $.type | |
# function. (http://api.jquery.com/jQuery.type/) | |
# Note that, as an alternative to type checking, | |
# you can often use duck typing and the existential | |
# operator together to eliminating the need to examine | |
# an object’s type, in certain cases. | |
type = (obj) -> | |
if obj == undefined or obj == null | |
return String obj | |
classToType = new Object |
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
// Generated by CoffeeScript 1.3.3 | |
(function() { | |
var app, fs, handler, io; | |
app = require('http').createServer(handler); | |
io = require('socket.io').listen(app); | |
fs = require('fs'); | |
app.listen(8100); | |
handler = function(request, response) { | |
return fs.readFile(__dirname + '/index.html', function(error, data) { |
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
#world | |
position relative | |
canvas | |
position absolute | |
top 0 | |
left 0 | |
width 800px | |
height 600px | |
outline "1px #f00 solid" |
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
# player_manager.coffee | |
module.exports = new PlayerManager() | |
# server.coffee | |
playerManager = require 'player_manager' | |
# map_manager.coffee | |
playerManager = require 'player_manager' |
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
# managers.coffee | |
managers = | |
playerManager : require 'player_manager', | |
spriteManager : require 'sprite_manager', | |
tileManager : require 'tile_manager', | |
mapManager : require 'map_manager' | |
module.exports = managers |
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
# Load managers required by chronicle | |
managers = require "#{paths.shared}/managers" | |
{ playerManager, | |
spriteManager, | |
tileManager, | |
mapManager } = managers |
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
# managers.coffee | |
managers = | |
playerManager: require './managers/player' | |
spriteManager: require './managers/sprite' | |
tileManager: require './managers/tile' | |
mapManager: require './managers/map' | |
# server.coffee | |
# Load managers required by chronicle | |
managers = require "#{paths.shared}/managers" |
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
clone = (obj) -> | |
if not obj? or typeof obj isnt 'object' | |
return obj | |
if obj instanceof Date | |
return new Date(obj.getTime()) | |
if obj instanceof RegExp | |
flags = '' | |
flags += 'g' if obj.global? |
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
### | |
### | |
mapCanvas = document.getElementById 'map' | |
createCanvas = (width, height) -> | |
canvas = document.createElement 'canvas' | |
canvas.width = width | |
canvas.height = height | |
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
body { | |
background-color: #4080E0; | |
font-family: "Helvetica Neue", Helvetica, sans-serif; | |
font-size: 0.8em; | |
} | |
a { | |
border: none; | |
color: #000000; | |
} | |
a:visited { |