ios - How to make sprite move in a sinusoidal in cocos2d? -
i have sprite (paper plane, example). i'd make move in picture below. can use lots of moveto , rotateby actions define path points, seems bad idea me. how can implemented ? i thought might post answer showed basics of how update work if had explicit control on sprite. i not sure if using cocos2d or cocos2d-x, technique applies in either case. code in c++ using cocos2d-x. the idea that, based on time, (manually) update position of sprite. position of sprite @ time determined number of seconds since animation begun. line nominally follows straight path (x0,y0) (x1,y0). can project line onto line drawn @ angle using trigonometry. gives ability have sinusoidal path along direction. here basic code (the main work done in updateanimation()): // assumes frame rate relatively constant // @ 60 fps. const double seconds_per_tick = 1.0/60; const double duration = 8.0; // seconds total animation. const double x_start = 100; // pixels const double y_star...