ios - Smoother sprite rotation in cocos2d? -


i have simple program when hold screen sprite moves , when let go sprite moves down. in cctouchesbegan function rotate sprite:

-(void)cctouchesbegan:(nsset *)touches withevent:(uievent *)event{      player.rotation = -5; } 

and in cctouchesended function rotate again:

-(void)cctouchesended:(nsset *)touches withevent:(uievent *)event{      player.rotation = 20; } 

so wondering if there way make rotation little slower , smoother? looks clunky when run , want more realistic. not using physics engine (box2d, chipmunk, etc..)

  • you can use ccrotateby or ccrotateto class functions rotate it. ex. player->runaction(ccrotateto::create(1.0f, -5)); // in c++

    here first parameter specifies duration rotation (currently 1 sec) , 2nd 1 angle.

    but if touch screen 1 may weird.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -