Share Your Experience: Take the 2024 Developer Survey

Questions tagged [cocos2d]

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

275 questions
Filter by
Sorted by
Tagged with
78 views

Box2d: High screen resolution / frequency causes high friction?

I'm using Cocos Creator with (built-in) box2d for physics. Recently our game behaves weirdly on our new device Galaxy S20 Ultra 5G - which has screen size = 1440 x 3200 - frequency = 120Hz. After stop ...
• 151
223 views

How to take input from featured mobile phone in cocos creator?

I am beginner to cocos creator and I came to know cocos has Keyboard,DeviceMotion and Mouse input event but I want to know how to take input from featured mobile phone having number pad? Will it be ...
61 views

What is the right way to implement a loading screen in cocos2d-js?

We have two scenes that are loaded with heavy computation; a map screen and a puzzle screen. When we change the scene from A to B, the app gets stuck on scene A for a while before it renders scene B. ...
1 vote
359 views

Given the size of far and near plane, find other parameters of a frustum

I am trying to find the correct parameters for setting up my perspective camera. But I don't know the mathematics involved in that. Can somebody point me to the right direction? My near plane should ...
86 views

Adjusting arms of character while moving

I'm working on a test game in Cocos2d for Python (code is a little dirty). I'm trying to run and shoot at the same time without having my character's (running) legs go back to the beginning position ...
• 125
1 vote
60 views

Help understanding the parkour tutorial in Cocos2d

I was practicing the parkour tutorial for chapter 7, but I failed to understand why we should move the same delta movement of this.gameLayer, which contains the ...
101 views

Make something move when no key is pressed

I am new to game programming and I have a question about my game logic. In my game there is a balloon that is supposed to collect some stars. the balloon moves with the keyboard. When the balloon ...
• 105
1k views

How do I publish a game for the web, using Cocos Creator?

I am new to Cocos Creator and web game programming. I have build a simple game for the web, but I don't know how can I publish it. In the documentation files, it says: You only need to .zip scripts ...
• 105
164 views

Cocosdenshion and Android not working

I'm trying to play sounds and music with cocos2d. When I run on iPhone and .caf files the audio is perfect, but on Android it is not playing the background music and is only playing 2 sounds of 10 ...
86 views

Cocos2dx launcher - how do I set a newer engine version?

Why doesn't Cocos(V3.10) detect my newer engine version (3.14) which I downloaded and placed into the engine folder? ( I mean the launcher, the all-in-one version where you can create your project ...
1 vote
44 views

Socket.io emit textfield

Hello everyone I learned how to emit from socket.io website guides but I was wondering how does the chat example receive its input? For example in my cocos2dx app how do I pass a text field over to ...
• 31
4k views

Minimum hardware requirements for developing for iOS and Android with Unity, Cocos2d-x and GameSalad on a Mac

I intend to create iOS and Android games. My main priority is to create 2D games. The software that I’m planing to use are Unity, Cocos2d-x and GameSalad. I am a bit interest in the Mac Mini, ...
483 views

Cocos2dx - Create the friction of the ground

