Let's say I've got the following levels:
- A login screen (where user inputs his username)
- A menu
- The play screen
Play screen obviously should be a weltmeister map, however how would you do the other?
Should I just create a GUI, get it into an image, and use it as a background image for login and menu screens?
Thanks.
There's no One Right Way, but you can actually make all of those different ig.Game objects. It's what Jesse Freeman recommends in his book, and it works quite well. Going to the menu, pausing, starting the game proper, etc: can all be handled by setting the current game object.
Thanks @substandardgaussian.
I've been reading some stuff about that way to manage stuff (with Game instances). However, what would be the best approach to keep player information (such as its name) along the screens?
Thanks!
10 years ago
by drhayes
You can carry them along as global JS variables. Or, if you prefer, make a ig.state
(or something) variable that is still global but doesn&039;t hang off #window
.
I originally followed Jesse Freeman's way, but I wanted more than just an image for my main screen. So I just created a Weltmeister level for my main title screen so I could have the characters move around and offer instruction on how to play.
To keep track of player info, do like drhayes said and use global variables or preferably something like ig.myGameVars to keep it in the Impact scope.
Thank you both guys.
I'm using now something like this int ig.game.init:
if (!ig.storage) {
ig.storage = {
player_name: '',
currentGameMode: null,
config: {
initialGameMode: 'login',
allowedGameModes: ['login', 'playing']
}
};
}
Page 1 of 1
« first
« previous
next ›
last »