willis

Wrong picked object by id (custom poperties). Phaser 3 bugs or my code mistake?

Recommended Posts

Hi

I'm new phaser user i got a little bug for my game, this things make me confused for an hour.

I make mahjong game using phaser 3, the gameplay it's self are already completed, just add additional features. I make hint function to detect possible matches, and it's working fine also selected pieces that are match are right, but if i want to clear selected pieces (hint object), sometimes it's pick the wrong pieces, i already put selected hint id  (array) on console.log, and nothing wrong.

If i pick gameobject by id (custom properties) dirrectly, sometimes  it's pick a different gameobject id.

var child = this.cards.getChildren();
for(var i=0; i<2; i++){
	child[hinted_pieces[i]].clearTint();
}

 

If i use loop to pick hinted object, it's select the right gameobject.

var count = 0;
for(var i=0; i<total; i++){
	if(child[i].id == hinted_pieces[count]){
		child[i].clearTint();
		count++;
	}
	if(count == 2){
		break;
	}
}

 

So, it's Phaser 3 bugs?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.