I'm writing a game, it a pool game. I've read about cocos2dx + physics library, however the document is really poor to understand. Material has 3 attributes (http://www.cocos2d-x.org/wiki/Physics#) : ...
• 243
285 views

Batch z-ordering problem in Cocos2d (Python)

I have a weird problem with my hexmap drawing code. My code uses "squished" hexagons to achieve a pseudo-isometric view. Because of that, the order of drawing them on screen matters a lot. ...
444 views

Cocos2d JS - Getting vector reflection

I'm working on a small Breakout clone using Cocos2D-JS, without the use of a physics engine. One of the things that baffles me was how the ball bounces. My friend came up with this: inputVector - ...
• 183
342 views

How to detect collision during a cocos2d::Action

I spent a day trying to hack my own Action class, but given the hurdles I've hit trying to do so, I'm hoping there's some way to work around my problem while still using the built-in (and admittedly ...
• 11
377 views

How to set building in sequence like COC game using tiles map in cocos2d-x V3.9?

i am developing game in cocos2d-x V3.9. i want to create base like COC game. set all buildings in sequence and it can't be overlap with each others. i want also make boundary for develop city view. ...
1 vote
167 views

Black border all around simulation / viewport in iOS using Xamarin + CocosSharp

I'm just getting started with Xamarin and CocosSharp so it's possible I've missed something basic here.. but whatever it is I can't seem to figure it out. I'm trying to get my app/game to be ...
• 253
219 views

android - How Do I Replace A Scene in Cocos2D

I am using Cocos2D for Android: I have two scenes MainScene and LogoScene. I want to show a Splash screen on ...
• 76
1 vote
190 views

Cocos2d How do I transition to a scene

So I have mainScene and I have LogoScene, I am wondering If i can make logoscene show a logo, then transition to mainscene. here is what i have ...
• 76
1 vote
1k views

Opengles 2.0, Replace the black region in the image to make it transparent

I have two textures, Source image A and Overlay B, B is drawed on top of A, I want to replace the black color in B, then make the region of A visible, what should I do? This is my shader language: <...
89 views

Cocos2dx Windows Phone 8.1: Seperate Characters in RTL Label

I use below code to show a text : auto label = Label::createWithSystemFont("سلام و خداحافظ", "BTitrBold", 24); ( RTL text like Persian, Arabic and Hebrew) This ...
• 940
122 views

setVelocity allows body to pass through bodies

In my game, I'm using cocos2d-x and I wanted to have an object that changes direction immediately, so I used setVelocity() on the physics body to do that. However, ...
• 223
1 vote
6k views

Java - Adjusting the speed of an object during movement

I am trying to get an object to move (on java canvas) in the same angle but at different speed within the X and Y axis. Below you can see how i have implemented the movement of the object. ...
783 views

Unity equivalent to cocos2D (and Sprite Kit) Actions?

Does Unity have an equivalent to the Actions feature/functionality of cocos2D and Sprite Kit; if so, what is it? cocos2D Actions: http://python.cocos2d.org/doc/programming_guide/actions.html http://...
• 183
849 views

How do mobile games create simple UI components? [closed]

How are simple UI inputs typically handled in 2D mobile games? For example, text input boxes and keyboards. It seems that many game engines do always have simple UI components. There are obvious ...
• 129
623 views

Opengles 2.0 multi Textures fade out one by one

I have multi textures, A was drawed on top of B, B was on top of C ...., ( like Picture 1) .I want to fade out A first, then B will appear and fade out either... But when A fade out, background color ...
1k views

Rotate sprite direction Cocos2d

I want that my sprite go always forward, and you can only control his direction moving right and left (on 360 degrees). I don't know why, but the movement it's senseless. The constants to move and ...
1 vote
306 views

Error OpenGL null Cocos-2D/Visual Studio [closed]

When I try to execute a game code fully functional on Visual Studio 2013, using Cocos-2D (3.8.1) library this error jumps on screen. (I'm working on a laptop) OpenGL 1.5 or higher is required (your ...
1 vote
117 views

Turn Based Game Match Data in iOS

Hi I’m working on turn based game development using turn based API from Apple’s GameKit framework. My game is 2 player strategy game. Currently I’m facing the issue match data update on game play ...
• 121
192 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 ...
• 189
1 vote
434 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: ...
• 11
155 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 ...
1 vote
969 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 ...
• 121
1 vote
1k 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 ...
816 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 ...
• 163
268 views

Change sprite position

I have Sprite and i want change my Sprite position when score == 2 ...
1 vote
277 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 ...
• 113
2k views

How Use loop's in cocos2d-x

I've for loop which work well on Windows ...
955 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-...
• 940
115 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 ...
330 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 ...
• 101
1 vote
325 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 ...
• 111
130 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 ...
• 111
1 vote
430 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 ...
• 299
4k 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 ...
• 299
1k 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: ...
• 940
975 views

cocos2dx: RunningScene != Scene You just Replace

I have this code for cocos2d-x 3.x: ...
• 940
257 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 ...
• 141