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 RomainT

Hello,

I created a module (called Texter) to display large amount of text with pagination. On such a Texter (I'll release it later), I use arrows to navigate : UP for previous, DOWN for next, RIGHT for end and LEFT for begin).

http://img810.imageshack.us/img810/8409/capturedcran20110718120.png

Then I extended it to display an interactive Menu on the page. Everything works but there is a little flaw : when I'm on a menu, I usually use arrows UP and DOWN to navigate (with a circular binding : DOWN on the last element send back to the first one) so I issue a conflict.

How could I deal with that ? Maybe there is a way to temporarily unbind a key or catch the event ? Any suggestion ? :)

Thanks a lot !

1 decade ago by davidx

I use game state and then act on the different actions based on the state.

STATE: { 
		GAMESTART: 0,
		GAMEPLAYING: 1,
		PLAYERDEAD: 2,
		LEVELCOMPLETE: 3,
		LEVELTRANSITION: 4,
		GAMEOVER: 5
	},

In main update()
if(ig.input.pressed('go') && this.currentState != this.STATE.GAMEPLAYING) {
	//navigate through your pages.
}

Then in my player I use:
if(ig.game.currentState == this.STATE.GAMEPLAYING) {
	if( ig.input.state('go') ) {
		//do whatever
	}
}

Any help?

1 decade ago by RomainT

Indeed… Focusing on the problem, I didn't consider this obvious and great solution…

Thanks Davidx. :)
Page 1 of 1
« first « previous next › last »