Jump to content

Sprite collision odd behaviour


robbo
 Share

Recommended Posts

I have a platform style runner/scrolling game. The mechanic is if you get pushed off the left of the screen the game ends.

 

I am using sprites as obstacles and as the floor (all square tiles assembled in a grid). The sprites are in a group and recycled and added back to the right of the screen when they leave the game world on the left side.

 

The player sprite is moving along these and I am doing collision tests from the player sprite to the floor/obstacle groups. 

 

The problem I am having is that occasionally the player sprite gets stuck while running over the floor and obstacle sprites and then the player is pushed off to the left of the screen thus ending the game.

 

I am not sure if I am going about this the correct way.

 

Is this due to my implementation or a bug?

Does anyone have any ideas?

 

Game here: http://www.theworkshop.co.uk/testing/paulr/

 

Thanks

 

 

Link to comment
Share on other sites

The problem is the same as this http://www.html5gamedevs.com/topic/2967-physic-bug/?hl=render#entry19274

 

I used kibibu's suggested fix of flipping the order of separation using...

Phaser.Physics.Arcade.prototype.separate = function (body1, body2) {        this._result = (this.separateY(body1, body2) || this.separateX(body1, body2));    }

And it has fixed it for horizontal collision but now the problem is with vertical collision which makes sense, will look into this further.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...