Jump to content

Container vs Sprite


Recommended Posts

I'm just starting to pick up Pixi and was working on extending the Sprite class for a tree. I've added some functionality to my tree class to allow for variations in the way the tree looks like tint, size, shape, etc. Now I added a shadow to my tree by adding a shadow sprite onto the tree sprite (since a PIXI.Sprite is a PIXI.container) but I don't want the shadow to be tinted when I tint the tree. That's easy enough to do, but now my tree which extends PIXI.sprite feels more like it should extend PIXI.container.

Any feedback on this? Thanks!

Link to comment
Share on other sites

Yes, it is better to extend PIXI.Container and put the tree sprite and shadow in it.

However, shadows are tricky - sometimes its better to separate ALL shadows into different container. In that case, your tree object cant have shadow as a child, but it needs to update shadow position every time tree position is changed. BTW, there will be plugin for z-indeces for pixiv4.

Link to comment
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.
  • Create New...