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

learn more… | top users | synonyms

2
votes
2answers
567 views

Z-order for cocos2d top-down game with sprite batching

I'm trying to understand how to create z-order system like you can see in http://www.realmofthemadgod.com/ Character is above the tree when he is in front of it and vice versa. Also, I'm planning to ...
1
vote
1answer
356 views

How can I create a curved line composed of images?

I have 50 little images. All are connected each other, as in a line, sort of like a cord. I want to move one of the node images and have the rest follow along like a cord, so they become a curve.
3
votes
2answers
4k views

Cocos2d rotating sprite while moving with CCBezierBy

I've done my moving actions which consists of sequences of CCBezierBy. However I would like the sprite to rotate by following the direction of the movement (like an airplane). How sould I do this with ...
1
vote
1answer
627 views

How can I place a ProgressBar in Android using Cocos 2d?

I want to place a horizontal progress bar in my Android application and I want to change its progress color. I used the following code, but the progress bar is not being displayed. CCProgressTimer ...
2
votes
1answer
2k views

Objective-c Cocos2d moving a sprite

I hope someone knows how to do the following with cocos2d: I want a sprite to move but not in a single line by using [cocosGuy runAction: [CCMoveTo actionWithDuration:1 position:location]]; What ...
1
vote
2answers
690 views

How can I disable/dim the screen when I click the pause button?

I am working in an android game using cocos2d. I want to dim the background screen when I click the pause button. How can I do this ?
2
votes
4answers
819 views

Changing background images frequently within a specific time range with Cocos2D

I am working on a game development project for Android. We use the Cocos2d framework. I have to design a page which contains two background images, I need to switch these images repeatedly within ...
-4
votes
1answer
158 views

How can I initialize 15-20 sprites with the same starting position?

How can I load 15-20 sprites in Cocos2D at the same point (ccp(20,20), which is an alias for CGPointMake) using NSArray? This is what I'm doing now, and it doesn't work: int i,endvalue=3; ...
2
votes
0answers
529 views

How to create a collidable map with tiled for cocos2d (Android)? [closed]

I am using cocos2d to create a game for Android. I am making a map in Tiled Map Editor and added a property to the ground tiles. The property name is Collidable and its value is True. Now I have ...
4
votes
1answer
3k views

In cocos2d's plist output, what are 'offset,' 'colorSourceRect,' and these other fields?

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> ...
-1
votes
1answer
553 views

How can I solve these errors when using SimpleAudioEngine?

I want to use SimpleAudioEngine for the music in a cocos2d game I'm working on. When I import SimpleAudioEngine.h in my game layer I get syntax errors in CVPixelBuffer.h and CMFormatDescription.h. ...
-4
votes
1answer
263 views

Why does this CCSprite subclass code throw an exception?

