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

learn more… | top users | synonyms

0
votes
0answers
138 views

Game issue occur in 4.3 Android Version?

CCScene doesn't show anything on 4.3 version? I am working on a project in which I'm using the cocos2d_android.jar and on the 4.3 version the screen goes blank and music/ccTouches/others things ...
0
votes
1answer
281 views

cocos2d collision detection between two ccsprites i am using boundingBox but this method is not working [closed]

I am making a cocos2d side scroller and I am currently putting collision detection in. I have an enemy that shoots at the player. I want to have the bullets disappear when they hit the player. The ...
0
votes
2answers
90 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 ...
3
votes
1answer
983 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: ...
1
vote
0answers
150 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 ...
3
votes
2answers
207 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
264 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
271 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
144 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
130 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
418 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
1answer
156 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. ...
1
vote
0answers
111 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
81 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
222 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
205 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
1answer
152 views

cocos2d ccTouchEnded: Removing a Touch

These are my ccTouch__ methods. Note that I am using the singular form of the functions (ie. ccTouchBegan v. ccTouchesBegan (don't know if that has anything to do with it, but it can't hurt to point ...
1
vote
0answers
130 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
140 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
124 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
137 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 ...
1
vote
1answer
115 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
votes
1answer
397 views

How to create a rectangle shape in cocos2d-android

I am new to cocos2d-android. I want to create a rectangle shape in the scene .for that i am trying to do something like this. CGRect rect = CGRect.make(x,y,70,70); But it was not displaying the ...
0
votes
2answers
160 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
1k 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
235 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 ...
1
vote
1answer
250 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 ...
0
votes
2answers
169 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 ...
1
vote
1answer
168 views

Cocos-2D asteroids style movement (iOS)

So I have a CCSprite subclass, well call this Spaceship. Spaceship needs to move on a loop, until I say othersise by calling a method. The method should look something like - ...
0
votes
1answer
916 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
1answer
957 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
154 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 ...
5
votes
1answer
386 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 ...
0
votes
1answer
111 views

Exporting spritesheet for Cocos2d

I would like to know how people usually save the animations in order to load them easily in Cocos2d with as few hard-code as possible. E.G. The solution I thought of is to have one plist file ...
2
votes
1answer
375 views

Why am I seeing unbounded memory usage in my WP8 game?

I recently upgraded to VS2012 and tried my game out on the new WP8 emulators. I was dismayed to find out the emulator now crashes and throws an out of memory exception during my sprite loading ...
1
vote
1answer
277 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
451 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
1k 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
443 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 ...
2
votes
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 ...
0
votes
0answers
114 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
292 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
574 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
222 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
370 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
949 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
214 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
666 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 ...
1
vote
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
432 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 ...