Jump to content

Unexpected collision using createMultiple


AlexArroyoDuque
 Share

Recommended Posts

Hi gamers!

 



I have a group in which some coins are created with createMultiple.

When I start the game the player collisions with unexpected group of coins ... 

The score of the player increases, therefore the collision occurs, but is not physically collide ...

 



Some code:


            this.coinlGroup = this.game.add.group();

            this.coinGroup.createMultiple(70, 'coin');

            this.coinGroup.forEach(setupCoinGroup, this);

 

 

Greetings!

Link to comment
Share on other sites

mmm...

 

This is my setup function:

 

setupCoinGroup = function (coin, theGame) {
    theGame.game.physics.p2.enable(coin);
    coin.body.setCircle(16);
    coin.body.data.gravityScale = 0.25;
    coin.anchor.setTo(0.5, 0.5);
    coin.body.collides(theGame.playerCG); // ¿problem?
 
    coin.body.mass = 0.01;
    coin.alpha = 0.8;
};
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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