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
0answers
12 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
79 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
63 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
34 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
0answers
14 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
26 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', ...
-1
votes
0answers
47 views

Ray casting not checking in front of sprite

I posted this on stack overflow and didn't get many responses, maybe this exchange is better suited. I rotate my sprite to make sure its facing the direction its going like this in my update method: ...
0
votes
1answer
25 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
101 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
14 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
72 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
296 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
35 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
2answers
186 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
193 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 ...
0
votes
1answer
76 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
268 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
82 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
79 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
38 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
44 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
22 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
96 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
46 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
123 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
293 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
122 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
92 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
69 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 ...
1
vote
3answers
124 views

Getting different x and y coordinates for touched location on a zoomed view

I'm using Cocos2d for developing a game. I need to be able to pan and zoom when necessary, so for this reason I've added CCLayerPanZoom extension to my project. Recently I've noticed a problem with ...
0
votes
2answers
77 views

How to define axis of Sprites in a CCAnimation?

I'm struggling to find how to define a kind of axis in my frames, when my sprite punches it moves back. I want to define the head as a pivot for the other sprites with different sizes. How can I ...
2
votes
1answer
548 views

Pixel Perfect Collision Detection in Cocos2dx

I am trying to port the pixel perfect collision detection in Cocos2d-x the original version was made for Cocos2D and can be found here: ...
0
votes
1answer
207 views

iOS with cocos2d to MVC or not to MVC?

I am working with cocos2d. All my objects are declared on the CCLayer that I'm using, I have the logic of the game there and all the CCSprites. Should I put the CCSprite for the player and all it's ...
0
votes
1answer
124 views

How do you align the edges of sprites?

If you have SpriteA and SpriteB. SpriteB is a child of SpriteA. Does anyone have a mechanism to come up with the left, right, top, side of a boundingbox() of SpriteA? What I'd like to do is align ...
0
votes
0answers
100 views

How do I find the rotation point given a touch anchor, new position and new rotation?

I've got an Cocos2d layer which anchorPoint, position and rotation (according to http://www.qcmat.com/understanding-anchorpoint-in-cocos2d/) vary when the pinch zoom gestures. Everything works fine. ...
0
votes
1answer
122 views

how to improve sprite animations to reduce FPS

My game has different, and detailed animations throughout the game. For example, the main character has an idle stance, so its not just painted still, giving him some life. Death animation, hurt ...
0
votes
1answer
64 views

Cocos2d When The Loading Screen Scene is loading music

When the loading screen loads objects like music cutscenes, the idea is to preload the objects, so... what should happen next? Do I transfer the objects to the next scene? or these special objects, ...
0
votes
1answer
208 views

Cocos2d how to correctly preload a spritesheet before the scene start?

I'm working on a game with Objective-C and Cocos2d, the game has a huge number of images, and obviously as I add images on the spritesheet (well yes I'm using spritesheets) the loading time get ...
0
votes
0answers
64 views

Crop CCSprite in irregular shapes

I am working on puzzle app. In which i need to crop a image(CCSprite) in irregular shape polygons, each polygon would have fixed vertices.I am developing this app in cocos2d(iphone).Any help would be ...
0
votes
1answer
82 views

How to use UILongPressGestureRecognizer with sprite drag & wait?

May be it's asked before also but I couldn't find any good answer. Please tell me how this can be implemented with UILongPressGestureRecognizer? A user drags a sprite from X location to Y location. ...
0
votes
0answers
22 views

Cocos2d FPS drops when ReplacingScene but Scene is not retained and its with ARC

I have a MainMenuScene and a GameScene... In the MainMenu I have the button start that goes to the GameScene, in the middle of the game I want to restart or just quit the game, which ever of those 2 ...
1
vote
0answers
71 views

UITapGestureRecognizer fast tapping not working [closed]

I have initialized UITapGesture as follows: tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; tapGestureRecognizer.numberOfTapsRequired = ...
2
votes
1answer
70 views

Display CCSprites with a delay

I am a beginner in cocos2d and I wanted to display coin CCSprites as soon as it moves off the screen with a 5 second delay. So this is what I wrote in my main gameplay layer to add 7 coins in a row: ...
3
votes
0answers
170 views

Display and Hide CCSprite with Genie effect

I am new at cocos2D. I started to learn cocos2D with simple game from http://www.raywenderlich.com/tutorials#cocos2d tutorial. Now I'm crazy with animation, so now i want to display CCSprite as OSX ...
9
votes
2answers
395 views

How do I simulate a swinging pendulum?

I want to simulate a rope with a weight attached, swinging back and forth like a pendulum. Any actual physics is overkill; it's just endlessly repeating the same motion. JQuery has a the "swing" ease ...
5
votes
1answer
174 views

How can I implement a “Nyan Cat” rainbow?

I'm currently making a game similar to this Nyan Cat flash game, although I'm using cocos2d. I'm having a hard time trying to make the rainbow effect: Currently, every update call I add a piece of ...
3
votes
3answers
309 views

What is actually loaded during a game's loading screen?

I am at the stage of my game where I have to develop the loading screen. It's actually already there, but I don't know exactly what it should be loading while it's presented. Why would I have a ...
1
vote
1answer
613 views

2D Destructible Terrain with Box2D / Cocos2D -> Image Tracing

Bear with me as this will be a rather lengthy post. For the last month I have been working on an open source Cocos2D, Box2D Destructible Terrain Engine. I have some questions regarding its ...
3
votes
1answer
93 views

Is it better to preserve scenes in memory or recreate them every time I need them?

I am using Cocos Builder to create scenes using sceneWithNodeGraphFromFile:owner:. Now I have doubts about whether it's better, on iOS, to save some memory or CPU cycles. In other words I have two ...
0
votes
2answers
224 views

Drawing line from sprite with a touch

I am working with cocos2d for the iPhone and I have a question about how to implement the following. I have a circle shaped sprite on my layer. When I touch the sprite and move my finger a line must ...