I can't figure out how to skip dialog, I need help!

Hey there! Me and my friend (we’re both begginers in coding Phaser and Javascript in general) are trying to build a game where the playable character interacts with NPCs by hearing them talk and pressing Space to “hear” the next piece of dialog.

One way we thought that would be possible was by doing this:

image

But it didn’t seem to work and we don’t know why and how can we fix that :frowning:
Can someone help us please?

Hey ray,

maybe you can provide some more information?

Some examples:

  • in which context this code is executed? In the update game circle?
  • is spaceKey.wasPressed() triggered at all? Check by putting console.log('SPACE') after nextDialog += 1; and look at browser’s javascript console.
  • what exactly is not working? is anything happening on space? is dialog1 hidden? etc
1 Like