I'm trying to acess GameManager instance.levels but always returns as undefined.
I could't use this.instance because it belongs to GM
class GameManager {
instance = { levels: { } }
constructor(){
}
Level = class { /* extends ENGINE.Container, ENGINE IS NOT MINE */
constructor(name) {
// super(); /* EXTENDS ENGINE.CONTAINER */
instance.levels[name] = this; /* new ENGINE.Container(); */
}
tick = function(){ /* will be overridden */}
}
}
const game = new GameManager();
var loadScreen = new game.Level('ls');
loadScreen.tick = function(){
}
game
instance into the constructor forLevel
?loadScreen = new Level('ls', game)
?