Jump to content

Confusing collision


Jandeilson
 Share

Recommended Posts

Hi everyone!

Where "Drag quickly" a sprite of a group for a sprite specifies the same exceeds the set amount of score. I need to drag the sprites of the group quickly without this bug occurs.

As I understand the problem is that when you drag the sprite of group quickly the score sometimes is greater than 1, which is the value set for each sprite of group.

 

SOLVED! :D

Link to comment
Share on other sites

The solution I found for my problem was as follows:

 

     // Colect Sprite
       colectSprite: function (character, sprite) {
        this.score += 1;

   
    //My mistake was that I was destroying the sprite before being counted 1 score. Putting a "sprite.kill();" before "if (this.score === 1)..."

 

    //A sprite can be destroyed only 1 score is counted.

        if (this.score === 1) {
        sprite.kill();
        character.kill();
        
        this.game.add.sprite(295, 155, 'character2');
        }
    }

 

It was something like that solved my problem. :)
Emphasize that you need to reset the records every overlap.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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