Closed BurnedToast closed 10 years ago
Can reproduce.
I've noticed this also affects constructing groups where you pass enableBody to the normal group constructor.
Example code:
// This doesn't work.
var physGroup = game.add.physicsGroup(Phaser.Physics.ARCADE);
var physGroupChild = physGroup.create(0, 0, 'bullet')
if (physGroupChild.body === null) {
console.error("Expecting physGroupChild.body to not be null but is null.")
}
// Neither does this.
var groupWithPhysicsInConstructor = game.add.group(game.world, 'my group', false, true, Phaser.Physics.ARCADE)
var groupWithPhysicsChild = groupWithPhysicsInConstructor.create(0, 0, 'bullet')
if (groupWithPhysicsChild.body === null) {
console.error("Expecting groupWithPhysicsChild.body to not be null but is null.")
}
// Obviously, this will.
var groupWithoutPhysicsInConstructor = game.add.group()
groupWithoutPhysicsInConstructor.enableBody = true
groupWithoutPhysicsInConstructor.physicsBodyType = Phaser.Physics.ARCADE
var groupWithoutPhysicsChild = groupWithoutPhysicsInConstructor.create(0, 0, 'bullet')
if (groupWithoutPhysicsChild.body === null) {
console.error("Expecting groupWithoutPhysicsChild.body to not be null but is null.")
}
Example Fiddle here: http://jsfiddle.net/MUa38/2/
Ah yes, if you look the 'enableBody' parameter got assigned to the enableBodyDebug value by mistake. Fixed in dev.
@photonstorm fast fixing! =-) Are the example Fiddles too much in this case? I'm just trying to follow the contrib guidelines.
Sometimes they are really useful. Othertimes it's such an obvious error they're too much. Sadly I guess it's not easy for you to tell which :) You could start by just describing the problem, if I can't work it out I'll ask for more info / example. Should save time for you?
@photonstorm Makes sense. Should we update the contribution guidelines to say something like 'If it's a simple bug report, use your best judgement to decide if a demo example is needed' ?
Agreed, I've added something to that effect in the guide.
When I use
The created dont have a body, because of line 111 in Group
should be
But changing that line may have some other impacts!?