On Mon, Apr 9, 2012 at 5:30 AM, Ivo F.A.C. Fokkema <[email protected]>wrote:

> Hi Pascal,


> I had been dealing with that as well, and couldn't get any better than
> this (indeed using ColorLayer, what Claudio already suggested):
>
>
> [snip]


> The bar nicely moves from green to orange to red, if the life of the
> unit decreases. However, what I've been struggling with and couldn't
> implement, is trying to change the width of the health bar. I couldn't
> get that to work. If you find out how, I would be very grateful if you'd
> tell me how :)
>
> Good luck on your game!
>
> Ivo
>
>
>


A second look to ColorLayer shows that width and height changes after
object creation don't change the vertexes  associated to the object, so it
isn't a good fit to a MetterBar.

But that behavior can be added.

Here a pastebin with two MetterBar versions, one done with plain old open
GL inmediate mode, another by subclassing ColorLayer

http://pastebin.com/2vDzW2JX

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.

Reply via email to