I have one problem in inheriting CCSprites in Java. Here is part of my code: public class Block extends CCSprite { static Block temp=null; static Block newBlock(tetrominoTypes blockType) { ...
4
votes
4answers
431 views

semi 3d walls, should I use sprite sheet or render them 3d?

I'm going to develop a game and this is just a prototype of it's graphics. Knowing that my primary target platform is iPhone, I'm wondering if it's better to create a spritesheet containing all ...
0
votes
1answer
1k views

How do I implement a subclass of CCSprite?

Can someone tell me how to subclass CCSprite on Android? I've added this snippet of code into my CharacterSprite: public static CharacterSprite sprite(String fileName) { return new ...
0
votes
1answer
3k views

How do I animate a spritesheet in cocos2d Android

I'm trying to animate a sprite in a spritesheet, the goal is to make the character walk from left to right. I subclassed CCSprite: CharacterSprite. this is my code: ...
0
votes
1answer
363 views

How useful would it be to know a scripting language when developing an iOS game? [duplicate]

Possible Duplicate: Why do we use scripts in development? I just starting learning iOS game development. I plan to make games using the cocos2d framework. While reading game dev related ...
2
votes
2answers
1k views

Detecting right/left collisions with a bounding box

I'm building a platformer in cocos2d, my first game project. I'm working on movement and collision detection. I'm using a tilemap with a "meta" layer of invisible blocks that are designated ...
0
votes
2answers
2k views

How can I handle a touch event in cocos2d for Android?

How can I handle a touch event in cocos2d for Android? And how to move a sprite using ccTouchesMoved?
1
vote
1answer
584 views

Dynamic bodies with Parallax Scrolling

I have an object that has a dynamic body. Currently, I'm setting it's position to follow the sprite when the parallax layer move. After a certain event, the object suppose to fall to the ground. ...
-2
votes
1answer
2k views

Objective-C to Java conversion for porting iPhone apps to Android?

can anybody help me to convert this objective-c code to android java. - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { if (_mouseJoint != NULL) return; UITouch *myTouch = ...
1
vote
2answers
938 views

Would a box2D sensor fit my needs?

I have a object in my game that when the main character hits it, all I want to do is have the object explode and then notify the character object that a hit has occurred. Would I use a b2Body and ...
3
votes
1answer
679 views

How do you get textures out of a png file

I have 1 png of many different textures. I want to use these textures in my iphone game using cocos2d. I found the program "Zwoptex" where you can combine many textures to one png and create a plist ...
-1
votes
1answer
290 views

Insert object at index, when two objects collide

I have two arrays: one for projectiles, and one for targets. Every target and every projectile has tag, and a tag with color (source code I took from Ray Wanderlich). In my small game, when a ...
1
vote
2answers
760 views

Cocos 2D putting things on the cocos thread or not?

We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause. What is the recommended ...
0
votes
2answers
238 views

Slow motion of a spherical object on an blunt slant obstacle

In cocos2d environment and box2D when an spherical object falls on a blunt slant obstacle, it moves really slowly, that's nauseating, if you have coded to not to have any interaction with world while ...
-1
votes
1answer
291 views

Is it any good to make play game in zoom condition?

I'm developing a game with large obstacle and sprites(in cocos2d+box2d for iPhone), then after zooming out my sprites and layer (by increasing cameraZ), I make my game to play by user, which causes ...
0
votes
1answer
780 views

Help implementing virtual d-pad

Short Version: I am trying to move a player around on a tilemap, keeping it centered on its tile, while smoothly controlling it with SneakyInput virtual Joystick. My movement is jumpy and hard to ...
-2
votes
1answer
474 views

Did first generation Pokemon games use event driven input or poll based input?

Did the first generation Pokemon games for gameboy poll for the d-pad state or was the input state done based on events? I'm currently trying to implement a similar control and I'm interested in ...
4
votes
1answer
1k views

Should I be subclassing CCSprites?

When I am working with cocos2d I can add CCSprites to the layer or 'stage' and manipulate them. Now, to do my ongoing calculations for movement AI and such, things that will always run, should I: ...
2
votes
1answer
1k views

Programmatically set color of Box2D body's sprite or image

In my basic Cocos2D + Box2D iPhone app I have a bunch of circular Box2D bodies. I'd like to change the color of the circles programatically. What's the easiest way to do this? So far I'm just ...
-5
votes
4answers
991 views

Crash when using Cocos2d

Sorry about the poor question title, it's just that this seems to big for a title. So here's the dirt: I am making a game (obviously) and I want the enemies to shoot (not necessarily at the player). ...
6
votes
3answers
1k views

top down game - checking, drawing enemy's line of sight area with obstacles

Examples of what i'm going to need: I'm using cocos2d to draw a CCTMXTiledMap, on those tiles i'll have to draw the LOS cone. How would i test if the player is within that cone, taking obstacles ...
0
votes
1answer
699 views

How do I open the camera in a CCScene node in a Cocos2D application?

I am new to Cocos2D and I can't find the way to open the camera from the library. I want to open the camera in the my game, can any one help me with with this? Thank you in advance.
3
votes
1answer
687 views

Cocos2d+pybox2d vs Cocos2d-Iphone

Myself and two colleagues are working on making our first indie game for PC and, we decided to use Cocos2D + PyBox2D. We decided this based on what we've seen of Cocos2D-iPhone games, but I'm not ...
1
vote
1answer
2k views

Multiplayer game with Cocos2d-Javascript and Node.js

It is possible to make a multiplayer browser based game using cocos2d-javascript + node.js? If so, is there any tutorial about that?
3
votes
1answer
1k views

Best way to prevent UIPanGestureRecognizer from firing when moving sprites in cocos2d

Im using UIPanGestureRecognizer in my cocos2d game to do drag and drop of sprites. I have a row of sprites and when I drag a sprite on top of another one, the sprite underneath it and any other ...
0
votes
1answer
979 views

Interacting with scene from controller/app delegate cocos2d

I'm attempting to make my first cocos2d (for iphone) multiplayer game and having difficulty understanding how to interact with a scene once it is running. The game is a simple turn-based one and so I ...
3
votes
1answer
1k views

How do you create your levels containing curved slopes in Box2d?

I have just started developing games for iPhone in Cocos2d and am currently working on a Box2D prototype. I know this is not an easy start, but I have experience in the AS3 port of the physics engine. ...
5
votes
3answers
5k views

Tracking Multiple Touches using Hash codes in Cocos2d for iPhone

How do you implement a touch hash code and reference it later? I have read about a "hash" code, but I don't understand how to use it. I want to know when two of my Sprites are touched at the same ...
2
votes
1answer
947 views

cocos2d: syncing CCAnimation frames with Box2d Shape manipulations

my cocos2d game currently has a ccsprite attached to a box2d body. during the game i apply different CCAnimations on my sprite, i would like to perform certain manipulations to the box2d body ...
5
votes
2answers
1k views

cocos2d Merging box2d bodies

i'm using cocos2d to build an iphone game. my game currently has two sprites: one for the main character and another for an item i should carry once he gets on him. the main character and the item ...
5
votes
2answers
832 views

On cocos2d, what is better: one monolithic game cycle or many scheduled selectors?

I am building a simple tower defense game, and I have to take a decision between two(or more, feel free to suggest other ways) to do the game cycle. Option 1: Monolithic game cycle: I could have a ...
5
votes
2answers
3k views

How to make animated buttons in a menu with Cocos2d?

How do I make animated menus with cocos2d, I just want to animate the buttons and not the entire scene. Effects I look for is flipping buttons (like the back of the button is the next menu), buttons ...
1
vote
2answers
413 views

Connect 4 Iphone game

I'm new to game development and development in general, I want to make a Connect 4 game. I have made a few simple game tutorials and I decided I wanted to make my own game now. I figured a connect 4 ...
4
votes
1answer
4k views

How to create endless scrolling landscape using coco2d's CCParallaxNode

I created a horizontally scrolling landscape using CCParallaxNode. However it does not seem to support endless scrolling in one direction. As soon as the first image "ends" the background shines ...
8
votes
4answers
4k views

Cocos2D collision detection against a random shape

I would like to brainstorm a few ways of handling how to detect a collision between a sprite and a user generated shape of some sort. For example. There are 3 objects on the screen. The user takes ...