Questions tagged [cocos2d-x]
cocos2d-x is a cross plaform port of cocos2d-iphone using C++. It supports iOS, Mac, Android, Samsung Bada, BlackBerry Tablet OS, Windows and Linux. It has built-in bindings for Lua and Javascript.
208 questions
0
votes
0
answers
33
views
Object::retain crash in Sprite::setFrameFrame(std::string_view) in Axmol
There are multiple crashes where the spriteFrameCache is unable to find a spriteFrame.
This only happens when an Android app ...
1
vote
1
answer
92
views
Player stays grounded when jumping at the side of a two tile high wall
I am currently developing a simple Super Mario Bros. like platformer in Cocos2d-x v2. I am now at the step of doing wall sliding with two axis-aligned bounding boxes (tiles) but I've not quite found ...
2
votes
0
answers
82
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.
...
0
votes
2
answers
612
views
Full-screen window hangs when debug break or crash (Windows/GLFW/Cocos2D)
I run into an issue if my game application becomes unresponsive when running in fullscreen on Windows. This mostly applies when I want to use breakpoints in Visual Studio, however if the application ...
0
votes
1
answer
1k
views
Cocos Creator - orientation change event in native build for iPhone and Android
I am making some Hybrid app which has some native part in Both iOS and Android and common functionality (which includes and games/animation and UI) which I make in Cocos Creator.
The problem I am ...
0
votes
0
answers
56
views
Cocos2dx- how to box2d cannot move through each other?
player box2d
...
0
votes
1
answer
295
views
Resource protection in cocos2d-x 2 and 3
I am developing a game in cocos2d-x 2.2.3 and I want to protect my resources from being extracted. Is there any way I can do this?
I don't know much about encryption.
0
votes
1
answer
532
views
Circle to Circle Collision of moving Sprites
i needed help attaching circle1 Sprite to circle2 Sprite on collision onto the same point where they are getting collided, and both circles are moving with Action.
Like this,
Attaching means, when ...
0
votes
1
answer
385
views
Assets from Tiled background layer not appearing in Cocos2d-x
I'm running into an issue with a Tiled map used as a background image for a scrolling scene. I'm using two sprite sheets to provide assets for a background layer. In Tiled, all of these assets appear ...
1
vote
0
answers
660
views
Correct way to move player in cocos2d-x chipmunk platformer
I'm attempting to make a physics based 2d platformer in cocos2d-x using the built in chipmunk physics engine. I've not used a physics engine before and I'm having some issues setting the correct ...
1
vote
0
answers
206
views
Cocos2d-x : Socket.io-client-cpp crashes after creating scene
I'm using https://github.com/socketio/socket.io-client-cpp with cocos, because the built-in socket.io doesn't support callback (http://discuss.cocos2d-x.org/t/doesnt-work-with-socketio-2-0-1-and-...
0
votes
1
answer
367
views
How can I rotate childrens nodes with parent node in cocos2dx?
Consider the following code...
...
1
vote
2
answers
602
views
Can I create custom framebuffer and render to it in cocos2dx?
I want to do post processing effects so I was thinking If I could just make custom framebuffer in cocos2dx like OpenGL and render the ALL SCENES objects in it. I want a single frame buffer for all ...
1
vote
2
answers
457
views
How to keep same aspect ratio in different devices with cocos2dx?
I have been making a board game and I am using cocos2dx. There are two scenes for now, One is main menu and the other is gameplay scene. When I run the apk on tablet with EXACT_FIT resolution policy ...
0
votes
1
answer
418
views
Cocos2d-x setContentSize, setScale give poor graphic quality
I want to create sprite with size is relative to the screen size. I.e: Sprite size is equal to screen width * 0.2.
I use setContentSize and ...
7
votes
1
answer
2k
views
Train-like movement in a 2D game
I am developing a 2D game using Cocos2d-X in C++ language. In my game, I need to implement train movement.
Here is the image about the output I want to achieve:
I tried to do the above moment using ...
1
vote
0
answers
557
views
Cocos2d-x: Differences between applying shader to child node and entire scene?
I'm beginning with shader.
I wonder what if i apply shader for single node, what'll happen?
The gl_FragCoord = (0.5,0.5) is the bottom left of the screen or the ...
0
votes
1
answer
192
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 ...
0
votes
1
answer
110
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
1
answer
188
views
how to make a ball move in opposite direction when hitter to ball or paddle
I had set angle but it's not correct and I'm not getting exactly what I needed. The ball should bounce when hit to paddle or border and move in opposite direction. I'm writing the code in c++.
I had ...
0
votes
2
answers
234
views
What does glBlendFunc do when given an incorrect enumeration value?
In cocos2d-x, I am using particle system from plist with blend values: dst = 1, and src = 100 which is wrong enum for gl_blend.
Although app logged "OpenGL error 0x0500" but it still run and showed a ...
1
vote
2
answers
369
views
Get different result on different devices (same resolution) after setVelocity
I'm dying with physics , i've tried to use setVelocity however i got slightly different value from different devices.
I've tested on iPhone 5 (on simulator)
and ...
0
votes
1
answer
362
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 ...
0
votes
1
answer
215
views
How should you structure your graphics system around your logic system?
C++ & Cocos2d-x, but I think the issue is language-independent.
I just recently finished up writing the foundational logic for my game. The way I've decided to keep my logic and my graphics ...
0
votes
1
answer
130
views
Why the layer must be created from my class and not from layer class
I am confused about something.
I have the following example:
mainMenu.h
...
0
votes
2
answers
938
views
Cutting up a Sprite sheet to frames
I'm new to game development, so please be kind if this is a very simple question.
I have a Sprite sheet with 18 frames of the same character (6 col x 3 rows) moving slightly. I want to get the frames ...
1
vote
0
answers
140
views
Cocos2dx v3 Problem with moving Sprite on tilemap after it was scrolled up
I have a problem I can't solve so far.
I have a scene with tile map on it. And there is a Sprite spawnpoint on map. This Sprite should do MoveTo() action to the point where TouchEnded().
It all works ...
1
vote
0
answers
204
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
...
0
votes
1
answer
379
views
Cocos2d-x build failing on linux
I was trying to compile cocos2d-x on my linux machine, because they do not provide a binary copy of the library. However, I received the following error during the build:
...
2
votes
1
answer
1k
views
I need to find intersection point of a vector in an axis aligned rectangle
I need some help, I have one vector in a rectangle like following
(Ops, first A2 point on the top should be A1, assume it is A1)
Let's say the vector is like above It doesn't have intersection point ...
1
vote
1
answer
835
views
Shooting Projectiles
I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this ...
1
vote
2
answers
437
views
How to program friction in an air hockey game in Cocos2d-x 3.11?
I'm developing a simple air hockey game, and I have a question about friction of puck and puddles with the game scene. How can I do that? I'm using cocos2d-x default physics engine, and the friction ...
1
vote
2
answers
801
views
Cocos2d: Tweening primitive data-types
I asked in SO, but no responses so I'm posting here since it's probably more relevant here.
EDIT: SO question closed.
I'm trying to tween primitive data-types the way Action tweens position to ...
4
votes
1
answer
227
views
How to make expanding ring with constant thickness?
I need to generate this burst or (donut-shaped) pulse.
I'm having a difficult time how to generate such shape.
At first, I was thinking of scaling the image but that didnt work out because the line or ...
0
votes
1
answer
272
views
cocos2d-x Label Load Image like Sticker-Smile..(by html or …)
hi and sorry for my english...
i am using cocos2d-x (c++)... can i load sticker (smile) in my Label(a text mixed by image)? i know that we can load bitmap fonts by:
...
1
vote
0
answers
2k
views
How to connect to a socket.io server from a Cocos2d-x game?
The question can also be asked more specifically as; How do I connect to a socket.io server with C++ from a mobile game?
I am aware of Boost (and Socket.io C++ client libraries using Boost) but ...
3
votes
0
answers
122
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 ...
0
votes
0
answers
138
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, ...
0
votes
1
answer
240
views
How can I save and load an adventure game?
I'm using cocos2dx and sqlite to store datum. The table looks like this: x INT, y INT, className TEXT, properties TEXT. I use json to serialize terrains and sprites....
1
vote
0
answers
73
views
Can I use sdl_net2.0 with cocos2d-x? [closed]
Can I use sdl_net2.0 lib with cocos2d-x? And how it cconects to each other. Or analog lib to use?
0
votes
1
answer
223
views
how to naturally rotate a ball according to its velocity on a surface, a wall
I develop a game on cocos2d-x cpp. There is a ball sprite in my game. I move the ball on a surface(wall) via touch events but it can't naturally rotate according to its velocity.
if i use ballSprite->...
0
votes
1
answer
270
views
Cocos2d background sound not playing a second time C++
I'm using cocos2d-x on windows10 UWP project. I use the SimpleAudioEngine to load the music:
...
1
vote
1
answer
1k
views
What is CC_Time in cocos2dx?
I was following this tutorial to understand using custom shaders : http://www.cocos2d-x.org/wiki/User_Tutorial-Realistic_looking_animated_real-time_clouds
I understand that CC_Time is Cocos2d-x built-...
0
votes
1
answer
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 ...
3
votes
1
answer
1k
views
Cocos2d Sprite 3D position
When I set a position3D for a Sprite in cocos2dx, it render two times the same sprite, i took a screenshot:
I set the position3D because i want to use the Z position the give an effect of distance, ...
2
votes
2
answers
681
views
How to handle sounds muting in settings?
I have a easy and specific question.
Let's say that in my game I use singleton for playing/pausing/changing volume of specific sounds (SimpleAudioEngine in cocos2d-x).
What is the best way to ...
1
vote
0
answers
69
views
Black bar in beetween the image when Background move infinite
I'm trying to scroll my background forever and so I'm using the background image twice. When the first one goes off screen, it should relocate to the end of the second one. However, there seems to be ...
1
vote
1
answer
13k
views
How to set up Cocos2d-x for visual studio?
I want to make a cocos2d-x game. I read you can use any IDE, so I was planning to use Microsoft Visual Studio 2015, since I want to make my game primarily for Windows. I have been searching for ...
4
votes
1
answer
2k
views
Compile cocos2d-x Windows games without Visual Studio
I want to use cocos2d-x to make a Windows game. I used the cocos console:
cocos compile -p WIN32
And apparently it needs Visual Studio.
Is there an alternative ...
1
vote
0
answers
94
views
Cross-platform game to be wrapped into a native iOS/Android app
I need to build an app like Lumosity (https://play.google.com/store/apps/details?id=com.lumoslabs.lumosity) that is native app and have some game screens.
So the question is: Is there a way to build ...