Skip to content

Instantly share code, notes, and snippets.

@CharlotteGore
Last active August 29, 2015 14:04
Show Gist options
  • Save CharlotteGore/6d0212642d8e0a15e906 to your computer and use it in GitHub Desktop.
Save CharlotteGore/6d0212642d8e0a15e906 to your computer and use it in GitHub Desktop.
// namespace.js - first file you load...
(function (){
var TIGERWORLD = {};
window.TIGERWORLD = TIGERWORLD;
})();
// tiger.js - load this after namespace.js...
(function (TIGERWORLD){
function Tiger (){
}
Tiger.prototype = ...
// add your Tiger prototype to the GAEM namespace...
TIGERWORLD.Tiger = Tiger;
})(TIGERWORLD);
// run-the-game.js - load this LAST!
(function (TIGERWORLD){
var tiger = new TIGERWORLD.Tiger();
tiger.doExcitingThings();
})(TIGERWORLD);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment