cocos2d is a free open-source framework for building 2D games, demos, and other graphical/interactive applications.
0
votes
2answers
31 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 ...
1
vote
0answers
47 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: ...
0
votes
1answer
30 views
Animate masked image [closed]
This is mask shader code for use with cocos2d-iphone 2.x
https://github.com/tonybeltramelli/Cocos2D-Mask-Shader
It's good for static images, but I need to move/animate the masked image.
What I want ...
1
vote
0answers
22 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 ...
0
votes
0answers
17 views
cocos2d playbackground music stops drawing sprites
I am using cocos2d v2 and experiencing a very strange behaviour.
I have a couple of audio tracks which are supposed to be played as background music one after another. But I noticed when these tracks ...
3
votes
2answers
71 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
43 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
47 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
93 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
32 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
45 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
0answers
58 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
1answer
27 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
23 views
UITapGestureRecognizer fast tapping not working
I have initialized UITapGesture as follows:
tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
tapGestureRecognizer.numberOfTapsRequired = ...
2
votes
1answer
52 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
53 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
125 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
31 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
28 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
39 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
47 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
87 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
38 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 ...
0
votes
1answer
49 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
29 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
131 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
146 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
153 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
0answers
37 views
NSNotificationCenter or array of delegates to broadcast information?
I'm writing a buff class that will have a delegate to the caster and an array of delegates that call the affected objects (can be tiles or sprites).
After some research on how to create an ...
0
votes
2answers
112 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
52 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
0answers
54 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
32 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
56 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
84 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
172 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
23 views
Auditioning audio in real-time on iOS game
I've heard of fmod which is an audio engine came with fmod studio to adjust sounds in real-time while testing a game. But fmod requires a huge license fee so I'm looking for free alternative to fmod ...
0
votes
1answer
117 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 = ...
2
votes
1answer
92 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
49 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
58 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
63 views
Texture / CCSprite Loading and Unloading
Here I want to know how textures are loaded and unloaded in the game by cocos2d/cocos2d-x?
Basically I am a developer of AndEngine and started working with cocos2d-x. In AndEngine, we have ...
5
votes
1answer
236 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
72 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 ...
0
votes
0answers
60 views
Cocos2d/Box2d Component based entity system
Recently I've read somewhere that it is not a good idea to inherit from CCSprite class when making your game objects. In my CBES each Game Object has :
-PhysicsComponent(responsible for updating ...
1
vote
0answers
134 views
Cocos2d-xna memory management for WP8
I recently upgraded to VS2012 and try my in dev game out on the new WP8 emulators but was dismayed to find out the emulator now crashes and throws an out of memory exception during my sprite loading ...
0
votes
0answers
42 views
Image is displaying in inverse order cocos2d
I am drawing image in cocos2d using opengl call but image is displaying inverse order, i faced same problem previously that time i used to change value of CC_TEXTURE_NPOT_SUPPORT to 1 from 0 in ...
1
vote
1answer
105 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
199 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 = ...
0
votes
0answers
26 views
How to implement enemies similar to Monster shooter game in cocos2d? [duplicate]
We are recently creating game with cocos2d API. This game is similar to Monster shooter game for iOS and android. Following is the link to above game : http://game-lion.net/monstershooter/
In this ...