Skip to main content
12 votes

Train-like movement in a 2D game

I'm not used to Cocos2D engine, but I can suggest this solution for you to apply to your game. Naive implementation The simplest way to implement a train wagon can be making an object which follows a ...
liggiorgio's user avatar
  • 4,866
2 votes

Cocos2d-x build failing on linux

While not having experience with Cocos2D, I'd guess that you'll need to replace isnan with std::isnan. If that works, it's a ...
SurvivalMachine's user avatar
2 votes
Accepted

What does glBlendFunc do when given an incorrect enumeration value?

It's unspecified. What that means is that the GL implementation is pretty much free to do whatever it wants. It might change nothing, it might reset to the defaults, it might make a best guess, it ...
Maximus Minimus's user avatar
1 vote

Full-screen window hangs when debug break or crash (Windows/GLFW/Cocos2D)

You did not mention if you are running Visual Studio and your game application on the same computer or not. If you have not already done so you should utilize the remote debugger functionality of ...
DHarding's user avatar
1 vote

Cocos Creator - orientation change event in native build for iPhone and Android

Hi I have develop a game for iOS, android and for browser and I have used this code to get sizes of my device. ...
Manoj Kumar Rai's user avatar
1 vote

Resource protection in cocos2d-x 2 and 3

There's honestly not a lot you can do here in terms of absolute protection. No matter how strong a vault you lock your resources inside, ultimately your game needs to know the code to open that vault ...
DMGregory's user avatar
  • 135k
1 vote
Accepted

Assets from Tiled background layer not appearing in Cocos2d-x

Thanks to Thorbjørn Lindeijer for the answer! The problem, as he advised, was that cocos2d-x only allows one tileset per layer - separating the background into layers solved the problem. Updated ...
Kevin Mack's user avatar
1 vote

Cocosdenshion and Android not working

Isn't auto audio = CocosDenshion::SimpleAudioEngine::getInstance(); local and accessible to your init function, how are you reaccessing it in your ...
Ryan Bourne's user avatar
1 vote

how to make a ball move in opposite direction when hitter to ball or paddle

in my opinion , setting speed to negative should fix the problem ( which negative is opposite with positive ) : ...
user6668201's user avatar
1 vote

What does glBlendFunc do when given an incorrect enumeration value?

Setting aside for a moment the question over whether or not calling an OpenGL function with illegal parameters will have an effect or not, here's how to actually get the information you want: ...
Trevor Powell's user avatar
1 vote

Get different result on different devices (same resolution) after setVelocity

You are talking about obtaining a deterministic physics simulation. Are you running a fixed timestep? https://chipmunk-physics.net/tutorials/ChipmunkColorMatch/Tutorials/ColorMatch-ChipmunkPro-...
PompeyPaul's user avatar
1 vote

Why the layer must be created from my class and not from layer class

First of all, it's very uncommon to start classnames with a lowercase letter. It makes the code harder to understand. Second, I'm not sure if I got your question right, but it seems like you're ...
RadicalRaid's user avatar
1 vote

Cutting up a Sprite sheet to frames

what are you looking for is ShoeBox sprite sheet editor.
Joseph's user avatar
  • 191
1 vote
Accepted

I need to find intersection point of a vector in an axis aligned rectangle

The goal is to project the vector onto the correct sides of the rectangle. Using the tangens function we're already halfway done. The rest is basic trigonometry. Input data Depending on how you store ...
1000ml's user avatar
  • 293
1 vote

Shooting Projectiles

You are fixing the time to 10(seconds?), so it will always takke it 10 seconds to reach its target. So if its a short distance, the bullet will move very slow and over a long distance the bullet will ...
Daniel Hop's user avatar
1 vote

How to program friction in an air hockey game in Cocos2d-x 3.11?

the methods you're looking for are: setAngularDamping(float damping); setLinearDamping(float damping); according to cocos2d-x documentation both methods are used ...
Joseph's user avatar
  • 191
1 vote

Cocos2d: Tweening primitive data-types

The base idea is to chain Ease Actions with your normal tween action. Ease action basically changes the flow of time for it's inner action; So by implementing a simple/linear action, and chaining it ...
Ali1S232's user avatar
  • 8,677
1 vote

Handling animations in a Platformer

Rather than using entire sprite sheet animation, I would recommend a 2D skeletal approach. Tools like Spine can help you here and are supported by cocos2d-x framework. The class in question is the ...
ThorX2's user avatar
  • 111
1 vote

How to get `Label::createWithTTF` to support RTL languages such as Arabic

Cocos2d seems missing Unicode BiDi and Shaping. Please, Submit a bug report to its development team. Or make it yourself. High Level: Pango is a multi-platfom open source text layout library. If you ...
user.dz's user avatar
  • 121

Only top scored, non community-wiki answers of a minimum length are eligible