I am trying to figure out how to fade the layer and its children to a given opacity. This is what I am doing.
- (id)init
{
if( (self=[super initWithColor:ccc4(0, 0, 255, 255)] )) {
CCSprite *background = [CCSprite…
I am trying to create an app that uses cocos2d for the homescreen, and a UINavigationController for some tables and information. I use this code to try to push a UINavigationController (Settings) into view
UINavigationController *controller =…
I have my main layer with an options button and when I press the button I am calling pushScene on a CCLayerColor Layer, and the layer is only half the size of the screen because I want it to be like a drop down menu but when it appears with the…
Most of the tutorials that I've read only explain Cocos2D examples in the HelloWorld class, but as I've started to build a simple game I need to know how to send an event to different classes, and for them to respond whenever it happens.
I have…
I have just started to looking at cocos2d and much interested to learn.
Basically i just want to draw a little solid circle (like a dot around 20 radius) where i touch the screen and it can only enable after pressing a button. How can i do this…
n'tMy game scene is run from a level selection scene using replaceScene and and a level number is passed in. The game layer loads data from a plist and then creates objects in in the world space (CCSprite subclass with box2d bodies). The hero…
I have set up a camera and I managed to add the Cocos2d Layer above the camera, Now I want to take a screenshot of the total view i.e the camera and with the image on the layer above the camera.
Since my CCLayer is made transparent the camera can…
I am trying to make transparent openGLView for my game, I want it transparent only for one feature within my game. Actually, it is a feature related with camera of the device.
I am using UIImagePickerController for my camera, but I am unable to…
Imagine three instances of a CCLayer subclass Block positioned next to each other. Each is 100x100 pixels and has some basic square background art. These three objects are part of an encapsulating CCLayer subclass called Container.
How can I swipe…
I have a simple CCLayer subclass with a circle as the background image. I also have a CCLabelTTF as a child node. How can I center the label's text on the background image?
Here's what I have:
// in MyCCLayer's init method
CCSprite *backgroundImage…
I'm kind of a UI buff - every "screen" in my game should transition in/out when it appears or disappears. Because my game is simple in terms of resources, I thought I'd just make each "screen" a CCLayer and define a function for the transitions,…
I need to retrieve some data from a database to display on the screen. I want to avoid the application from blocking so I display the next screen before I retrieve any data and add the data as it comes in.
This is the method that adds the info I…
I have a CCScene which already holds my gameLayer and I am trying to add HUD layer on that.But the HUD layer is not getting added in my scene, I can say that because I have set up a CCLabel on HUD layer and when I run my project, I cannot see that…
I have 2 CCLayers stacked on top of each other; both are touch enabled. I want the top CCLayer to respond to and consume touches and the bottom layer to not react to the touches that the top layer consumes.
The top layer has a CCTouchBegan method…