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

learn more… | top users | synonyms

1
vote
1answer
208 views

Game design and SoC

I've been working on a little game for the last few months, trying to approach it as a software engineer and employ best patterns and practices in my coding. I have gotten to the point where I have to ...
0
votes
2answers
138 views

Can CCAnimations be paused?

I am new to cocos2d. I am using CCAnimation. It's working fine, except I want to pause the animation occasionally. How do I do this? Here's what I'm doing so far: [mySprite ...
2
votes
1answer
304 views

Blending transition in cocos2d

In my cocos2d-iphone game, I have 2 backgrounds (CCnodes), each containing a quite complex hierarchy of sprites. I would like to make a smooth transition between them: initially, only the first ...
4
votes
2answers
1k views

Presenting game center leaderboard

I have the following code: -(void)showLeaderboard { GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != NULL) { ...
0
votes
1answer
951 views

Integrating game center into cocos2d

I have a Cocos 2d game in which I want to have achievements and a leader-board. What are the steps I would need to take? Thanks P.S All of the tutorials I have found are outdated. So please write ...
3
votes
0answers
261 views

How to achieve 'forward' movement (into the screen) using Cocos2D?

I'm interested in creating a 2.5D first-person shooter (like Doom) and I currently don't understand how to implement the player moving forward. The player will also be able to browse around the world ...
3
votes
0answers
117 views

How to use a mask texture with Kobold2D

I am an iOS developer but I'm new to cocos2d. I'm working on new game, I use Kobold2D, have cocos2d installed too, and I want to make this effect: I know how is done with Flash, but can't make it ...
3
votes
1answer
197 views

GUI device for throwing a ball

The hero has a ball, which shall be thrown with accuracy in a court on iPhone/iPad. The player is seen from above, in a 2D view. In game play, the player reach is between 1/15 and 1/6 of the height of ...
-2
votes
1answer
2k views

The best way to structure/design game code [closed]

My question is quite broad and related to the 2D game code design/architecture/structure. Usually the main game consists of the main loop where you update & render your world states. However, ...
2
votes
2answers
377 views

Importance of scripting engine at Cocos2d Game Engine

Each Game Engine is different and solves different problems in different ways, so the engine design does vary greatly from engine to engine (even though a lot of principles are shared from engine to ...
2
votes
1answer
241 views

Side scroll game with 8000xScreen_Height, which technique is best

I got one new requirement for iOS side scroll game with screen size : 8000xScreen_Height For this, tileMap is best or normal texture based is best? I need to use parallax background too. Help me to ...
0
votes
0answers
266 views

Cocos2d Tiled Dynamic Object Layer

I'm trying to develop a cocos2d tiled based game using a sort of 'dynamic' object layer. What I want to do is after the tiled map is loaded, the user can drag something into the map and that will ...
2
votes
1answer
455 views

cocos2d/OpenGL multitexturing problem

I've got a simple shader to test multitextureing the problem is both samplers are using same image as their reference. the shader code is basically just this : vec4 mid = ...
1
vote
2answers
214 views

Crash due to removal of Elements like CCSprite from NSMutableArray

So, here's how it goes. I am currently working on Cocos2d game, which consists of many Obstacles. One obstacle gets added on the screen at an interval of 10 seconds like this. ObstacleSprite* ...
12
votes
5answers
1k views

tunnel effect cocos2d

I am looking to create a similar tunnel effect in COCOS2D (iOS). Could anyone suggest any pointers? ref Video 1 ref Video 2 Till now I have tried with several ring shape sprites with decreasing ...
-2
votes
1answer
326 views

How to fly enemies like galaxian game enemies?

I am developing game like galaxian and using cocos2d with box2d .I don't have idea how to create enemies like galaxian game enemies and how do they fly over the screen. ...
3
votes
2answers
404 views

Separating UI and logic in Objective-C at iOS based Games

How to separate UI and logic in Objective-C based mobile games? To develop games, I use Cocos2d library. I need a good reference to separate my UI code from game logic code.
0
votes
1answer
111 views

using lua in kobold2d to control parameters

Is there a tutorial on using LUA in Kobold2d? I want to know if its possible to use it to control the game behavior (like max speed decrease of timer, and bonus points) by uploading a new script to ...
2
votes
1answer
979 views

How to get all child with same tag from CCLayer?

Actually i am working with cocos2d Game. I am using CCLayer for particular scene. now there are so many buttons means CCMenuitems are available. I want to disable that all menuitems having same tags.
7
votes
2answers
914 views

What is the correct way to implement hit detection with non-rectangular sprites?

What is the correct way to implement hit or touch detection for non-rectangular sprites in Cocos2d? I am working on a jigsaw puzzle, so our sprites have some strange forms (jigsaw puzzle bricks). As ...
1
vote
1answer
1k views

use of undeclared identifier 'GL_TEXTURE_COORD_ARRAY'

Anyone please help me .i am working on sneakyjoystick class when i import these class some error are identified they are following :- use of undeclared identifier 'GL_TEXTURE_COORD_ARRAY' use of ...
-3
votes
1answer
560 views

My Sprite comes out the screen

If i an action moves the sprite,how can i keep the CCSprite on the screen???? this is my code: [enemy runAction:[CCSequence actions:[CCMoveBy actionWithDuration:2.0 position:ccp(-winSize.width*0.4, ...
1
vote
1answer
528 views

Unit Testing with Cocos2D

How to implement Unit Testing with Cocos2D framework? What are the good practices? Is there any testing framework like JUnit Framework at Eclipse for Android?
3
votes
1answer
255 views

Cocos2D Command-Line Application

Is it possible to create a terminal application which uses cocos2d? I've tried to make one using cocos2d 2.x, but it requires a MacGLView to be initialized. I need it so that I could program a ...
2
votes
1answer
303 views

Wheel rotation, to change velocity of vehicle

I update the velocity of my vehicle like so: [v setVelocity: ((2 * 3.14 * 100 * (wheel.getRotationValue / 360) / 30)) * gameSpeed]; // update on 60 fps this gets velocity on all frames divide by 60 ...
0
votes
1answer
569 views

EXC_BAD_ACCESS error when box2d joint is destroyed

When I destroy the weldJoint in the update method (see below) I get an EXC_BAD_ACCESS error pointing to the line world->DestroyJoint(weldJoint); in the update method below: -(void) update: ...
1
vote
1answer
4k views

Accelerometer to move player left and right

Please take a look on my code and help me to find problem. I used this tutorial: COCOS2D_ACCELEROMETER_MOVEMENT This works only sometime….some time not move..How can I resolve this problem? Here is ...
-2
votes
1answer
879 views

Cocos2D game engine javascript is too slow on mobile

i developed a game using cocos2D javascript that works fine on web browsers but when i run it on mobile ( iPhone 4s , android nexus) the FPS was dropped to 20 - 22 on iPhone (max) how to optimize it ...
-1
votes
1answer
372 views

Help with Music Rhythm Game (Cocos2D)

I'm basically new to the whole idea of Cocos2d.. i am aware of CocosDhension.. however, i still cant get the idea of working around it.. My idea, i would like to try to create something like "Tap ...
1
vote
3answers
2k views

Moving camera in large view

In my cocos2d app I was wondering how to make a CCSprite move on the screen but have the screen focused on the CCSprite, so when the sprite moves the view moves with the CCSprite. Is there a tutorial ...
4
votes
2answers
1k views

How to achieve smooth gameplay in a physics based multiplayer game? (2d)

I'm using cocos2d 2.0 and Gamekit for networking. I've got a server/client model. It works over wifi (local) and bluetooth. (Xcode 4.3, Objective C) Basically, there's a ball and 2 or more players. ...
-2
votes
1answer
1k views

Rolling a 3d die in cocos2d

How can I have a 6 sided die in my cocos2d game and when the device is shaked the die rolls and shows a number? I would also use UIKit if it was necessary.
0
votes
1answer
305 views

Touching a CGRect

In my cocos2d app I am trying to determine when a CCSprite is touched Here is what I have: -(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{ NSMutableArray *targetsToDelete = ...
0
votes
2answers
163 views

Falling images that can be pressed

In my cocos2d app I am trying to make images fall from the top of the screen and detect when they are pressed. I am having a hard time. Can anyone help me achieve this? Thanks.
2
votes
1answer
183 views

Game speed cubic growth

Is it possible, using delta in my update method to increase a game speed variable exponentially on cubic growth (the blue line below) My maths isn't great so I'm not sure how the formula would be ...
0
votes
1answer
406 views

Keeping the CCSprite on the screen

In my cocos2d app I have a CCSprite moving on the screen but it moves off the screen. How can I prevent the CCSprite from moving off the screen? Thanks
2
votes
1answer
387 views

Which data structure should I use for dynamically generated platforms?

I'm creating a platform type of game with various types of platforms. Platforms that move, shake, rotate, etc. Multiple types and multiple of each type can be on the screen at once. The platforms will ...
4
votes
1answer
468 views

Cocos2d: Tongue effect like in Munch Time

I'm wanting to do a tongue effect for my character like the one in Munch Time( shown in pic ). The player does some action and his tongue attaches to the nearest platform. I'm thinking this is ...
1
vote
1answer
303 views

Adjust sprite bounds of the visible part of texture

Is there any way to adjust the boundaries of the visible part of the sprite? To make it easier to understand: I have a texture, such as shown at figure 1. Then I break it into pieces and fill the ...
3
votes
1answer
2k views

Cocos2D 2.0 - masking a sprite

I have read this tutorial about how to mask sprites using Cocos2D 2.0. http://www.raywenderlich.com/4428/how-to-mask-a-sprite-with-cocos2d-2-0 But the author talks about OpenGL ES textures and ...
3
votes
1answer
413 views

Smoothing rotation

I've spent the last three days trying to work out how to rotate a sprite smoothly depending on the velocity.x value of the sprite. I'm using this: float Proportion = 9.5; float maxDiff = 200; float ...
1
vote
2answers
662 views

Using two joysticks in Cocos2D

Here is what I am trying to do: With the left joystick the player can steer the figure and with the right joystick it can attack. Problem is that the left joystick seems to get all the input, the ...
0
votes
1answer
214 views

Rotation based on x coordinate and x velocity?

-(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { float deceleration = 0.3f, sensitivity = 8.0f, maxVelocity = 150; // adjust velocity based on ...
0
votes
2answers
1k views

Top down water view, cocos2d

Has anyone successfully created a top down view of a stream/river? I need to also work out how to make it look like a boat is cutting through the water.
0
votes
1answer
661 views

Cocos2D: Change animation based on joystick direction

I'm trying to get my figure to look in the right directions, based on the input of the joystick. So if I tilt left it looks left and the left animation is used, if I used right, it looks right and ...
0
votes
1answer
2k views

How to simulate a water splash effect?

I need to achieve the effect of a ball falling down into a pool then splashing in the water. At first, I made a sensor to detect the collision between the ball and the water and then show the sprite ...
2
votes
1answer
369 views

Image 1 becomes image 2 with sliding effect from left to right?

I would like to show a second image appearing while a "door" is closing on my character. I've got my character in the middle of the screen and a door coming from the left. When the door passes my ...
-1
votes
1answer
159 views

Make a CCSprite come up from bottom of the screen in intervals

I have a cocos2d iOS app. I have a CCSprite that I need to come up from the bottom of the screen every few seconds (like 2 or 3 seconds). How would I do this?
0
votes
1answer
884 views

Shaders in Cocos2d 2.0

I'm thinking of using cocos2d 2.0 for my next project and am wanting to know if it's possible to have a shader that renders to a texture and that texture be input into another shader? I have a few ...
1
vote
1answer
476 views

Store and create game objects at positions along terrain

I have a circular character that rolls down terrain like that shown in the picture below. The terrain is created from an array holding 1000 points. The ground is drawn one screen width infront and ...