title: Cocos2D BezierBy with increasing speed over time
body: <p>I'm pretty new to C++/Cocos2d, but I've been making pretty good progress. :)</p>
  
  <p>What I want to do is animate a coin 'falling off' the screen after a player gets it. I've managed to successfully implement it 2 different ways, but each way has major downsides.</p>
  
  <p>The goal: After a player gets a coin, the coin should 'jump', then 'fall' off of the screen. Ideally, the coin acts as if acted upon by gravity, so it jumps up with a fast speed, slows down to a stop, then proceeds to go downward at an increasing rate.</p>
  
  <p>Attempts so far:</p>
  
  <pre><code>  void Coin::tick(float dt) {
      velocityY += gravity * dt;
      float newX = coin-&gt;getPositionX() + velocityX;
      float newY = coin-&gt;getPositionY() + velocityY;
      coin-&gt;setPosition(newX, newY);
      // using MoveBy(dt, Vec2(newX, newY)) has same result
    }
    // This is run on every 'update' of the main game loop.
  </code></pre>
  
  <p>This method does exactly what I would like it to do as far as movement, however, the frame rate gets extremely choppy and it starts to 'jump' between frames, sometimes quite significant distances.</p>
  
  <pre><code>  ccBezierConfig bz;
    bz.controlPoint_1 = Vec2(0, 0);
    bz.controlPoint_2 = Vec2(20, 50); // These are just test values. Will normally be randomized to a degree.
    bz.endPosition = Vec2(100, -2000);
    auto coinDrop = BezierBy::create(2, bz);
    coin-&gt;runAction(coinDrop);
  </code></pre>
  
  <p>This one has the benefit of 'perfect' framerate, where there is no choppiness whatsoever, however, it moves at a constant rate which ruins the experience of it falling and just makes it look like it's arbitrarily moving along some set path. (Which, well, it is.)</p>
  
  <p>Has anybody run into a similar situation or know of a fix? Either to better handle the frame rate of the first one (MoveBy/To don't work- still has the choppy effect) or to programmatically set speeds of the second one (change speeds going to/from certain points in the curve)</p>
  
  <p>Another idea I've had is to use a number of different <code>MoveBy</code> actions with different speeds, but that would have awkward 'pointy' curves and awkward changes in speed, so not really a solution. </p>
  
  <p>Any ideas/help are/is greatly appreciated. :)</p>