3 votes

How can I cleanly separate the UI from the game logic in my Cocos2d game?

I agree with Engineer's answer, where the main point is "don't fight the framework". Games are different However, another point I want to add is that when it comes to software, games are different. ...
Raphael Schmitz's user avatar
2 votes

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

There is noise introduced in your texture due to compression which causes some of the pixels to not be perfectly black. You need to add an error threshold to your comparison, fastest way is to use a ...
Stephane Hockenhull's user avatar
1 vote

Java - Adjusting the speed of an object during movement

If you want to change magnitude of a vector without altering its direction (its speed without its direction, in your case), you just have to multiply each of its contained number (x and y, in your ...
Aracthor's user avatar
  • 1,009
1 vote

How do mobile games create simple UI components?

I can't speak for cocos2d, but since your post has a libgdx tag, I will tell you how libgdx does it. Libgdx has the scene2d.ui widgets library that includes several useful UI components like Buttons,...
spectacularbob's user avatar
1 vote

How to use a mask texture with Kobold2D

First draw the mask sprite, with the src color (the mask) set to GL_ONE and the destination color (an empty buffer) to GL_ZERO. Draw the sprite, with the src color set to GL_DST_ALPHA. Call the ...
OKprogrammer's user avatar
1 vote

Box2d: High screen resolution / frequency causes high friction?

The problem is with high freequency 120Hz Solution is to set fixed deltaTime for update physics world instead of using graphic update time ...
David Tran's user avatar
1 vote

Adjusting arms of character while moving

I was able to get what I was asking for by copying the sprite, then removing it and adding it back. I also made sure to not "add" another action on top on top of the copied sprite, as Cocos2d keeps ...
Bennybear's user avatar
  • 125
1 vote

Help understanding the parkour tutorial in Cocos2d

This is to keep the player centered on the screen (while maintaining the illusion of motion). The player is moving (right) relative to this.gamelayer. If ...
Leftium's user avatar
  • 4,423
1 vote

Make something move when no key is pressed

If you need something to happen at the moment when the player stops giving input, you can add a "inputTime" field that stores the time of the last input. For the ...
Theraot's user avatar
  • 26.7k
1 vote

Make something move when no key is pressed

Making something move when no key is pressed is generally down to either AI or physics. Your stars gravitate toward the balloon - this is a physics-like effect and should be factored out of ...
Engineer's user avatar
  • 29.5k
1 vote

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

If you want to put something on a website, you need to obviously either create your own site or find a publisher. Both have drawbacks, with a publisher you lose the rights over your IP and with a ...
Bálint's user avatar
  • 14.9k
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

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

Actually, the base system requirements for developing with Unity, Cocos2d-x and GameSalad are quite minimal, and are just within the system specifications advertised of the Mac Mini. In fact, the ...
Gnemlock's user avatar
  • 5,263
1 vote

Cocos2dx - Create the friction of the ground

Old thread but I wanted to put my two cents in since I needed something like this on a project I worked on. You can create a physics body for a sprite with a specified material. This would look ...
phigmint's user avatar
1 vote

Cocos2dx - Create the friction of the ground

First of all you need to make sure your Scene is created with physics enabled. You do this by calling ...
RadicalRaid's user avatar
1 vote

Cocos2d JS - Getting vector reflection

Kevin ven der Velden's answer is close, but gets the types wrong. The dot product of two vectors returns a scalar (float) ...
DMGregory's user avatar
  • 134k

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