Jump to content

Defining group physics, body settings


xronn
 Share

Recommended Posts

Hi, I'm trying to set all my physics setting for a group so when I draw each of my sprites I don't have to write the same code over and over again.

    npcGroup = game.add.group();    npcGroup.setAll('body.setSize', 19,26);    npcGroup.setAll('body.immovable', true);    npcGroup.setAll('body.moves', false);    game.physics.enable(npcGroup, Phaser.Physics.ARCADE);

Thats what I got but it doesn't appear to work, although I don't get any errors in the console either.

 

Edit: I've updated these sections which now work - 

    npcGroup.enableBody = true;    npcGroup.physicsBodyType = Phaser.Physics.ARCADE;
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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