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
2
votes
1 answer

Cocos2d crash in CCLayer only on first run of the app

I have the newest cocos2d, Xcode4 and iOS5 SDK. I am testing my app on my iPhone 4 (5.0.1). No crashes occur on the simulator - only on devices. On first run, my app crashes before entering the first scene, which it does by CCTransitionFade. It…
JimmyB
  • 326
  • 3
  • 12
2
votes
1 answer

how to pop a layer in cocos2d

please look the following picture i want to do this function,when i click some button,it pop out a layer my code is -(id)init{ if (self = [super init]) { CCMenuItem *successbtn = [CCMenuItemImage itemFromNormalImage:@"success.png" …
Bin
  • 484
  • 1
  • 6
  • 18
2
votes
1 answer

Cocos2d: Calling function from one CCLayer in another (parent?) CCLayer

Hello awesome dev community. I have looked for an answer to this for days now and just can't seem to find a handle, so decided to post Q myself. I have a game that has menus for picking items. The menus can have 2 -> 30+ items, so they need to…
Hanaan Rosenthal
  • 1,359
  • 1
  • 11
  • 20
2
votes
3 answers

Difference between CCLayer::init() and CCLayer::onEnter()?

Here is the topic on Difference between CCNode::init() and CCNode::onEnter(). However I followed the advice they gave. void MyLayer::onEnter() { CCLayer::onEnter(); //your code goes here } I got the Assertion failed! error! MyLayer…
einverne
  • 6,454
  • 6
  • 45
  • 91
2
votes
3 answers

Cocos2d. Load and store images correctly?

There are a lot of answers for this question. But all of them are incorrect! For example if I have created a CCLayer object with one CCSprite object. I have 3 textures and I want to switch between them on every touch. For example I will use…
Gargo
  • 1,135
  • 1
  • 10
  • 21
2
votes
1 answer

Cocos2d. One instance of CCLayer with particles for a lot of scenes?

I want to create a starry sky for some scenes. The main problem is it needs some time to fill all the screen with particles. Someone advices me to create the whole sky at the beginning and save it between its calls. I tried something like…
Gargo
  • 704
  • 6
  • 16
1
vote
1 answer

cocso2d pinch-zoom like Fieldrunners

I've been trying to set up the parallax node correctly but need some help with this. This http://goo.gl/Piqy5 would be the frame of the game and for the parallax node area I have 3 layers: background layer (zoomable but not scrollable, z order…
el.severo
  • 2,202
  • 6
  • 31
  • 62
1
vote
2 answers

Cocos2d populate layer based on menu in a different layer

I'm working on a species ID app and would like to populate a layer with sprites based on which animal you select on the main layer. I've made each animal a menu item, and can get my info layer to appear when pressing the button, but how can I set it…
BobbyScon
  • 2,537
  • 2
  • 23
  • 32
1
vote
1 answer

textFiled shouldChangeCharactersInRange function didn't work

I'm using cocos2d CClayer. I made Submit TextField Class to use submit name. I followed some blogger and managed to show textFiled, but the shouldChangeCharactersInRange didn't call at all. How do i call shouldChangeCharactersInRange? (I didn't use…
CoreApps
  • 13
  • 4
1
vote
2 answers

(Cocos2D) Detect which CCScene is showing?

Is it possible to detect which CCScene is currently showing on the scene? I have 2 CCScenes in my game and I want a certain action to occur if one is showing. Also quick related question, if I wanted to check if a CCMenu is not showing currently…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
1
vote
1 answer

How to layer a CCSprite on top of a CCSprite?

In my game, I have a series of avatars, currently each avatar has a small rectangular container to denote that this image is a button and can be clicked. However, I've realised that I need to change the color of the container to denote a visual…
zardon
  • 2,910
  • 6
  • 37
  • 58
1
vote
1 answer

Pinch to zoom with CCParallaxNode

How do I implement pinch to zoom to a parallax scrolling node?
el.severo
  • 2,202
  • 6
  • 31
  • 62
1
vote
1 answer

how to do a function for a sprite or menu in cocos2d?

I created two CCLayers, one is gamelayer, another is howlayer. The code of gamelayer.m is -(id)init{ if (self = [super init]) { CCSprite *gamebg = [CCSprite spriteWithFile:@"bg.png"]; gamebg.anchorPoint = CGPointZero; [self…
Bin
  • 484
  • 1
  • 6
  • 18
1
vote
1 answer

How to slider in CClayer?

I have to add one slider in CCLayer. How to make slider. I went through online and I got there is one object t but which is available in UISlider. If I am implementing it then how will I add it into cclayer? I m making a small test game for iPad.…
Ajay_Kumar
  • 1,381
  • 10
  • 34
  • 62
1
vote
0 answers

iPhone frame rate drops when rotation CCLayer 90 degrees with cocos2d

I am finished my cocos2d project, which uses the accelerometer to rotate the current CCLayer for a particular game mechanic. I've always noticed a 10-15 fps drop of which I couldn't find and decided to take look now. I thought it would have…
user876197
  • 11
  • 2