Skip to content

Instantly share code, notes, and snippets.

@loktar00
Last active December 16, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save loktar00/5427189 to your computer and use it in GitHub Desktop.
Save loktar00/5427189 to your computer and use it in GitHub Desktop.
What is the best way to do this?
/*
*
* What Im trying to get to work
*
*/
function playersGameName(options){
// stuff in here to init whatevs.
}
playersGameName.prototype = new Jest(options);
Jest= function(options){
// initialize stuff
}
Jest.prototype = {
addItemToRenderer : function(args){
}
}
Jest.Sprite = function(){
//properties and stuff
// this doesnt work,
Jest.addItemToRenderer(this);
}
/*
*
* This is how I do it currently and I hate it
*
*/
var Game = {}
function playersGameName(options){
// stuff in here to init whatevs.
}
playersGameName.prototype = new Jest(options);
// seems redundant
Game = new playersGame();
// Game framework
Jest= function(options){
// initialize stuff
}
Jest.prototype = {
addItemToRenderer : function(args){
}
}
// make a new sprite
Jest.Sprite = function(){
//properties and stuff
// Referencing the game variable... which just seems dumb
Game.addItemToRenderer(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment