enable3d-phaser-project-template icon indicating copy to clipboard operation
enable3d-phaser-project-template copied to clipboard

can't change gameobject property on event.

Open NocoleNe opened this issue 3 years ago • 0 comments

in the game.ts file

const config: Phaser.Types.Core.GameConfig = {
  type: Phaser.WEBGL,
  transparent: true,
 ...Canvas()

}
the  ...Canvas()  line code will  cause pheser can't change gameobject  property on  event.  
like  


	this.thum = this.add.sprite(400, 300, 'dog');
	this.thum.setInteractive({ draggable: true });
```
this.thum.on('drag', (pointer, dragX, dragY) => {
		this.boy.x += dragX * 0.01;
		this.boy.y += dragY * 0.01;
		console.log(this.boy);
		console.log("drag this.boy.x:" + this.boy.name + "  : " + this.boy.x);
		
	// event can trigger ,  this.boy.x  will change , but   this.boy object  will  cann't move, 
	 // if remove the ...Canvas()  from   game.ts file,  this.boy object  will  can  move, 
	});


 event can trigger ,  this.boy.x  will change , but   this.boy object  will  cann't move, 
if remove the ...Canvas()  from   game.ts file,  this.boy object  will  can  move。
How  to do?

NocoleNe avatar Aug 20 '22 14:08 NocoleNe