Hi, this is my first post and probably a newbie mistake,
I'm trying to get collisions working between two objects. What I have is overlap() works but collide() doesn't. All being equal when I substitute overlap for collide in code below the collision is no longer detected. Any thoughts on why it may be so?
First I setup the engine:
this.game.physics.startSystem(Phaser.Physics.ARCADE);
Then set up the objects:
this.platform = this.game.add.sprite(471, 535, null);
game.physics.enable(this.platform, Phaser.Physics.ARCADE);
this.platform.body.immovable = true;
this.platform.body.setSize(200,10, 0,0);
and this:
this.cube = game.add.sprite(x, y - 30, 'characters', 'cube1');
this.cube.anchor.setTo(0.5, 0.5);
game.physics.enable(this.cube, Phaser.Physics.ARCADE);
And in the update() collide/overlap them like that:
game.physics.arcade.overlap(this.platform, this.cube, function (platform, cube) {
this.unloadCube();
game.paused = true;
}, null, this);
This is just part of the code. For what it's worth, cube is in a group and is moved with it's parent. The platform is on the root level.