Comparison between scheduleUpdate and scheduleUpdateWithPriority in cocos2d

Source: Internet
Author: User

In cocosd, CCLayer provides the schedule method to refresh frames. The default frequency is 60 frames per second, as shown below:

Init {
[Self schedule: @ selector (tick :)];
}
-(Void) tick :( ccTime) dt
{
// Update your stuff here
}

Cocos2d v0.99. also provides the following two more effective methods to refresh frames.
[Self scheduleUpdate]; // use priority = 0 ---
[Self scheduleUpdateWithPriority: an_integer]; ---- B
Then implement the update method in the cclayer subclass.
-(Void) update :( ccTime) deltaTime
{
// Update your stuff here
}

What are the differences between the old and new methods?
The new method provides priority options, which means you can sort the execution sequence for the update method of n brother.
The new method can save some memory and increase the speed of each update.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.