On Fri, Oct 17, 2008 at 10:56 AM, joanplanas <[EMAIL PROTECTED]> wrote:
> I've seen that there's available a Layer method called
> "enable_step()" for the "step()" method to be called on every tick.

Hi, Joan. Well, maybe I missed a part of the documentation but I've
never heard of such method.

However, you can do what you want by using the schedule functions of
CocosNode objects (including Layers). A very simple example would be
something like this:

class MyLayer(Layer):
    def __init__(self):
        super(MyLayer, self).__init__()
        self.schedule_interval(self.step, 1/60.0)

    def step(self, dt):
        #update logic here


Doing that will cause the MyLayer.step method to be called at 60 fps
(hopefully) and the dt parameter would contain a float with the
seconds elapsed since last frame. Any aditional args and kwargs passed
to schedule_interval will be passed to your calback function as well.

-- 
Kao Cardoso Félix

Página pessoal: http://www.inf.ufrgs.br/~kcfelix
Blog: http://kaofelix.blogspot.com

--~--~---------~--~----~------------~-------~--~----~
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