can also clip the sprite http://groups.google.com/group/cocos-discuss/browse_thread/thread/bd464ec0d656fc66#
On Apr 9, 10:49 pm, claudio canepa <[email protected]> wrote: > On Mon, Apr 9, 2012 at 4:09 PM, Pascal LE MERRER > <[email protected]>wrote: > > > Hello > > > Thanks for all of your responses. > > > After Claudio first response, I have implemented a solution which is very > > similar to Ivo's one, excepted I recreate the layer each time the life > > points change, to allow its width to change. > > It works, and will certainly be enough for this game, but I feel it's a > > bit limited (and I don't even talk of the cost of the solution, which > > implies to create a new object each time points change). > > You are right about the cost > > > By example I can't use a gradient as a background color for my lifebar, > > and crop it as the life points decrease. > > That is doable by further modification of classes I proposed, but needs > some openGL or pyglet batches knowledge. > > > I will have a look on Claudio second proposal, but it seems more > > complicated for a Cocos2d/OpenGL newbie as me. > > You can play a little with the script I posted to be sure you know the > meaning of creation parameters and how to tell the object to display some > value, then copy paste the class definition and treat that code as a black > box . It will work even if you don't know the details, the same as sprites > work even when not knowing all the internal details. > > You can even aproximate the gradient feature you want with n NakedBarMetter > s side by side in x axis, each with his own color, as childs of a > NakedBarMetterMulticolor that will receive the on_update_value from the > game and send appropriate messages to the childs. > > Someone dares a try ? :) > > claudio > > -- -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
