selelabala Posted April 29, 2020 Share Posted April 29, 2020 Hello, In Phaser 3, I am building an RPG and I am trying to make the player talk to a different sprite when overlapping and pressing a key (such as spacebar for example).Like, in gameboy pokémon you can walk up to a sign or a person and press (A) to cause text to appear. So far, I have a textbox animation appearing every time my player and the sprite collide, however, how can I do this such that the player ONLY talks to the sprite when overlapping AND pressing down the key. PS: For doing this, I just call a showTextBox function whenever player collides with sprite. //in create() i have this: var dialogue1 = this.physics.add.overlap(player, this.student2, this.messageBox3, null, this); //outside of create() messageBox3() { this.text3anim.visible = true; this.text3anim.play('talk'); var musicConfig3 = { mute: false, volume: 1, rate: 1, detune: 0, seek: 0, loop: false, delay: 0 } this.dialogueSound.play(musicConfig3); } Link to comment Share on other sites More sharing options...
Recommended Posts