dandorf Posted September 25, 2014 Share Posted September 25, 2014 I have made several crashes my game, and now I have intenado create another, and not working. And I've done the same way as the above ... I have this in the CREATE function:barras = game.add.group(); barraLateral = barras.create(0, 10, 'barra'); barraLateral2 = barras.create(0, 460, 'barra'); game.physics.arcade.enable(barras); barras.enableBody = true; barraLateral.body.immovable = true; barraLateral2.body.immovable = true; game.physics.arcade.enable(playerBet); playerBet.body.enable = true; playerBet.anchor.setTo(0.5, 0.5); playerBet.body.collideWorldBounds = true; playerBet.body.bounce.setTo(0, 0); playerBet.body.immovable = true;and the update functiongame.physics.arcade.collide(barras, playerBet);The collision does not work ... Link to comment Share on other sites More sharing options...
sharbelfs Posted September 25, 2014 Share Posted September 25, 2014 i am not sure, but don't you need to start the system?this.game.physics.startSystem(Phaser.Physics.ARCADE);and the physics in the group i use something like this barras.enableBody = true;barras.physicsBodyType = Phaser.Physics.ARCADE; Link to comment Share on other sites More sharing options...
lewster32 Posted September 25, 2014 Share Posted September 25, 2014 Arcade is started by default, and it is also the default system enabled when you enableBody = true on a group, so this should work as intended. I would swap the playerBet and barras parameters around in the collide function but I don't think it would make that much of a difference. The real problem is almost certainly that playerBet.body.immovable is true - immovable bodies do not register collisions, so if you're moving your player object around it will not affect the objects it's hitting. Instead try playerBet.body.moves = false, which allows the object to collide, but stops the physics system influencing its position, which effectively stops it being pushed around by other objects. Link to comment Share on other sites More sharing options...
dandorf Posted September 25, 2014 Author Share Posted September 25, 2014 If I put immovable = false if you funiona this collision, what happens to other collisions with the object not work just now, I have to make a new feature to make all playerBet collisions. Link to comment Share on other sites More sharing options...
Recommended Posts