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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.