Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by MikeL

I created a "Director" module which is really simply a way to manage and move between levels. It stores an array of levels and allows one to for example advance to the next level, go back one level, go to the last level, append new levels etc.

I've got the module posted at github for anyone who wants to try it out. Documentation is found in the readme file.

https://github.com/boneheadmed/Director

1 decade ago by Hareesun

Just wanted to say thanks and good job. I haven't yet used it, but it looks super helpful. Especially when making huge worlds.

1 decade ago by Ken

I've used it and its GREAT! :) Makes life much easier.
Thank you very much for sharing with us MikeL. Much appreciated.

1 decade ago by MikeL

Thanks for that. Wish I could take credit for the concept, but I essentially borrowed it from cocos2d.

The next thing that I'm working on, which may be of help to some, is a utility for creating bezier paths. Hope to put it up in the next week or two.

1 decade ago by TylerAppmobi

Love your module. We were having a fun time with global variables trying to setTimeout the level change but with the director,js it's 10 times easier.

1 decade ago by MikeL

Great, thanks for the feedback. Thought it might come in handy and save some time and effort. I might come back to it at some point and expand it to include level transition effects, etc. I'll also update it so that it fits in to the lib/plugins folder.

1 decade ago by jminor

Transitions would be awesome.

1 decade ago by MobileMark

You may want to repost this in the new Code section also :)

1 decade ago by xdissent

This rules, btw. Used it today and I love it.

1 decade ago by dlkulp

does this have a way to get your current level (without changing anything)? Or is there another way that I'm missing?

1 decade ago by stillen

Do you want to reload the current level:
// reload level
ig.game.director.reloadLevel();

or check the level that was loaded?
You can make a quick change record the level here:
loadLevel: function(levelNumber){
    //Load a level by its position in this.levels array
    //and set the this.currentLevel to that position.
    this.currentLevel = levelNumber;
    this.game.loadLevel( this.levels[levelNumber] );
    return true;
  },
Page 1 of 1
« first « previous next › last »