Jump to content

createFromObjects - unable to apply CollisionGroup


Recommended Posts

powerups = game.add.group();        powerups.enableBody = true;      powerups.physicsBodyType=Phaser.Physics.P2JS;  map.createFromObjects('objects1', 339, 'questionmark', 2, true, false, powerups);powerups.forEach(CallsignIt,this);

so the physics bodyis created..  i can apply a rectangle, a body.mass, static, name... but then the "setCollisionGroup" option failes.  :( 


Uncaught TypeError: Cannot read property 'mask' of undefined


function CallsignIt(callsign){    callsign.body.setRectangle(64,64);    callsign.body.mass=99;    callsign.body.static = true;    callsign.body.sprite.name="growshroom";    callsign.body.setCollisionGroup(questionmarkCG);    callsign.body.collides([playerCG,fireballCG]);}

i also tried it that way:  (but then nothing happens)

powerups.callAll('setCollisionGroup', 'null', 'questionmarkCG');

what am i doing wrong?  thx

Link to comment
Share on other sites


  • Recently Browsing   0 members

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