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
15
votes
4 answers

How to set background color of layer in cocos2d-x?

I've been writing a game using cocos2d-x and ran into an issue with changing the background color. I found an example in cocos2d, but apparently this only applies to cocos2d which is written in Obj-c. Basically the idea is to use a CCLayerColor…
Edward
  • 7,346
  • 8
  • 62
  • 123
11
votes
2 answers

Cocos2d 2.0 Adding UIView to CClayer openglview deprecated

I'm having some troubles adding an UIView to cocos2d v2.0 since the openGlView is deprecated I can't add the view to it. I was looking around to find another way to do this but I couldn't find anything. Can anyone tell me the new way to add an…
Rafael Jimeno
  • 626
  • 2
  • 8
  • 20
9
votes
3 answers

Math/Calculations for infinite/repeating world with rotation

How do I make a infinite/repeating world that handles rotation, just like in this game: http://bloodfromastone.co.uk/retaliation.html I have coded my rotating moving world by having a hierarchy like this: Scene   - mainLayer (CCLayer)      -…
Neigaard
  • 3,726
  • 9
  • 49
  • 85
6
votes
0 answers

How to use a UIView with a CCLayer cocos2d?

I am playing a short video with CCVideoPlayer in cocos2d and at the end of it I am capturing the very last frame of the video and I am showing it on the screen using a UIView because trying to draw it on a CCLayer makes the image show up with…
Stephen
  • 499
  • 9
  • 28
5
votes
2 answers

How do I remove a child later? (cocos2d)

I added a child like this inside of a CCLayer: [self addChild:object1]; Later on I want to remove that object from the children. Ummm so how do I do that? Thanks.
RexOnRoids
  • 14,002
  • 33
  • 96
  • 136
4
votes
2 answers

Cocos2d - Initial app layer displays incorrectly on app load, displays appropriately after reload

I'm using a GameManager singleton to handle some of the shared tasks required by my game. One of those tasks is loading individual game scenes. When the game starts up, whichever scene/layer combo I have displayed appears incorrectly; it looks…
Kevin Whitaker
  • 12,435
  • 12
  • 51
  • 89
4
votes
1 answer

How to transfer a CCSprite from one parent to another?

I have a CCSprite called sprite that is a child of a CCLayer called movingLayer that is itself a child of the current CCLayer running my game logic, so it is self in this case. movingLayer is moving back and forth across the screen in a repeat…
Steve
  • 6,332
  • 11
  • 41
  • 53
4
votes
4 answers

how push scene in cocos2d and pass parameters

i want know if there is a way to push a scene in cocos2d 2.0 and pass some parameter to this pushed scene, for example, i know that to push a scene i use this: [[CCDirector sharedDirector] pushScene:[HelloWorldLayer scene]]; and this push the…
Piero
  • 9,173
  • 18
  • 90
  • 160
3
votes
1 answer

How transition between layers in cocos2d?

I have a menu scene hierarchy like so: Scene | Background Layer | | Main Menu Settings Menu I want to transition from the Main Menu to the Settings Menu without moving the Background Layer. There is plenty of documentation on how…
rnystrom
  • 1,906
  • 2
  • 21
  • 47
3
votes
1 answer

CCLayer with round corners

Is there any way to create the subclass of CCLayer class with rounded corners in cocos2d iPhone library? Maybe some solutions already exists? Any ideas? Thank you.
user1021984
  • 621
  • 3
  • 9
  • 25
3
votes
2 answers

how to determine if a sprite is in a layer

Sorry if this sounds quite trivial. I am just not getting it. How can one determine if a particular sprite is already in a layer? Basically, I need to check this before determining whether to add it to the layer or not.
IMustCode
  • 109
  • 8
3
votes
1 answer

How do I create a blurred effect section of a CCLayer in Cocos2d?

Is there any way to "make" a rectangular section of a CCLayer blurred? Either by making a masking layer over the game layer, or by actually blurring part of the game layer?
marciokoko
  • 4,988
  • 8
  • 51
  • 91
3
votes
3 answers

How to use getAssets in a class that extends CCLayer

I have a class that extends CCLayer. I have to get a text file from assets folder. But i couldn't use getAssets() in this class. How can i use getAssets() in a class that extends CCLayer???
Deepzz
  • 4,573
  • 1
  • 28
  • 52
3
votes
0 answers

Autoresizing Layouts in Cocos2d

I'm trying to make a menu in Cocos 2D that will automatically relayout if it's size changes. With UIKit you can set autoresizing options (either programmatically or through Interface Builder), and I like to do something similar. Does an option…
InkGolem
  • 2,662
  • 1
  • 15
  • 22
2
votes
1 answer

Cocos2d how to scale a sprite without scaling layer? Or, How to scale and crop sprite/layer?

iPad App setup: SceneA contains layerA - 1024x768. Push a button in layerA, layerB drops down over top using a CCMoveTo action. LayerB is only 800x600 so you can see layerA behind it (think of an overlayed pause screen type effect). LayerB contains…
BobbyScon
  • 2,537
  • 2
  • 23
  • 32
1
2 3 4 5 6 7 8