ios - How to call the -(void)update:(CCTime)delta method in Objective-C -
is there way call -(void)update:(cctime)delta
method in objective-c? know (using sprite builder) can create scene , have attached custom class when scene loaded through ccbreader, class's update method automatically called.
i loading scene through code without custom class still update method "start" (for lack of better word.) there way this?
call scheduleupdate
from, example, onenter
method.
[self scheduleupdate];
however if using cocos2d-objc or cocos2d-spritebuilder version 3.0 or later, update:
methods scheduled automatically.
https://github.com/cocos2d/cocos2d-objc/blob/v3.0/cocos2d/ccnode.m#l1190
-(cctimer *) schedule:(sel)selector interval:(cctime)interval repeat: (nsuinteger) repeat delay:(cctime) delay { nsassert(selector != nil, @"selector must non-nil"); nsassert(selector != @selector(update:) && selector != @selector(fixedupdate:), @"the update: , fixedupdate: methods scheduled automatically.");
Comments
Post a Comment