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

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...
 Share

  • Recently Browsing   0 members

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