totallybueno Posted May 30, 2014 Share Posted May 30, 2014 Hi there, I´m having some problems with the physics in my game and I don´t know why... I´m gonna tell you I have a group and a sprite created this waythis.group1 = this.game.add.group();this.group1.enableBody = true;this.group1.physicsBodyType = Phaser.Physics.ARCADE;this.sprite1 = this.game.add.sprite(0,0, "sprite1");this.game.physics.enable(this.sprite1, Phaser.Physics.ARCADE);this.game.physics.startSystem(Phaser.Physics.ARCADE);I check for collisions in the update function and everything works fine, this waythis.game.physics.arcade.collide(this.sprite1 , this.group1 , this.callback1, null, this);Then, I create a second sprite this waythis.sprite2 = this.game.add.sprite(0,0, "weapon");this.game.physics.enable(this.sprite2, Phaser.Physics.ARCADE);this.sprite2.body.velocity.y = 200;And I check for collisions in the update function this way, but it doesn´t work...this.game.physics.arcade.collide(this.sprite1 , this.sprite2, this.callback2, null, this);Something that I´m missing? Both bodies have velocity... I don´t know if the need something else Link to comment Share on other sites More sharing options...
lewster32 Posted May 30, 2014 Share Posted May 30, 2014 Everything looks okay from what I can see. I think we'd need to see more of the code (specifically the callback1 and callback2 functions) or, preferably, you could upload whole game so we can play it and determine the problem. totallybueno 1 Link to comment Share on other sites More sharing options...
totallybueno Posted May 30, 2014 Author Share Posted May 30, 2014 Well, after you comment I checked and... it was a scope problem Sorry for this (actually "this" was the problem), I should check that before posting this... anyway, if a moderator sees this, please delete de post Thanks lewster32, the thing is that you helped me to find and fix my bug Link to comment Share on other sites More sharing options...
lewster32 Posted May 30, 2014 Share Posted May 30, 2014 Haha oh well, no problem I guess totallybueno 1 Link to comment Share on other sites More sharing options...
Recommended Posts