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 fulvio

I have a few NPC's that display in-game dialogues and I was hoping to be able to disable the shoot ig.input.pressed('shoot') functionality temporarily per entity.

Basically the character detects when the player is close to them and displays the dialogue automatically. I then use ig.input.pressed('shoot') to iterate through the dialogue text. The problem at the moment is that shoot is also assigned to the player's shoot button within player.js.

While close to the NPC I'd like to disable the shoot button in the player.js class while this is happening. I tried adding a boolean flag to my main game class if.game.freezePlayer and check for whether this is true and disable any shoot functionality, however when I have multiple dialogues in my level it's always set to whatever dialogue is loaded first - so it's not really going to work like I want it to.

1 decade ago by TigerJ

I use a global "am I chatting" type boolean
if( ig.input.pressed('shoot') ) {
				//console.log("shot");
				//do not shoot if chat bubble is open
				if(!ig.game.chatOpen)
				{
					this.shootAnim=true;
					this.shootAnimCounter=0;
					this.currentAnim = this.anims.shoot;
					ig.game.spawnEntity( EntityBolt, this.pos.x, this.pos.y, {flip:this.flip} );
				}
			}
Page 1 of 1
« first « previous next › last »