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
require('thorny/base')('./config/default.json')(function ($) { | |
// Grab a copy of the entity system object | |
var entitySystem = $('thorny entity-system'); | |
// Make the actor template | |
entitySystem.makeEntity($.defined('template')) | |
.addTag('actor') | |
.addComponent('position') | |
.addComponent('keys') | |
.addComponent('render-2d'); |
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
[ | |
"thorny math vector2", | |
"./config/other.json" | |
] |
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
require('./thorny/base')('./config/default.json', function ($) { | |
if ($.dooooom().makeHappen() === $('thorny some-dooms-day-feature').makeHappen()) { | |
// serve cake, because cake and dooooom is an ideal pairing. | |
} | |
}); |
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
require('./thorny/base')('./config/default.json', function ($) { | |
// Register a component so we can use it below. | |
$.es().registerComponent('load-level', function () { | |
return { | |
// Used to enable the isReady function. | |
asynchronousAttachEvent: 'world-loaded', | |
// Called in response to .addComponent() | |
attach: function (entity, filename) { | |
$.ajax({ |
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
/*global console window describe xdescribe it expect runs waits*/ | |
(function () { | |
require.paths.unshift(__dirname + '/../../../'); | |
require('thorny/base')('./config/default.json')(function ($) { | |
describe('a vector2', function () { | |
it('should contain the following functions', function () { | |
var vector2 = $('thorny math vector2'); | |
expect(typeof vector2.factory).toEqual('function'); | |
expect(typeof vector2.centroid).toEqual('function'); |
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 src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script src="/js/libs/json2.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function () { | |
$.ajax({ | |
url: '/api/login', | |
type: 'POST', | |
data: JSON.stringify({id: 123}), | |
processData: false, | |
contentType: 'application/json', |
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
/*global define console*/ | |
require.config({ | |
baseUrl: '/src', | |
packages: [ | |
{ | |
name: 'underscore', | |
main: 'underscore', | |
location: '/lib/underscore' | |
} | |
], |
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
/** | |
* Used to find an intersection between two points. | |
* @param vector2 | |
* @return obj|false if intersection happened returns array of x/y | |
* otherwise fales. | |
*/ | |
lineIntersection: function (v1, v2, v3, v4) { | |
var | |
bx, | |
by, |
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
/*global require*/ | |
require(['whom'], function (Whom) { | |
var me = new Whom('Iain', 27); | |
}); |
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
/*global require*/ | |
require('whom', function (Whom) { | |
if (Whom.allOver18( | |
new Whom('Iain', 27), | |
new Whom('Bob', 53), | |
new Whom('Rob', 19) | |
)) { | |
console.log('Drink!'); | |
} else { | |
console.log('Banned'); |
OlderNewer