Search code examples
javascriptcollision-detectiongame-enginegame-physicsphaser-framework

Phaser Collision not working as expected in Arcade


I have a man sprite (man) and a group of tree sprites (trees) setup with collision like this:

this.game.physics.arcade.collide(man,trees);

It works fine for the most part EXCEPT the man can walk UP into the tree (see below). Collision detect is working fine in all other directions (LEFT, RIGHT and DOWN, but not UP). Is this a bug? Gravity related or am i doing something wrong.

enter image description here

See Video: http://screencast.com/t/j5tLsqpO


Solution

  • Solution is to use man.body.velocity.y and NOT man.body.y in update routine