Tag Info

New answers tagged

0

In cocos2d you need first to stop all running action of a node in order to be able to remove that node. So I think you forget to stop the running action and you can fix it as below: redBody->stopAllActions(); redBody->removeFromParentAndCleanup(true); and blueBody->stopAllActions(); blueBody->removeFromParentAndCleanup(true); Hope It ...


2

If you take a look at your AppDelegate::applicationFinishedLaunching function, it begins with these lines of code: auto director = Director::getInstance(); auto glview = director->getOpenGLView(); if(!glview) { glview = GLView::create("My Game"); director->setOpenGLView(glview); } You should check for supported compression after those lines ...


0

The problem is probably: precision lowp float; Which causes u_time to be 8bit unsigned fixed points with a range of only 0 to 1 or -2 to 2. setting it to mediump would probably fix the scrolling issue but would still degrade performance greatly. uniform mediump vec2 u_time; uniform lowp vec4 u_color; It's better to calculate UV coordinates in the ...


1

Assuming the rope has no weight, this problem is about finding the lowest point of an ellipse (http://en.wikipedia.org/wiki/Ellipse ) where (PF1+PF2 == rope length) This image show how the ellipse is rotated. From there you can figure out the lowest point by tracing the ellipse with a binary search to find the lowest point. That's where the weight should ...


0

You can play an animation and : animation->setDelayPerUnit(T);


1

Do you have a SpriteBatchNode object added to the scene? According to the cocos2d-x wiki: A SpriteBatchNode object contains the actual image texture of all the sprite frames. You must add it to a scene, even though it won’t draw anything itself; it just needs to be there so that it is part of the rendering pipeline. For example: SpriteBatchNode* ...


0

I want to draw lines with user's finger touch. Following the screenshot of a CCScene I had a same project in cocos2dx. for drawing something like this you can use CCRenderTexture. RenderTexture work like a paiting canvas. you put a sprite ( imagine it as a painting brush) on somewhere on RenderTexture and call sprite->visit(). If you this visit() ...


1

I think I can help you someway. In Cocos2dx we could handle collision event with EventListenerPhysicsContact. check out this code: auto character = Sprite::create("chacracter.png"); auto body = PhysicsBody::createCircle(sprite->getContentSize().width / 2); body->setContactTestBitmask(-1); body->getFirstShape()->setMass(200); ...


0

you can use void update(float deltaTime) function. just active it in initial() function by this->scheduleUpdate() and the override void update(float deltaTime). bool Game::init() { ... moveObjects this->scheduleUpdate() ... } void Game::update(float deltaTime) { // Do whatever setZOrder(); } void Game::moveObjects() { // Here we move object and ...



Top 50 recent answers are included