cocos2d for iPhone is a free open-source framework for building 2D games, demos, and other graphical/interactive applications for iOS devices.

learn more… | top users | synonyms

0
votes
1answer
23 views

cocos2dx: Your RunningScene != Scene You just Replace

I have this code for cocos2d-x 3.x: void MainMenu::StartGame(cocos2d::Ref* pSender) { auto director = Director::getInstance(); auto newScene = Scene::create(); ...
0
votes
1answer
17 views

supporting multiple resolutions on mobile (cocos2d, ios)

I am looking into ios game development and the first question that comes to mind is how to support the growing number of iphone resolutions. I have seen the Unity strategy of normalized screen ...
1
vote
0answers
33 views

Loading Textures in Background Cocos2d Objective C loading CCScene

I am allocating a few CCScene subclasses, but when I do this, it takes more than 10 seconds. What I am trying to achieve is to perform a small CCAmimation, such as a loading logo glowing. My question ...
0
votes
0answers
15 views

CCActionMoveBy doesnot working properly when the action called for many of the sprite in cocos2d

I have an issue with CCActionMoveBy when I call the movement action for many of my sprites. I need to move to a certain position and then remove it from the scene. My problem is If the call the ...
0
votes
0answers
12 views

applyImpulse on CCSprite not making realistic moves

I am developing a jump game, in that when tapped on screen, I need to make the player jump up. So, I used following code. [_player.physicsBody applyImpulse: ccp(0, player.physicsBody.mass * 155)]; ...
0
votes
0answers
22 views

Using Tile Maps with cocos2d - how do I handle a large amount of images?

I am building a game where the users (players) can build their own town. There they can build houses, add furniture to the houses etc etc. Basically similar to The Sims. I am using the Tiled Map ...
0
votes
0answers
26 views

Cocos2D v3 CCParallaxNode scrolling can't keep player in focus

I am very fresher to game development and I need to develop a game like NinjaJump. I have created a CCParallaxNode to setup scrolling background and added CCPhysicsNode to setup Physics world. I have ...
0
votes
1answer
33 views

Moving CCNode with constant speed in cocos2d

I want to move the object (CCNODE) with constant speed in any direction , what i have did till now is applied a force to object at start to get it moving and set elasticity as 1 and friction as 0 to ...
-1
votes
1answer
30 views

Cocos2d: Positioning Sprites in complex layout patterns [closed]

I'm wondering if anyone has suggestions for how to manage the positioning of many sprites in pre-set and complicated patterns? Currently the brute-force method is to painstakingly code each sprite ...
2
votes
2answers
233 views

Mathematics of difficulty acceleration in endless runners

I'm currently working on an endless runner and was wondering about the growth of difficulty in the game. Is the acceleration of difficulty highly specific to games or are there standard growth ...
2
votes
0answers
132 views

Why AnchorPoint doesn't affect `CCLayer` Positioning?

I think there is a difference between CCLayer and CCNode behavior when I change their AnchorPoint. I will describe what I mean and please somebody explain it ? Scenario: I start with CCNode CCNode ...
0
votes
1answer
80 views

cocos2d + sneakyinput joystick multitouch problem

I've added a joystick to my iOS game using the latest SneakyInput joystick code for cocos2d v3. It works well, but when a CCButton I have is pressed, the joystick touch event ends. Based on my ...
0
votes
0answers
37 views

CCTextField won't appear

I can't seem to add a CCTextField in my physics node, I tried all different methods, but it's still not happening. Here's my code: CCTextField *tf = [[CCTextField alloc] init]; tf.contentSize = ...
0
votes
1answer
104 views

Error running an Action in Cocos2d-x

In my game I have a "rocket" type and I want to run a sequence of actions on it. At first it must run an explosion animation and then remove itself from the game. For this I used the following code, ...
2
votes
2answers
55 views

How can I add an impulse to specific rigid bodies at rest?

Scenario Rocks falling down a rocky slope, with a flat surface at the bottom. When they land on the surface, the rocks move slightly before coming to a rest. GLESDebugDraw shows the bright orange ...
0
votes
0answers
12 views

Complex Body with multiple BodyDefs

My complex body is made up of several parts some of which are static and some are dynamic and have specific positions relative to each other. Because the static/dynamic property and position goes in ...
-1
votes
1answer
389 views

How to pause and unpause the Particular action of a sprite?

My game has a sprite representing a character. When the character picks up an item, the sprite should stop moving for a period of time. I use CCbezier to make the sprite move, like this: ...
1
vote
1answer
113 views

Creating a tilemap region of clickable buildings in cocos2d

How do you turn a tilemap (produced by TileD) for cocos2d where I can click on individual items and get a callback? Is it just a case of converting captured touch and finding out where it is on the ...
1
vote
1answer
79 views

Manually remove inactive CCParticleSystem from scene?

When using particle systems that have a lifetime, with CCParticleSystem and its derived classes, should I manually remove the finished systems from their parent nodes once the particle animations are ...
0
votes
1answer
273 views

I need some help with stopping individual sound effects in OALSimpleAudio

I'm trying to find out how to stop a specific sound effect rather than having to stop all of them. I'm using OALSimpleAudio. I can't seem to find how to do it. simple google searches result in ...
0
votes
0answers
152 views

Require game logic like temple run

I am new at game development but I have done some work in cocos2dx for iphone. I am interested to develop a game like temple run. I read that temple run is 2D game feel like 3D but I believe that I ...
0
votes
0answers
86 views

How do I get a sprite's angle after collision?

I'm using Cocos2d (version 3) and I want my hero sprite to be jostled around by incoming enemy sprites. The Chipmunk-based physics work, but I need some way to track the rotation of the sprite after a ...
1
vote
1answer
521 views

Spritebuilder and CCScrollView, page indicators not showing up?

I'm using Spritebuilder to make my game, and CCScrollView usually saves me quite a bit of time. I'm trying to implement the scroll view much in the same way as the home screen on an iphone uses the ...
0
votes
1answer
167 views

Incorrect sprite rotation with atan2() [duplicate]

I want to rotate a sprite so that it faces the mouse cursor/screen touch location. Currently I'm using the following method to compute the angle of rotation. The input position is the target point the ...
0
votes
1answer
599 views

Preload in cocos2d v3

I'm trying to create a preload, but i don't know how to implement the code of this topic in cocos2d iphone v3. Since CCTextureCache has changed to CCTexture, and doesn't have sharedTextureCache ...
0
votes
2answers
45 views

Count number of CCNodes of a certain class on a layer

Pretty simple question. I'm working in Objective C (cocos2d) and I'm trying to count the number of a sprites of a certain class are present on the current layer being displayed. For example, I have a ...
0
votes
1answer
84 views

Get Facebook Picture in Cocos2d-iphone V3

I'm trying to get the profile picture from Facebook, but I'm getting the following error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage ...
0
votes
1answer
195 views

try to create CCSpriteFrame but get nil values

I'm trying to animate a CCSprite in cocos2d v3 following this question, but I'm getting the following error message in Log: Terminating app due to uncaught exception 'NSInvalidArgumentException', ...
0
votes
1answer
78 views

Stop schedule on gameOver

I have 2 events running through time in my game. I want that when gameover starts, this events stops running This is my code: - (void)onEnter { [super onEnter]; [self ...
0
votes
2answers
340 views

Game over pop-up like Flappy Bird

How can I make a game over pop-up like Flappy Bird in cocos2d-iphone 3? I tried to add a new Scene, but it adds a new screen on the game, I just want a rectangle with some buttons inside it. I also ...
0
votes
0answers
49 views

Prismatic Joint causes a crash-Box2D(cocos2d)

tried to set up a prismatic joint, but I get this error upon run time: Assertion failed: (IsLocked() == false), function CreateBody, file ...
0
votes
1answer
154 views

Particle effect in sprite

I want to create a particle effect when my player sprite collide with my star sprite. How can I add a particleSystem in the sprite and not in a image? Also, I wish if it could wait for the animation ...
6
votes
1answer
761 views

OpenGL ES object rotation around z axis

I have an object on my screen which is presented rotated and panned, But i have 2 problems regarding the z axis rotations. It's a bit tricky to explain so i uploaded 2 videos to describe each problem. ...
1
vote
0answers
53 views

Building a guided tracing scene

I'm trying to figure out an approach to creating a cocos2d scene that would help kiddos learn to draw letters of the alphabet. Right now I am just using Apple’s PaintView demo code and applying an ...
0
votes
3answers
380 views

How can I ensure I still get correct touch inputs when my scene is offset?

How can I accept touch input beyond the scene's bounds, so that no matter what I set self.position to, touches can still be detected? I'm creating a tile based game from Ray Winderlich on Cocos2d ...
3
votes
1answer
263 views

Verify which bubble is connected to top using DFS

I am working on a bubble shooter game in this game i have implemented searching using DFS as suggested in this link, and this is working fine. Update Here is my code for DFS ...
1
vote
1answer
189 views

Dynamic Hills like Contre Jour in Cocos2d

I'm interested in maps/environments which are flexible and change at runtime, such as those in Contre Jour. I have looked for a long time to find out how to make this effect, but I couldn't find an ...
0
votes
1answer
468 views

Tower defense endless levels logic sprite kit [closed]

I am making a tower defense game for iOS using Sprite Kit. I would like for my game to support an endless number of levels, like in Bloons TD 5. What approach should I take to implement this?
0
votes
0answers
346 views

OpenGL error 0x0506 in -[CCSprite draw] 530 to run project on ios divice in cocos2d?

I am running my cocos2d program on simulator. It works fine but when I run it on device, it throws error OpenGL error 0x0506 in -[CCSprite draw] 530. In my program I want to push one scene to another ...
0
votes
1answer
134 views

Walking Sprite animation Cocos2D [closed]

I am new to cocos2D development. Basically I want to develop game in which i want to move sprite forward with walking kind animation, must look real. Any help will be appreciated.
0
votes
1answer
135 views

How set and count Angle of sprite (turret) object in portrait mode in cocos2d?

I am new in cocos2d.I follow Raywenderlich tutorial series. I wish to set turrets in below of the screen in portrait mode.when user touch that location fire bullet and turret fire position at the ...
0
votes
1answer
71 views

Fast Forward Drawing using ACEdrawingView

i am using this : https://github.com/acerbetti/ACEDrawingView i want to implemented one Functionality in which i want Fast drawing by clicking on a Button. i am drawing points on screen. i have ...
0
votes
0answers
75 views

Push viewcontroller to ccscene take moretime and more memory uses in cocos2d?

Hello friends I am push ViewController to CCscene successfully but when I click on "Push Button" it takes 5-6 seconds to push to CCScene. Also, each time memory use increases. It's not smooth. ...
0
votes
0answers
257 views

Cocos2D - Simulating infinite scrolling

I have a BIG problem!! I want to make something like old space shooter games like “Asteroids”, where the ship, when going out of the screen, is reappearing at the other side. For example, when the ...
0
votes
1answer
75 views

Create body on a sprite (box2D)

I'm quite experimented in objective C, but now i'm tried cocos2D and his features. I need to add a body on a spritesheet (if possible on a classic 'UIImageView'), in order to detect collisions after. ...
0
votes
2answers
366 views

Cocos2d: Moving background on update: offsett issue

working with Objective C, iOS and Cocos2d I am developing a vertical scrolling shooter game for iPhone (retina display models with 640 width x 960 height pixel resolution). My basic algorithm works ...
1
vote
0answers
411 views

Cocos2d-x CCFollow Zooming issue

Hi I am currently building a cocos2d-x game which incorporates pinch zoom using CCLayerPanZoom class which can be found here The problem is basically when using CCFollow and zooming and out, it ...
2
votes
1answer
135 views

iOS Game that Runs Continuously in Background

I'm trying to understand the most logical way of creating an iOS game that runs continuously in the background. For example.. you have tower and enemy waves. The game has endless enemy waves even ...
0
votes
1answer
117 views

Move background with the player location

I want to move background with player location in ios . I have implemented the infinite parallax background by using the CCParallax class but i don't need it. I want to do something similar to this ...
0
votes
1answer
82 views

Getting a sprite from multiple sprites for right material pattern

Not sure how accurate the question was but I'll put it this way. I'm developing a game where player will construct his/her own stuff, like bridge, building etc. using cocos2d-iphone and Box2D. First ...