Best way to walk through(behind) the top of a sprite, but collide with its base?

Recommended Posts

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. 

Share this post

Link to post
Share on other sites
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?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.