Ralph Posted January 22, 2017 Share Posted January 22, 2017 Hi there, basically Im planning on switching the tree's in my game to larger more extravagant trees and what I wanted to do was to be able to walk through the top of the sprite, giving the appearance that you are walking behind the tree, but not let them walk through the base of the tree. I couldn't think of a way to do this. I was thinking I would do it with 2 spites maybe? But i thought that was too redundant. I know other frameworks like RPGJS has this but I don't know if phaser does. Thanks for any help in advanced. Link to comment Share on other sites More sharing options...
phreaknation Posted January 22, 2017 Share Posted January 22, 2017 You could use a polygon or rectangle to give that effect so that only part of the sprite is has a body. Link to comment Share on other sites More sharing options...
Ralph Posted January 22, 2017 Author Share Posted January 22, 2017 Just now, phreaknation said: You could use a polygon or rectangle to give that effect so that only part of the sprite is has a body. Yeah I remembered after I posted that there was a way to change the shape of the phsyics body but I cant remember how. Do I need to use p2 to do it? Link to comment Share on other sites More sharing options...
phreaknation Posted January 22, 2017 Share Posted January 22, 2017 p2 is basically arcade+. Depends on what you're going for. More RPG like I would suggest p2 Link to comment Share on other sites More sharing options...
samme Posted January 22, 2017 Share Posted January 22, 2017 You can do this with Phaser.Physics.Arcade.Body.html#setSize, e.g., a short, wide rectangle at the bottom of the sprite. Use game.debug.body() to see it. Ralph 1 Link to comment Share on other sites More sharing options...
Recommended Posts