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

How to replace layers?

I started to learn Objective-C and use cocos2D about 1 month ago. I want to replace three different layers by tapping buttons. At first, I tried to use "CCLayerMultiplex." Then, use "if sentence." But then the layers just overlap or crash when the…
tamachan
  • 11
  • 3
1
vote
2 answers

Cocos2D: Subclassing sprite and animation as CCLayer is giving me trouble

I started experimenting with Cocos2D with Tiled, and had the player sprite and actions coded within a CCLayer along with everything else. Before continuing on, I wanted to subclass the player into a CCLayer, which I hope is correct. My header and…
Chewie The Chorkie
  • 4,896
  • 9
  • 46
  • 90
1
vote
5 answers

How to move CCLayer in cocos2d

Can any one tell me how to move a CClayer. Like DoodleJump when object will move upward the background will also move upward.Plz Explain me with some sample code.
russell
  • 3,668
  • 9
  • 43
  • 56
1
vote
1 answer

Cocos2d: Activity class & CCLayer class

Im building a game using eclipse and now I wanted to use Cocos2d engine. My problem is I want to merge my done program and sliding menu of cocos2d engine. And now my question is how can I extend my Menu Class to Activity class so I can call onCreate…
1
vote
1 answer

Game over popup in Cocos2d v3 iOS

I want to create a Game Over Pop Up, with two buttons and a high score label etc.. This pop up will be visible when the game over event happens and the gameplay scene will be paused. I tried to implement a game over scene (a separate GameOver class)…
Hyder
  • 1,163
  • 2
  • 13
  • 37
1
vote
1 answer

cocos2d. Object similar to ccsprite but without pictue?

CCSprite class reference I need an object in which I can draw and it also has fixed rect size with position. It seems CCSprite has everything I need but it can be initialized with picture only. CCLayer can be initialized without picture but it…
Gargo
  • 1,135
  • 1
  • 10
  • 21
1
vote
2 answers

how to close layer that showed in other layer in cocos2d-iphone

I have one layer called alayer, and there is a button called abutton, when click the button, another layer called blayer will show in alayer, not replaceScene, please look at the following code, alayer.m -(void)abuttonclicked:(id)sender { blayer…
yegomo
  • 297
  • 2
  • 11
1
vote
2 answers

CCMenuItem independent from gesture recognicers view cocos 2D

I have a CClayer class, called GridLayer I add the gesture recognizers (Pan ,Pinch and Rotate) to the view and it works fine, but if i add a CCMenuItem is paste to the view so is affected by the rotate and pinch gestures , my question is who…
1
vote
1 answer

Detecting on which CCSprite has been clicked

My main screen is Main.ccbi, it contains 3 CCSprite. Now I want that when user clicks on a CCSprite I should know on which he has clicked? I want to calculate in CCMotionBegin method that on which CCSprite user has clicked.
Zubair
  • 304
  • 1
  • 5
  • 19
1
vote
2 answers

Communitacting between CCLayers in one Scene

I have 2 CCLayers that needs to communicate with each other in separate .m files Level1.m (CCScene with Level1 CCLayer) - Holds tiled map and player sprite HUDLayer.m (links to top of Level1.m) - Holds all buttons How can I get the following code…
Troy R
  • 426
  • 2
  • 16
1
vote
1 answer

Random Crash with CA::Layer::set_position

I have a crashing bug in my app. It happens in the same place, but not all the time. I haven't found the problem. Here are two crash logs: Incident Identifier: EB73AE61-00FB-4282-8F1D-B8ECEC19E02D CrashReporter Key: …
VivienCormier
  • 1,133
  • 1
  • 11
  • 16
1
vote
1 answer

How do I find out UIButton drag is completed when the UIButton is inside a cocos2d CCLayer?

I have a cocos2d CCLayer class that has both CCSprites as well as UIButtons. I would like the player to be able to touch and drag the UIButtons around on the screen, when the finger is released I want to perform some action. Here is the snippet of…
Madhav Sbss
  • 325
  • 2
  • 7
1
vote
3 answers

Sharing common header and footer CCLayers across multiple CCScenes and make it updatable

In my cocos2d game I am needing to share a common header and footer that will appear on every game layer. The header contains things like cash, and sprites -- whereas the footer contains CCMenuItem buttons to move between the different game…
zardon
  • 2,910
  • 6
  • 37
  • 58
1
vote
0 answers

How to pinch/zoom on a cocos2d (Kobold2D) CCLayer

I have been trying to implement a standard pinch/zoom on a CCLayer in cocos2d (using the Kobold2D gesture recognisers) but with only partial success. Below is my code which does make pinch/zoom work, so long as the pinch point doesn't move. However…
Paul Masri-Stone
  • 2,843
  • 3
  • 29
  • 51
1
vote
0 answers

In need of basics of AVFoundation to capture images from device camera

I want to know that how can we capture image using AVFoundation framework, I have managed to activate the camera and my Cocos2D view is over the camera and is tranparent. I have tried using some tutorials but I am unable to capture the images( Still…
Shailesh
  • 3,072
  • 3
  • 24
  • 33