Hi,
I have two sprites (button_move and button_fire) with two touchs events. I want to have multitouch enabled : when i press on the same time on the two buttons, normaly the alpha of the two buttons is 0.5. But it’s not working.
I have follow the docs, especially this :
https://rexrainbow.github.io/phaser3-rex-notes/docs/site/index.html/touchevents/
https://labs.phaser.io/index.html?dir=input/multitouch/&q=
And i made a jsfiddle about it :
https://jsfiddle.net/espace3d/vLq08gke/12/
the full code is :
var config = {
type: Phaser.AUTO,
width: 480,
height: 640,
parent: 'phaser-example',
input :{
activePointers:2,
},
scene: {
create: create,
update: update
}
};
var game = new Phaser.Game(config);
var button_move;
var button_fire;
var flag_move=false;
var flag_fire=false;
function create ()
{
button_move=this.add.sprite(100,100,'image').setInteractive();
button_move.on('pointerdown',function(pointer1){
flag_move=true
})
button_fire=this.add.sprite(300,100,'image').setInteractive();
button_fire.on('pointerdown',function(pointer2){
flag_fire=true
})
}
function update()
{
if (flag_move){
button_move.alpha=.5
}
if (flag_fire){
button_fire.alpha=.5
}
}
Thanks for your help.