I was wondering if someone could help me with the creation of a nice animated HUD layer.
I wanted an arrow button on the right top side of my screen which when pressed, smoothly opens up a transparent background HUD layer. And it can contain many in game counters and the pause button, maybe and few other stuff. Basically like a Pause screen on any PC game.
How to create a Animated HUD layer
(6 posts) (3 voices)-
Posted 5 months ago #
-
You can do this using pushScene or you can just show your HUD layer at a higher z index over the current layer when button pushed. If you want to pause the gameplay, you can pause the director.
Posted 5 months ago # -
that would just show up my background without any animation. I was wondering if it could swipe in from the right (since the button is placed there) and disable the background and enable touch features on the HUD layer alone.
Posted 5 months ago # -
I'm fairly sure you can do scene transitions with pushScene just like you would with replaceScene. You can also do custom movements with your layers.
Posted 5 months ago # -
I agree with jd. Both pushScene or a custom layer on top that you move around as you need would do the job. I personally prefer using an overlay layer because it feels more flexible to me. You can move a layer within a scene just like any other object:
myOverlayLayer.position = ccp(480, 0);
myOverlayLayer.anchorPoint = ccp(0, 0);
[myScene addChild:myOverlayLayer];[myOverlayLayer runAction:[CCEaseInOut actionWithAction:[CCMoveBy actionWithDuration:1 position:ccp(-480, 0)] rate:2]];
Posted 5 months ago # -
thank you guys.. i think what pfg is getting to is exactly what i need.. now, the thing is i have this game scene layer where my tiles are and i need this overlay layer to be above that when a button is pressed.. ok.. now.. i need to communicate with the overlay layer.. for eg.. if i have a game that needs to record amount of money that i have gained.. then.. i put it up on the overlay layer.. while i was going through this on the forums.. some one suggested using singleton's.. is it possible for you guys to guide me on this aspect.. or just let me in on some tutorials if you found anything online for cocos2d.. thanks guys..
Posted 4 months ago #
Reply
You must log in to post.