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

learn more… | top users | synonyms

1
vote
1answer
235 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
2answers
157 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
vote
1answer
125 views

How can I use CCClippingNode to trim the top and bottom from a CCTableView?

I'm fairly new to Cocos2d and struggling with sizing a CCTableView. How can its height be controlled so that I have space at the top and the bottom? I'm trying to visually wrap the top and bottom of ...
3
votes
3answers
399 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 ...
0
votes
1answer
227 views

How to use Cocos2dJS to connect to a Socket.IO server?

How can I connect to a nodejs socket.io server from a cocos2djs game? I've google all the way to no avail. I tried this but it does not work: socket = io.connect('http://192.168.254.102:7714'); if ( ...
1
vote
1answer
266 views

Cocos2d/Cocos2d-x Attaching an arrow (sprite) to another body sprite (person)

I am trying to set up a simple bow and arrow game. When the arrow hits the enemy body, the arrow's body is deleted and the arrow sprite continues to update, keeping the position correct in relation to ...
0
votes
1answer
173 views

Error running an Action in Cocos2d-x

In my game I have a "rocket" type and I want to run a sequence of actions on it. At first it must run an explosion animation and then remove itself from the game. For this I used the following code, ...
2
votes
1answer
399 views

Why AnchorPoint doesn't affect `CCLayer` Positioning?

I think there is a difference between CCLayer and CCNode behavior when I change their AnchorPoint. I will describe what I mean and please somebody explain it ? Scenario: I start with CCNode CCNode ...
2
votes
2answers
250 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 ...
3
votes
1answer
140 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 ...
0
votes
0answers
24 views

Cocos framework gives large Android builds than cocos2d-x

This question is regarding Project Architecture and workflow. I have an installation of cocos2d-x and Cocos Studio with Cocos Framework ( version 3.6). I carried out different build tests with hello ...
0
votes
1answer
122 views

Scrolling effect after touch

i'm making map for a game and need to make scrolling of map, so the main thing what i need is to calculate speed and move layer after player remove finger from screen. I make it my own, but i think ...
1
vote
1answer
103 views

cocos2d-js displays only one type of tile from a tmx file

I am using Tiled to produce a tmx which I use in my code using cocos2d-js. The problem is that when I run it on the browser, a wrong tile gets displayed, the first one of the image (0,0) and repeats ...
1
vote
1answer
127 views

Right-To-Left Text Direction in Cocos2dx

I want to use Persian/Arabic text beside English in whether Label or ui::Text. Persian is a Right-to-Left and English is a Left-to-Right language and so I have problem to combine them in one string. ...
4
votes
2answers
3k 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 ...
1
vote
1answer
1k views

How to pause and unpause the Particular action of a sprite?

My game has a sprite representing a character. When the character picks up an item, the sprite should stop moving for a period of time. I use CCbezier to make the sprite move, like this: ...
1
vote
2answers
117 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 ...
0
votes
1answer
195 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 ...
1
vote
1answer
32 views

How to move sprite mimicking mouse/touch position on some part of the screen?

I am having a difficulty and I am been doing it wrong, I think. I want to move sprite relatively to touch. Just like when you are playing space shooter like 1943. I just learning some math and try to ...
2
votes
1answer
446 views

Blending transition in cocos2d

In my cocos2d-iphone game, I have 2 backgrounds (CCnodes), each containing a quite complex hierarchy of sprites. I would like to make a smooth transition between them: Initially, only the first ...
0
votes
0answers
108 views

Using Cocos2dx with Android Studio

Has anyone got Android Studio to work with Android Studio? I can get the generated project to work with proj.android, and add the NDK path to local.properties but I can't get it to rebuild after I ...
-1
votes
1answer
34 views

cocos2d-android collision map

How collision map? I have call: // Get TMX Map and associated layers/groups _map = CCTMXTiledMap.tiledMap("mapdemo.tmx"); _background = _map.layerNamed("Background"); _objects = ...
1
vote
0answers
14 views

Best way to transition between multiple Cocostudio defined scenes

I'm designing a game that has to switch between multiple game scenes. Each scene has been created in cocostudio and is imported into the code as a json file as: var obj = ccs.load(res.Symbols_json); ...
9
votes
4answers
4k views

In Cocos2D, how do I check for collisions against an arbitrary user-drawn shape?

I want 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 their finger and draws an abnormal shape around 2 ...
0
votes
1answer
78 views

Transition from UIView to CCScene in Cocos2D

I've surfed the internet for quite some time but haven't come to find an answer. Any help would be greatly appreciated. I am trying to perform a transition from a UIView to a CCScene So i have a class ...
0
votes
1answer
283 views

cocos2dx: RunningScene != Scene You just Replace

