On Tue, Jul 31, 2012 at 5:10 PM, Nitneroc <[email protected]> wrote:

> I made pyglet print the parameters of clock.unschedule every time it was
> called. It seems a lot of my objects have _step functions, that have to be
> removed (inherited from CocosNode.
> Most of those objects are the Water_Blocks you created for me Claudio (
> http://pastebin.com/7FYWrDA6), and I use a lot of them, so it seems
> pretty logical.
>
> I guess this will be very hard to avoid, so I'll stick with one of the
> above solutions. Yet I read this in the documentation :
>
> Subclassing a cocosnode usually means (one/all) of:
>         - overriding __init__ to initialize resources and schedule calbacks
>         - create callbacks to handle the advancement of time
>         - overriding draw to render the node
>
>
> So maybe it's possible to avoid those _step functions, especially since
> those Water_blocks will never have any scheduled action. But this will
> probably be much too hard for me.
>
>


If those nodes will never use actions, you can avoid the schedule /
unschedule cost by adding in your CocosNode subclass:

def resume(self):
   """ special version: this skips actions scheduling"""
   pass

def pause(self):
   """ special version: this skips actions scheduling"""
   pass

def do( self, action, target=None ):
   """ special version: this skips actions scheduling"""
   # lets explode if the 'no actions promise' is forgotten
   assert False

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en.

Reply via email to