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

4 years ago by SirPereira

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.

4 years ago by substandardgaussian

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.

4 years ago by SirPereira

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!

4 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't hang off window.

4 years ago by stahlmanDesign

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.

4 years ago by SirPereira

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 »