0

I want to call a method thrice with different parameters and need to have some delay between calling them,inorder to this i want to use CCCallFuncND,but i unable to implement it in my code, please help me do that by giving a simple example of how to call CCCallFuncND.

My Code is :

this.runAction(CCCallFuncND.action(this, "shift_sec", "1"));

public void shift_sec(String v) {
    System.out.println("Coming into this method. : "+v);          
}
MikO
  • 18,243
  • 12
  • 77
  • 109

1 Answers1

0

I will illustrate with example:

CCCallFuncND.action(this, "hitCallback", data)

here
this--> is target i.e sender

"hitCallback"-------> is the string which being called.

data -----------> is an object to be send

public void hitCallback(Object sender,Object data){
        CCSprite hitSpotSprite = (CCSprite)data;
        hitSpotSprite.removeFromParentAndCleanup(true);
        hitSpotSprite = null;
    }

in your case shift_sec(String v){} being modified to

shift_sec(Object sender,Object data){}
Rama
  • 1,156
  • 1
  • 7
  • 13