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 anchpop

I have a StartScreen (from ig.Game.extend), a LevelSelectScreen (from ig.Game.extend) and a MyGame (also from ig.Game.extend).

On StartScreen there is a button which either loads MyGame which Loads Level1 on init.

I load levels and keep track of the player's stats in the MyGame.

I have buttons on the level select screen, and I can make them do something when clicked, but I don't know how to start MyGame and load a specific level from there. Please help! I've been working on this all week.

Thanks,
Andre

1 decade ago by stillen

You can use this plugin:
http://impactjs.com/forums/code/persistantdata-plugin/page/1

I use it in my game, and it works well. I have 3 or 4 different games within my full game. These games each handle a specific purpose:
OpeningGame = handles opening screen, opening story etc.
MenuGame = handles the main menu/level select
RunnerGame = This is the actual game, holds all the levels etc.
EndGame = handles game over, ending story, continue screen


This is an example of a level select button.  This is in the MenuGame, it is the action of a button click.
ig.system.setGame(Runnergame,
   {
      passedLevel:'LevelFive',
   }
);

Then in the RunnerGame Init I have this code
if(typeof this.persistantData  !== "undefined"){
   ig.game.loadLevelDeferred(ig.global[this.persistantData.passedLevel]);
}else{
// if nothing is passed then I load the default level
this.director.jumpTo(LevelTraining_1); 
} 

I also use the director plugin, but you can use this same concept without need it, but the director plugging makes larger leveled game much easier to transition between levels
http://impactjs.com/forums/impact-engine/new-director-level-manager-module/page/1

1 decade ago by anchpop

Thanks a lot! That seems like it will do the trick. This seems pretty basic, do you know why doesn't impact have it built in?

1 decade ago by stillen

Thats more of a question for Dominic.

It's one of the advantages of impact that you can easily extend it for your needs. In the 4 games I have made professionally, I only once had to make a level select screen, and that was for my personal project.

There's also a handful of other ways to do this, some might already be built into impact already, that I'm not aware of.

1 decade ago by anchpop

Thanks. I'm actually making this game as a school project (Everyone has to do 20 hours of community service per year and they said this would count), and the deadline is fast approaching. Thank you for your help!

1 decade ago by anchpop

About my previous comment, the game that I'm making is educational.

1 decade ago by stillen

Good luck with the project, post it up here when it's close to finished.

1 decade ago by anchpop

Sure thing!
Page 1 of 1
« first « previous next › last »