I'll have to stop asking anything here, or you'll be the author of all my 
game's code, Claudio ! You're really amazing !
Once again thank you very much, I just had to add your lines of code, and 
the problem disappeared. dt went from 1.5sec to 0.30sec, what a big change 
! that's really amazing, thank you

Le mercredi 1 août 2012 03:17:02 UTC+2, Claudio Canepa a écrit :
>
>
>
> On Tue, Jul 31, 2012 at 5:10 PM, Nitneroc 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 view this discussion on the web visit 
https://groups.google.com/d/msg/cocos-discuss/-/h7eU_kPNg-IJ.
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