1 decade ago by henonchesser
I've got a lot going on in the main.js class and I want to split it up. This biggest offender is my map loader, which spawns infinite random side-scrolling levels. It relies heavily on the resources used by game.main so I felt it was best to just extend game.main. The head of my main.js is fairly basic
As you can see, I'm attempting to require the maploader. But I'm honestly not sure if that's the right way to go about this either. And here's my header for maploader.js
Maybe I'm missing this concept entirely. I want to wonder if perhaps it's not possible, but Jessie Freeman's book in on line simply states "you can extend your own game class."
Thoughts? Advice?
ig.module( 'game.main' ) .requires( //core 'impact.game', 'impact.font', 'impact.image', 'impact.background-map', 'impact.debug.debug', 'game.maploader', //entities 'game.entities.avatar', 'game.entities.eventHandler', //levels 'game.levels.begin' ) .defines(function(){ MetaGame = ig.Game.extend({
As you can see, I'm attempting to require the maploader. But I'm honestly not sure if that's the right way to go about this either. And here's my header for maploader.js
ig.module( 'game.maploader' ) .requires( ) .defines(function(){ ig.MapLoader = MetaGame.extend({
Maybe I'm missing this concept entirely. I want to wonder if perhaps it's not possible, but Jessie Freeman's book in on line simply states "you can extend your own game class."
Thoughts? Advice?