Karma Octopus Posted March 18, 2014 Share Posted March 18, 2014 I am using sprites inside a group as the ground and then I check collision of that group against the player sprite. Now the problem is that when the player sprite tries to move over the next sprite that the ground is made out of is just suddenly stops, like it has collided with and invisible object. In this image the player sprite will move just fine towards the right: But when it reaches the edge of the next floor sprite it stops moving:Even if the player now jumps up in the air it won't move to the right any more.This only occurs in 2.0 and up, I have tried it with the latest dev build too, The same thing works fine in 1.1.6.Here is some code to replicate it: private _player: Phaser.Sprite; private _collisionGroup: Phaser.Group; create() { this.game.physics.startSystem( Phaser.Physics.ARCADE ); this._collisionGroup = this.add.group(); this._collisionGroup.enableBody = true; this._collisionGroup.physicsBodyType = Phaser.Physics.ARCADE; for ( var i = 0; i < 15; i++ ) { var block: Phaser.Sprite = this._collisionGroup.create( i * 64, 300, 'collisionImage' ); block.body.immovable = true; block.body.allowGravity = false; } this._player = this.game.add.sprite( 200, 200, 'player', 0 ); this._player.anchor.setTo( 0.5, 0.5 ); this.game.physics.enable( this._player, Phaser.Physics.ARCADE ); this._player.body.velocity.x = 50; this.game.physics.arcade.gravity.y = 600; } update() { this.game.physics.arcade.collide( this._player, this._collisionGroup ); } Link to comment Share on other sites More sharing options...
rich Posted March 19, 2014 Share Posted March 19, 2014 Can you please try this with 2.0.1 (see the thread I just made about it). I'm not 100% sure it will solve it, as I think it's getting stuck on separation on the corner, but it would be well worth trying. Link to comment Share on other sites More sharing options...
Karma Octopus Posted March 19, 2014 Author Share Posted March 19, 2014 I tried it with the latest version, sadly it doesn't work. It does work in 1.1.6, I'm not sure if that is of any help. I hope this issue can be fixed, I don't really need any advanced collision handling in this game so it would be totally overkill to use for example p2. Link to comment Share on other sites More sharing options...
rich Posted March 21, 2014 Share Posted March 21, 2014 Right I've spent quite some time looking at this. I always knew WHY it was happening, but there was no easy way to resolve it, because of maintaining the legacy 1.1.3 approach to physics. I believe I've come up with a workable solution that keeps the legacy handling, but stops things like the above from happening. I've made several tests that all work properly now and it'll be part of the 2.0.1 release today. Link to comment Share on other sites More sharing options...
Karma Octopus Posted March 21, 2014 Author Share Posted March 21, 2014 I just tested it with the latest dev version and now it works as expected. Thanks Rich! Link to comment Share on other sites More sharing options...
Recommended Posts