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

learn more… | top users | synonyms

1
vote
0answers
118 views

Using fully cropped sprites with TexturePacker and Cocos2d

When using texturepacker, you can set your trim-mode to crop. This is nice, because when a sprite loads in cocos2d your bounding box will only be the visible area of your sprite - which is useful for ...
1
vote
1answer
224 views

Sprite sheet resolutions and Tile Maps

I am making a game using Cocos2d-x and want to support multiple mobile phone resolutions and sizes. Right now I have made my game sprite sheets set on a resolution of iPad Retina's resolution of ...
3
votes
2answers
165 views

Box2d : How to apply a force to keep swinging from left to right?

i'm losing myself in this... Situation: Working on a game in cocos2d with box2d and I have a ropejoint between one fixed body and one dynamic body. When I drop the dynamic body is swings from left ...
1
vote
1answer
204 views

Converting data file of Sprite Atlas from JSON to Cocos 2D

I have an existing Sprite Atlas with its data file in JSON format. How do I convert it for use with Cocos 2D and other frameworks ? I tried poking around in Texture Packer which supports publishing ...
0
votes
1answer
156 views

How to get position of CCSprite added to CCParallaxNode?

I have a CCparallaxNodeExtras that scrolls infinite (following the space game tutorial). I added as a child a CCSprite made of other CCSprite, like this: _backgroundNode = ...
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 ...
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
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. ...
12
votes
5answers
921 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 ...
0
votes
0answers
132 views

Browser resize and orientation change in cocos2d html5

I'm currently starting a new project with cocos2d-html5. But I already stumbled upon quite a problem. If I load my game in a mobile browser and change the device orientation e.g. from portrait to ...
1
vote
0answers
177 views

Image Texture Tracing Algorithm - Cocos2D Box2D

Context: I am working on a 2D Destructible Terrain engine for Cocos2D with Box2D. All images, when a level loads, have their border's traced and cached for the purposes of forming Box2D b2EdgeShape ...
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: ...
0
votes
1answer
155 views

How to Initilize CCPoint Array from String?

I've got string like this: {{0,168},{20,20}}, here indicates two points. I want to get them out to initialize my CCPoint. Do you guys know how to convert this?
1
vote
0answers
83 views

Using CAShaperLayer within COCOS2d

My class X is interited from CCLayer. @interface X : CCLayer Then in X, I added an instance variable of type CAShapeLayer. CAShapeLayer *_Circle I drew the Circle using UIBezierPath. Now if I try ...
0
votes
1answer
82 views

Cocos2D SpriteBatchNode vrs. SpriteFrameCacheā€¦ I do not see any performance difference

I have tried using both ways... adding the .png file on the cache with SpriteFrameCache.. adding .plist with spritebatchnode adding the correspoding .png file, I didnt see any performance ...
1
vote
1answer
99 views

Cocos2D: Box2D body that is movable by one type of object but not another

I'm in the process of creating a simple platform game using Cocos2D 2.0 and Box2D. I'm trying to create a kind of crate object that cannot be moved by the player, but that can be moved by an elephant ...
1
vote
1answer
102 views

Why are my sprite sheet's frames not visible in Cocos Builder?

I have created a sprite sheet with zwoptex. Then I just dragged the .plist and .png files to my Cocos Builder project. After this I wanted to take a sprite frame and set it to a sprite: But the ...
1
vote
1answer
122 views

Determining explosion radius damage - Circle to Rectangle 2D

