Tagged Questions

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
250 views

Preserving Cocos2D context between UIKit screens

My app is designed to use Cocos2D in the "main game screen" but the rest of the screens are in UIKit. While I feel that this isn't ideal, I really don't have time to port the rest of the screens into ...
2
votes
0answers
394 views

Can I use a shader with 2 different textures in Cocos2D (x)?

We are evaluating a variety of different graphic engines for use in our game and we want to be able to use 2 different textures for many of our sprite maps. One sprite map would be the standard RGBA ...
1
vote
1answer
1k views

3d transformation of game world keeping gameplay 2d - COCOS2D 2.0

Using: COCOS2D + iOS. I want to rotate the game world, may be loading another .tmx file for another dimensions when user want to switch dimension. the effect what I am looking for is something like ...
-1
votes
1answer
222 views

Parallax With Box2d iphone

I am creating the simple game. In that game car will move and obstacles will come in the car way we will have to save that car from that obstacles. What I have done. I have created the car with the ...
1
vote
2answers
737 views

8-bit Game: To pre-scale images, or post scale my Cocos2d scene. Which is the better approach?

I'm wanting to develop a game with an 8-bit feel. Since this game is mostly for my personal enjoyment, I've set a requirement that I want my game to have an 8-Bit feel to it that is most similar the ...
0
votes
1answer
2k views

How to create Elastic rope / Rubber band in box2d?

I am trying to create the rubber band type or elastic rope. i ant to do something like bellow link. http://heyalda.com/smash-turtle/ Thanks,
0
votes
1answer
470 views

Remove HUD from Child Scene

For my game, I create game scene for which I set HUD to it. First my game scene use BoundCamera, so I use hud to set score text, dollar text and setting button. Now on game scene when I touch on ...
-1
votes
1answer
110 views

How to create strength meter?

I am creating game like bow and arrow. I want my hero will shoot the arrow with the strength meter, how will create the power?
2
votes
1answer
312 views

Handle Multiple Scene

For my game, now I adopt the strategy to create multiple scene. For this I have to ask two question please provide your view for my and other members for improvement. I have created single ...
1
vote
1answer
540 views

How to execute AI in Cocos2d (replacing the Update method)

What is the best way to run AI in Cocos2d? I already have my AI implementations. Normally I would execute AI in my game loop by checking how much time has elapsed since last AI execution and whether ...
1
vote
1answer
226 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
164 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
359 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
1k 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
302 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
1answer
125 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
204 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
421 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
251 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
308 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
500 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
238 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 ...
-3
votes
1answer
358 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
440 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
115 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
1k 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
1k 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
615 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
550 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
281 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
318 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
622 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: ...
2
votes
1answer
5k 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
963 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
432 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
332 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
169 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
187 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
489 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
449 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
483 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
318 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
3k 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 ...