I have this code for cocos2d-x 3.x: void MainMenu::StartGame(cocos2d::Ref* pSender) { auto director = Director::getInstance(); auto newScene = Scene::create(); ...
0
votes
1answer
184 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. ...
2
votes
2answers
143 views

Cocos2d v3.4 Templates

How to create cocos2d v3.4 without using Cocos2D-SpriteBuilder? I installed Cocos2D-SpriteBuilder as they recommended in cocos2d blog: http://cocos2d.spritebuilder.com/get-started But I need to ...
0
votes
2answers
359 views

Cocos2dx - Physics - Abort() When Changing Dynamic PhysicBody to Static?

I just learned cocos2dx v3.3 integrated chipmunk physics engine. Here ,as you see, I create a simple circle with physic as: auto sprite = Sprite::create("circle.png"); auto body = ...
0
votes
0answers
80 views

how to build cocos2d-JS game as a native android app?

I have a cocos2d-JS game which runs in HTML5. How to I build it for android? The part I don't understand is how link cocos2d-JS to cocos2d-x. I know there's JavaScript bindings, but I can't find any ...
0
votes
0answers
65 views

Cocos2dx How to show different parts of a scene in a split screen

I come from an SFML background and you could show different parts of a scene in split screens by manipulating sf::View. Is there any way to do it with Cocos2dx? I plan to make a split screen game but ...
1
vote
2answers
114 views

How to prevent fish eye effect when using CCOrbitCamera in Cocos2D?

Note: I'm using CocosSharp, a Xamarin C# version but the question is valid for all Cocos2D versions I presume. I'm also fine with answers in any Cocos2D dialect (there is no tag yet for CocosSharp ...
-1
votes
2answers
73 views

Change sprite position

I have Sprite and i want change my Sprite position when score == 2 score = 0; auto bird = Sprite::create("bird.png"); bird->setPosition(Point(-visibleSize.width, ...
0
votes
0answers
78 views

Show emoji colors in CCLabelTTF in Cocos2D v2.0

Is there a way to show the colors of emoji characters in a CCLabelTTF? As it stands, all my emojis appear monotoned in the color set by the CCLabelTTF. If not, is there an alternative CCLabel I should ...
1
vote
1answer
86 views

How do I calculate the path of something in orbit around one or more bodies?

I need to figure out how to calculate the orbit of an object around one or more bodies for a game that I am making (built on Cocos2D-Swift). The game is in two dimensions, so it's a two-dimensional ...
0
votes
3answers
303 views

How Use loop's in cocos2d-x

I've for loop which work well on Windows double speed = 35; for(int i=0; i<60 ;i++){ speed += 0.3; Sleep (1000); // sleep 1000 mili seonds } But it responds an error ...
0
votes
0answers
128 views

Cocos2d js database connection from javascript

I have been considering to write a game in cocos2d js, that I wanted to be a turn based multiplayer game. I can't seem to figure out if it is possible with cocos2d js newest version to just add the ...
0
votes
1answer
59 views

differences betwen game resolution in a different display resolution

my game is not supported on the other devices with a different resolutions. for example may character is 140w X 55h pixels which is ok on a 4 inch display but it goes wide when i tested my game on a ...
0
votes
0answers
99 views

Cocos2d v3 - addChild method make performance problems

i have currently a performance problem with the addChild method in cocos2d version 3.3. My scenario is currently that i have about ten CCNode which holds a bundle of other CCNode (about 500), i called ...
0
votes
1answer
68 views

Cocos Code IDE unable to find python

I am trying to create a new JavaScript project on Cocos Code IDE but every time it immediately give me the error message: Unable to find python. Please, click the setting button to set the python ...
1
vote
1answer
423 views

How can I run two CCActions in parallel and another one afterwards with Cocos2D?

With Cocos2D I can run two actions in parallel by simply using runAction and I can use a CCSequence two run several actions after each other. However what I could not find is: Run two actions ...
3
votes
2answers
5k 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 ...
0
votes
1answer
3k 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
0answers
59 views

Using Tile Maps with cocos2d - how do I handle a large amount of images?

I am building a game where the users (players) can build their own town. There they can build houses, add furniture to the houses etc etc. Basically similar to The Sims. I am using the Tiled Map ...
0
votes
1answer
154 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 ...
5
votes
1answer
464 views
0
votes
1answer
244 views

Need ideas on how to give my levels structure [closed]

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. ...
0
votes
0answers
101 views

Cocos2D texture distorted on android devices

The textuers are distorted (randomly) on some devices (randomly again). The game is working on IOS without problem. Checked adb logcat and I got some errors. Searched the errors but not found any ...
2
votes
2answers
170 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 ...
0
votes
0answers
78 views

iOS + cocos2d: how to account for sprite's position for the different device dimensions in an universal app? [duplicate]

All the questions I've seen regarding iOS universal apps (with or without cocos2d) deal with the "how to add graphics to a universal app". My question is, how does the code need to be written to ...