charlie_says Posted June 14, 2014 Share Posted June 14, 2014 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 More sharing options...
Elgan Posted June 14, 2014 Share Posted June 14, 2014 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 More sharing options...
lewster32 Posted June 14, 2014 Share Posted June 14, 2014 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 More sharing options...
wayfinder Posted June 14, 2014 Share Posted June 14, 2014 Have you tried group.setAll/group.callAll? Link to comment Share on other sites More sharing options...
charlie_says Posted June 14, 2014 Author Share Posted June 14, 2014 Thanks for the replies...Ok this is interesting, and a pity that some of the things aren't available at group level.But... adding a sprite to sprite if I dovar bg = game.add(0,0,'bg');var character = game.add(0,0,'character');bg.add(character)I get an error... Link to comment Share on other sites More sharing options...
lewster32 Posted June 14, 2014 Share Posted June 14, 2014 The adding of objects to sprites isn't done via Phaser, it's done via pixi's underlying addChild method.var bg = game.add.sprite(0, 0, 'bg');var character = game.add.sprite(0, 0, 'character');bg.addChild(character); Link to comment Share on other sites More sharing options...
charlie_says Posted June 14, 2014 Author Share Posted June 14, 2014 gah... thanks lewster Link to comment Share on other sites More sharing options...
Recommended Posts