Jump to content

Unexpected collision using createMultiple


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);




Link to comment
Share on other sites



This is my setup function:


setupCoinGroup = function (coin, theGame) {
    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

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.

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.


  • Recently Browsing   0 members

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