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
1
vote
3 answers

CCLabelTTF Text Alignment

I have a class which mimics a button. It contains one label, which I'm trying to align centrally (horizontally). No matter what I try, the label stays on the left hand side, leading me to think this is more complicated than it seems. Here's the only…
Echilon
  • 10,064
  • 33
  • 131
  • 217
1
vote
1 answer

Using glScissor on a modal layer in cocos2d

I am coding a modal layer in cocos2d and I would like to use the OpenGL glScissor API call to crop the inside of a CCScrollLayer that I am using, Basically, Present some kind of Modal sprite Put CCScrollLayer with assets on the modal sprite I want…
zardon
  • 2,910
  • 6
  • 37
  • 58
1
vote
1 answer

Communication between 2 CClayers

//in Class A.h -> CODE: #import "B.h"; #import "cocos2d.h" #import "Box2D.h" #import "GLES-Render.h" #import "LevelHelperLoader.h" #import "ContactListener.h" #import "KKGameKitHelper.h" #import "LevelHelper.h" @interface A : CCLayer { b2World*…
stack
  • 951
  • 3
  • 9
  • 23
1
vote
1 answer

New 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
1
vote
2 answers

Touch handled by two layers

I have a CCLayer containing a number of other CCLayers (like items of text etc). I have another CCLayer to the left hand side with which I want to display thumbnails of a number of these 'scenes'. The left hand CCScrollLayer should respond to…
Echilon
  • 10,064
  • 33
  • 131
  • 217
1
vote
1 answer

Border around CCLayer

I'm using Cocos2d to drag sprite around, and trying to add a border if a sprite is selected. I can get my white background to display, but my border is proving particularly difficult. I have this code: if(self.selectedSprite) self.selectedSprite…
Echilon
  • 10,064
  • 33
  • 131
  • 217
1
vote
1 answer

Trouble with tap detection on CCLayer subclass

I have a CCLayer subclass MyLayer in which I handle touch events: (BOOL) ccTouchBegan:(UITouch *) touch withEvent:(UIEvent *) event I set the content size of MyLayer instances like this: `myLayer.contentSize = CGSizeMake(30.0, 30.0);` I then add…
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
0
votes
1 answer

Create a space environment with no gravity, Box2d or not?

I want to create a cclayer with 4-5 flying objects, flying in random directions on screen. I also want those flying objects transparent to each other, which means they can fly through each other. What I can think of Ways to do: With Box2D Create a…
Cullen SUN
  • 3,517
  • 3
  • 32
  • 33
0
votes
3 answers

Card Flip effect

I’m starting my development in Cocos2D and I wish to make this card effect you can see on the 0:26 second in this movie: http://www.youtube.com/watch?v=7gn7Obeykm8 Is there any special Cocos2D Transition for this effect?
Galfaroth
  • 33
  • 7
0
votes
1 answer

CCLayer setOpacity:] unrecognized selector

PopuupScene Layer @interface PopupScene : CCLayer Error Message Feb 22 11:06:31 unknown MyProject[443] : -[PopupScene setOpacity:]: unrecognized selector sent to instance 0xa68ca80 Feb 22 11:06:31 unknown MyProject[443] : *…
ChangUZ
  • 5,380
  • 10
  • 46
  • 64
0
votes
1 answer

define a cclayer in .h file

In my I've defined a CCLayer like this: @interface MyLayer : CCLayer { CCLayer * referenceLayer; } How should I declare it to use it in +(CCScene *) scene ? Like this ? @property (nonatomic, retain) CCLayer *referenceLayer;
el.severo
  • 2,202
  • 6
  • 31
  • 62
0
votes
1 answer

CGPath invisible on CCLayer

I am working with Cocos2d. I am trying to make a "trail" using a CGPath. The CGPath is on screen I have NSLogged it. The "trail" or CGPath isn't visible. - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); …
Asdrubal
  • 2,421
  • 4
  • 29
  • 37
0
votes
2 answers

Cocos2d iPhone. Scrollayer contentSize. Layers

I want to set the contentsize of scrollayer. I have a scrollayer, it's CCLayer type and moving is set by ccTouchMove. I have one schedule for smoothing. BUT. Problem is that scrolling layer is big like the whole display. I want to set the…
mayoxy
  • 89
  • 6
0
votes
1 answer

My CCScene is behaving oddly?

In my application I am noticing that there are may things that don't seem right in my CCScene. Ill just explain 3 things: 1. My FPS does not show anywhere in the view even though I do this from my UIViewController (My CCLayer is its own class) The…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
0
votes
1 answer

Touch location CCLayer

*Working Code Now* OK, I thought that this would be easy to get working but it turns out to not work like I expected. I am trying to get the Touch location from a CCLayer that can be moved or zoomed, not the location on the screen itself? here is…
EcksMedia
  • 461
  • 2
  • 5
  • 20