views:

134

answers:

2

I'm looking for the Tick and draw method, and I'm not sure where they are. Do I have to make them from scheduler, if so how?

I've heard that the draw method is only called 4 frames per second when 'paused', so does it exist somewhere?

A: 

From Cocos docs:

'tick' the scheduler. You should NEVER call this method, unless you know what you are doing.

As for draw, the method is called on each CocosNode to draw its contents. From the docs again:

override this method to draw your own node.

Draw will be called if your node needs drawing, and if so, as many times as your refresh rate is set to. You can override draw in your nodes to do custom OpenGL drawing for instance, or to alter the way a CocosNode is drawn.

pgb
+3  A: 

Well. The draw method is called when needed by the framework. You just need to create the method and draw what you need there.

-(void)draw{    

    // Draw stuff

}

The tick method is were all you calculations should be. Not in the draw method. Here's an example of how to init the schedule of a tick method. Place it in the init method.

[self schedule: @selector(tick:) interval:1.0/30.0];

-(void) tick: (ccTime) dt
{

  // Do calculations

}
Mattias Akerman