Jump to content

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


willis
 Share

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?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...