Jump to content

Debug a sprite body from a group

Cary Crusiau

Recommended Posts



Here is a part of my code:

create: function() {this.hedgehogs = game.add.group();this.hedgehogs.createMultiple(10, 'hedgehog');},update: function() {if (this.game.time.now > this.Time) {this.addHedgehog();this.Time = game.time.now + 2000;}},addHedgehog: function() {var hedgehog = this.hedgehogs.getFirstDead();game.physics.arcade.enable(hedgehog);hedgehog.body.setSize(95, 61, 7, 6);},

How can I debug the 'body' of the 'hedgehog'?


I tried:


But none of them work. Any help?




Link to comment
Share on other sites

addHedgehog: function() {

// we need to access the current hedgehog outside of this function, so use 'this' to

// attach it to the state instead

this.currentHedgehog = this.hedgehogs.getFirstDead();


this.currentHedgehog.body.setSize(95, 61, 7, 6);


render: function() {

// ensure we have a current living hedgehog otherwise we'll get errors

if (this.currentHedgehog && this.currentHedgehog.alive) {

// show the body for the current hedgehog




Link to comment
Share on other sites


  • Recently Browsing   0 members

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