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

learn more… | top users | synonyms

0
votes
2answers
76 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
2k views

Rendering shadow sprites in cocos2d-x

I am writing a 2D game with cocos2d-x. I want to put a "shadow" sprite on a background sprite using the equation: MAX(0, Cd * 1 - Cs * S) where Cd is the destination color (that is, a background ...
2
votes
1answer
541 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
1answer
38 views

Finding diagonal objects of an object in 3d space

Using Unity3d, I have a array which is having 8 GameObjects in grid and one object (which is already known) is in center like this where K is already known object. All objects are equidistant from ...
1
vote
1answer
122 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 - ...
1
vote
1answer
301 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 ...
0
votes
1answer
80 views

Extracting/locating sprites from PNG sprite sheet and PLIST

Good day! Asked me to reskin a certain game. Now he only sent me the whole sprite PNG and PLIST files of the sprites. He instructed me to rename each sprite with the same name corresponding to each ...
0
votes
1answer
76 views

Dynamic Hills like Contre Jour in Cocos2d

I'm interested in maps/environments which are flexible and change at runtime, such as those in Contre Jour. I have looked for a long time to find out how to make this effect, but I couldn't find an ...
0
votes
1answer
80 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. ...
0
votes
1answer
228 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
1answer
99 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 ...
-1
votes
1answer
89 views

Collision function calls before colliding

My Box2D contact listener class is calling post solve and beginning the contact function before colliding? This is causing my object to bounce back before hitting the ground. What could be causing ...
-1
votes
1answer
217 views

Need ideas on how to give my levels structure

I am making an iOS game for a project at school. It is going to be a tiny bit like Fruit Ninja, as in it will have different things on the screen, and when you hit them, they die, and you get points. ...
-1
votes
1answer
493 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. ...
-3
votes
1answer
177 views

Simple question about a cocos2d based game template

I am learning a cocos2d based Game template tutorial from here and now I am at this point of the tutorial. My question is, how can i run 30 different scenes in 30 different levels of 5 chapter? Now I ...
-4
votes
1answer
252 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) { ...
3
votes
0answers
237 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
112 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 ...
2
votes
0answers
285 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
0answers
35 views

Building a guided tracing scene

I'm trying to figure out an approach to creating a cocos2d scene that would help kiddos learn to draw letters of the alphabet. Right now I am just using Apple’s PaintView demo code and applying an ...
1
vote
0answers
292 views

Cocos2d-x CCFollow Zooming issue

Hi I am currently building a cocos2d-x game which incorporates pinch zoom using CCLayerPanZoom class which can be found here The problem is basically when using CCFollow and zooming and out, it ...
1
vote
0answers
116 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
0answers
174 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
81 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 ...
1
vote
0answers
366 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
vote
0answers
225 views

Cocos2D and iPhone's accelerometer

good afternoon! Today I've started to develop a game and I got a trouble. So, first at all I would like to say that I have no experience developing games... So, I've a CCSprite in the layer and I ...
1
vote
0answers
505 views

How to Store the game score in android cocos2d

I calculates the score in game project using android cocos2d, in that game after finishing the first level it goes to the next level, so i want to store that first level score and also add next level ...
0
votes
0answers
15 views

Determine speed of sprite

I'm trying to calculate the speed of my sprites in Cocos2d but I'm having some difficulties. I'm not sure which units of time/speed cocos2d uses. My background sprite moves 2 positions to left each ...
0
votes
0answers
8 views

How to use CCGrid3DActions in Cocos2d-XNA?

For example, I want to add a CCLiquid action to my player shield in my game. In my Player class: public Player() { // code snippet when creating new Player CCSprite shield = new ...
0
votes
0answers
25 views

Mobile: Physics and movement actions

I've been using spritekit for a while for a few small games. One thing I've noticed is that spritekit is the first game framework I've used that allows me to apply move actions to physics bodies. ...
0
votes
0answers
14 views

Get Facebook Picture in Cocos2d-iphone V3

I'm trying to get the profile picture from Facebook, but I'm getting the following error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage ...
0
votes
0answers
31 views

Do SpriteBuilder's Smart Sprite Sheet need to be loaded to memory?

When I create an Smart Sprite Sheet Folder using SpriteBuilder and publish it, must I load that SpriteSheet into memory "FrameCache" with code or does SpriteBuilder do this automatically (so I just ...
0
votes
0answers
96 views

Cocos2D - Simulating infinite scrolling

I have a BIG problem!! I want to make something like old space shooter games like “Asteroids”, where the ship, when going out of the screen, is reappearing at the other side. For example, when the ...
0
votes
0answers
302 views

Cocos2dx- Draw primitives(polygons) on Update

In my game I'm trying to draw polygons on on each step i.e. update method. I call draw() method to draw new polygon with dynamic vertices. Following is my code: void HelloWorld::draw () { ...
0
votes
0answers
110 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
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. ...
0
votes
0answers
125 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 ...
0
votes
0answers
149 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
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
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
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
0answers
100 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 ...
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 ...
0
votes
0answers
234 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 ...