Questions tagged [cclayer]

CCLayer is a class from the popular Cocos2d engine

CCLayer is a class from the popular Cocos2d engine.

Complete API Reference.

115 questions
0
votes
3 answers

How to fade a CCLayerColor and it's children to a given opacity? Cocos2d

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…
Stephen
  • 499
  • 9
  • 28
0
votes
1 answer

Add a UINavigationController in CCLayer

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 =…
mattblessed
  • 772
  • 1
  • 12
  • 27
0
votes
1 answer

How to create a drop down menu effect over an existing layer? Cocos2d

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…
Stephen
  • 499
  • 9
  • 28
0
votes
2 answers

Cocos2D: How to send events between different classes

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…
William Robinson
  • 1,038
  • 17
  • 32
0
votes
1 answer

Want to draw a Solid Circle/Dot only after tapping a button in cocos2d

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…
iUser
  • 1,075
  • 3
  • 20
  • 49
0
votes
1 answer

Cocos2d game layer jerky when run, smooth after replaceScene with same scene

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…
TinoK
  • 301
  • 1
  • 9
0
votes
2 answers

How to take screenshot of device camera with the CCLayer on it

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…
0
votes
1 answer

How to make openGLView transparent?

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…
Shailesh
  • 3,072
  • 3
  • 24
  • 33
0
votes
2 answers

Swiping across multiple CCLayers

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…
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
0
votes
2 answers

Center a CCLabelTTF on a CCSprite

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…
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
0
votes
1 answer

Adding CCLayer to CCMenu

How can a CCLayer subclass be added to a CCMenu? I have a CCLayer subclass that's like a switch control and I'd like to include in a CCMenu.
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
0
votes
2 answers

When to use CCScene vs CCLayer?

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,…
GoldenJoe
  • 7,874
  • 7
  • 53
  • 92
0
votes
1 answer

cocos2d cannot add child asynchronously

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…
mmvie
  • 2,571
  • 7
  • 24
  • 39
0
votes
1 answer

HUD layer not being added on my scene

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…
Shailesh
  • 3,072
  • 3
  • 24
  • 33
0
votes
1 answer

Multiple touch enabled CCLayers, top layer not consuming touches

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…
TheDanman
  • 98
  • 1
  • 8