Skip to content

can't change gameobject property on event.  #2

Description

@NocoleNe

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions