Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the cocos2d-x code snippets?

Shulou Source: shulou.com Published: 2022-06-02 16:27:51 11月15日 Update

This article will explain in detail what the cocos2d-x code snippets are, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Cocos2d-x code snippet accumulation 1. Left and right vibration CCPoint pointL=menuItem_buy- > getPosition (); CCPoint pointR=menuItem_buy- > getPosition (); pointL.x-=3; pointR.x+=3; CCMoveTo* moveLeft=CCMoveTo::create (0.08, pointL); CCMoveTo* moveRight=CCMoveTo::create (0.08, pointR) CCFiniteTimeAction* action= CCSequence::create (moveLeft,moveRight,moveLeft,moveRight,moveLeft,moveRight,NULL); menuItem_buy- > stopAllActions (); menuItem_buy- > runAction (action); 2. Copy CCRepeat* action = CCRepeat::create (spawn, 50); CCRepeat* action2 = (CCRepeat*) action- > copy ()-> autorelease (); CCRepeat* action3 = (CCRepeat*) action- > copy ()-> autorelease (); 3. Action reversal CCActionInterval * rot1 = CCRotateBy::create (4,360); CCActionInterval * rot2 = rot1- > reverse (); call for 4.schedule: schedule (schedule_selector (SchedulerAutoremove::autoremove), 1.0f); schedule (schedule_selector (SchedulerAutoremove::tick), 0.5f); termination unschedule (schedule_selector (SchedulerAutoremove::autoremove)); 5. UnscheduleAllSelectors (); 6. Take the screen center macro # define corner ccp (CCDirector::sharedDirector ()-> getWinSize (). Width/2,CCDirector::sharedDirector ()-> getWinSize () .height / 2) about which cocos2d-x code snippets are shared here. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Code fragments actions content articles more knowledge articles good screen quality reference help vibration related accumulation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Xiaomi Shulou Information Shulou Tech Info Shulou Technology