Jump to content

Groups/Sprites/Tint


charlie_says
 Share

Recommended Posts

I was just testing something, and was hoping to use a group much in the same was as you'd use a Sprite/MovieClip in Flash - in this test I was trying to tint the group... (i.e. add 5 bitmaps to a Sprite and then tint the sprite).

 

But, I don't think groups in Phaser are a display object, and as such you can't do that kind of operation (despite some properties like alpha/rotation/etc. having the ability to be applied at group level). -- I know at this point someone will say, tint each of the sprites in a group individually. This would work for the test, but *not* for the end product.

 

I did have a quick peek at PIXI to see if that was any different - but again it seems that some features (tints, blendmodes, etc.) can only be applied at sprite level...

 

Also, I don't think I can add a sprite to a sprite...

 

So, is the only way to achieve this test to create a bitmapData for a sprite, and add the elements to that, then tint the sprite?

Link to comment
Share on other sites

what about a sprite batch?

 

actually i will need the same eventually. I was going to just extend a group with an update loop when dirty. So on a property update, it would auto update each sprite.

 

 

Atm for another  way, i hide my main sprite, create 2 new ones and act as a single sprite updating them both. Less efficient but works nice.

 

You can add sprites to sprites, they are just children.

Link to comment
Share on other sites

Unfortunately at this stage it looks like tint does not respect the scene graph; I suspect this is an oversight though it may also be because passing tints down the graph means you'd have to multiply them together in the case that you had tinted objects within within other tinted objects. I don't think this would be too difficult to implement within the Phaser core, but for the moment yes, you'll have to apply the tint separately to each object.

 

You can add sprites to other sprites, however tinting the container sprite will not carry down to any child sprites, so there's no point in doing this really.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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