Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't change gameobject property on event. #2

Open
NocoleNe opened this issue Aug 20, 2022 · 0 comments
Open

can't change gameobject property on event. #2

NocoleNe opened this issue Aug 20, 2022 · 0 comments

Comments

@NocoleNe
Copy link

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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant