New answers tagged cocos2d-x
This code is adapted from a game demo in 'Cocos2d-x by Example Beginner's Guide' by Roger Engelbert. circleSprite->setScale(0.1f); circleSprite->runAction(ScaleTo::create(1.0f, 5.0f)); First it makes the sprite tiny (0.1f) and then runs an action to scale it up over 1.0 second (I have used an arbitrary scale to value of 5.0f for this example). The ...
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 move very fast. So you need to set the time to (distance)/(velocity).
So I realized how to do it. You need to override a method called Scene::update() with something like ball->getPhysicsBody()->setVelocity(ball->getPhysicsBody()->getVelocity()*0.995f); And later paste this into your Scene::init(), so the update() method will be called every frame(?). this->scheduleUpdate();
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 with an ease action, you'll end up with the ease function you originally intended. As for the tweening. Let's say you want an object to change, there are two ...
Top 50 recent answers are included