One of the Cocos2D games I am working on has circular explosion effects. These explosion effects need to deal a percentage of their set maximum damage to all game characters (represented by ...
0
votes
2answers
91 views

Cocos2d sprite's parent not reflecting true scale value

I am encountering issues with determining a CCSprite's parent node's scale value. In my game I have a class that extends CCLayer and scales itself based on game triggers. Certain child sprites of ...
1
vote
1answer
855 views

Setting Higher Z-Index for Sprite

For my game, I have to set highest z index for my sprite. At present, I wrote following code but didn't work for me. Sprite houseSprite = new Sprite(pX, pY, ...
6
votes
1answer
215 views

Best way to determine surface normal for a group of pixels?

One of my current endeavors is creating a 2D destructible terrain engine for iOS Cocos2D (See https://github.com/crebstar/PWNDestructibleTerrain ). It is in an infant stages no doubt, but I have made ...
0
votes
2answers
154 views

Serious gameplay issue by spawning enemies according to elapsed time

EDIT: I have changed the title as I think that this is a general gamedevelopment question but, on a technical note, I am using Cocos2d v2.0 Some time ago I had asked a question on which was the most ...
3
votes
4answers
8k views

What are the pros and cons of GameSalad versus Cocos2D?

I am currently using the Cocos2D framework for creating my game but I just happened to come across GameSalad and was amazed by this video. GameSalad claims to allow you to create games without ...
0
votes
0answers
151 views

how to use TextFieldTTF in cocos2d html 5

i currently have this var textField = cc.TextFieldTTF.create("", "arial", 32); this.addChild(textField); but for some reasin it's not working please help thanks
0
votes
0answers
52 views

how to set resolution in cocos2d html5 game

how can i change or init game with specific resolution is there something like setResolution(width,height) available ? please hellp thanks in advance
0
votes
1answer
659 views

Android cocos2d getting a sprite to continuously move to a dynamic position

I tried using the MoveTo method in cocos2d to get a sprite to continuously follow my player sprite: CCMoveTo actionMove = CCMoveTo.action(actualDuration, player.getPosition()); CCSequence actions = ...
0
votes
0answers
104 views

How to get sprites react to touches in cocos2d-android

i have 1 gun when tap on any area on the screen bullets fires out, but according to my requirement there are 3 guns(sprites) when touched on any of the sprites bullets must fire up, when googled i ...
0
votes
2answers
123 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 ...
0
votes
0answers
127 views

Android cocos2d getting collision detection to work only on some frames of animation

I have an animated bomb sprite in my game and use CGRect for collision detection: for (CCSprite bomb : _bombs) { CGRect bombRect = CGRect.make(bomb.getPosition().x - (scaleFactor * ...
0
votes
1answer
419 views

Android cocos2d removing a sprite after animation

I have an object going across the screen with an animation using the following code: CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames("ninjastar.plist"); CCSpriteSheet projectileSheet = ...
3
votes
1answer
138 views

Snapping of irregular images in iphone puzzle app

I am working on puzzle app in which i need to snap irregular shapes as they come in contact of one another as i am new to game development so i dont have any idea how to achieve this functionality in ...
0
votes
0answers
72 views

Best strategy to group multiple CCPhysicsSprite into a single game character. [Cocos2d + Chipmunk]

It is my first game using Cocos2D with Chipmunk and I have a bit of a novice question. I am using the CCPhysicsSprite to create different parts of a character. I would like to be able to group these ...
0
votes
1answer
109 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 ...
0
votes
0answers
105 views

Catching an object from sky in Cocos2d and Box2d world

My world has a gravity of -9.8 and there are KDynamicBodyType bodies falling from the sky. At the bottom there is a PhysicsSprite with KinematicBodyType. I want the PhysicsSprite to be able to catch ...
5
votes
1answer
348 views

How to flip card by a corner?

After searching "flip card" in google and our stackexchange site, there is no result and I have no ideas about how to flip a card by a corner. I am developing a ios card game with cocos2d, in this ...
1
vote
1answer
196 views

Can I switch scenes by swipe gesture or dragļ¼Ÿ

Can I switch scenes by swipe gesture or drag? In my game, there are three main scenes, each of them has several layers which have some UI elements, these elements have some tap gesture. I already ...
1
vote
0answers
370 views

cocos2d-xna CCScale9Sprite usage

I'm trying to get a CCControlButton to render on my game. Using a basic CCScale9Sprite as the button's background works using the following: var myScale9Sprite = ...
-1
votes
2answers
792 views

Semi Transparent Background in Scene [closed]

In my game I want to create game over scene which is semi transparent so game scene become partially visible. Game over scene contain several button that are not transparent but I need only ...
0
votes
1answer
355 views

Rotate Box Sprite With Circle Body

I want to rotate my rectangular sprite with circle body. The problem is the body doest not attached to the centre of the sprite. This was the default behaviour of the body and sprite. But I want that ...
1
vote
2answers
2k views

Repeat image on a fixed background, Cocos2D?

I'm quite new to Cocos2d, does anyone know how to create a background that would be one fixed screen (no scrolling), with a small image just repeated to the whole size of the screen - depending on ...
2
votes
4answers
706 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 ...
0
votes
0answers
109 views

cocos2d - exclude GUI layer transformation

I have a game layer that should be pannable and pinchable and a GUI layer as an overlay that's excluded from the transformations. I added the pinch and pan gesture recognizer to the view and set the ...
1
vote
1answer
239 views

Debug Render In Cocos2d Android

I want to implement debug render for cocos2d android.So I can view how bodies are created. Right now I use gdx.jar file for box2d and load that jar file following way. static { ...
0
votes
0answers
457 views

Cocos2d Vertical Doodle-Jump Like Scrolling [duplicate]

Good afternoon, For the past few days I've been making a game very similar to DoodleJump in the sense that it involves a main character, things to jump on, certain powerups and some monsters. I've ...
1
vote
1answer
189 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
293 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
votes
1answer
193 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
545 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
0answers
291 views

How to move a sprite on a slope in chipmunk Spacemanager [duplicate]

Possible Duplicate: How to move the object(tanker ) on slope image in chipmunk Spacemanager I have used one polygon shape image (terrain) in my game. It's just like a mountain, and now I ...