shivalingesh nashipur sel_shedule
Posts 21
Location Banglore
Added by shivalingesh nashipur about 1 year ago

hey guys am a beginner for cocos and wp7, i worked with wp7 simple game, now using cocos2dx in it
i had done with this
id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
to
CCCallFunc actionMoveDone=CCCallFuncN.actionWithTarget(this,spritemovefinished);

can any help me with this to convert to c# of cocos2dx
[self schedule:@selector( gameLogic: ) interval:1.0]

RongHong Huang RE: sel_shedule
Posts 171
Added by RongHong Huang about 1 year ago

it must be: this.schedule(gameLogic, 1.0f);

shivalingesh nashipur RE: sel_shedule
Posts 21
Location Banglore
Added by shivalingesh nashipur about 1 year ago

thats the thing i did first, but the error is something like
the best overloaded method match for 'cocos2d.CCNode.shedule(cocos2d.SEL_SHEDULE,float) has some
invalid arguments
should i need create SEL_SHEDULE delegate or something,?
i created a simple snske ladder game totally in XNA c#, now am getting hard to learn cocos and then converting it to C# xna, i hope cocos2dx-xna would help a lot, but am not getting a simple sample program to refer for such ,
any way whats that SEL_SHEDULE am facing ?

RongHong Huang RE: sel_shedule
Posts 171
Added by RongHong Huang about 1 year ago

from what you said, you should define gameLogic like this: public void gameLogic(float interval)

shivalingesh nashipur :-) thanks, but i am not able to remove the childs check the code below?
Posts 21
Location Banglore
Added by shivalingesh nashipur about 1 year ago

CCMoveTo actionmove=CCMoveTo.actionWithDuration(actualDuration,new CCPoint(-tSprite.contentSize.width / 2,actualY));
CCCallFunc actionMoveDone=CCCallFuncN.actionWithTarget(this,spritemovefinished);
tSprite.runAction(CCSequence.actions(actionmove,actionMoveDone));

public void spritemovefinished() {
// removeChild(tSprite, true);
//this.removeChild(this.tSprite,true);

}

if i didnt remove child it works well , but i facing mscorlib.dll!systemthrowHelper.ThrowKeyNotFoundException()+0X5
error
when i try to remove childs
how should i use the above function to remove those targets frm memory?

game dev RE: sel_shedule
Posts 70
Added by game dev about 1 year ago

if you change the touches method in hello cocos2d project with

    public override void ccTouchesBegan(List<CCTouch> touches, CCEvent event_)
        {
            this.removeChild(this.pSprite, true);
        }

then it works fine, maybe you added pSprite to a batch node and not to class.

Raghu S RE: sel_shedule
Posts 75
Added by Raghu S about 1 year ago

In case you are defining this as a behavior to a class object, then this should work

public void RemoveThisObject()
{
   this.removeFromParentAndCleanup( true );
}
game dev RE: sel_shedule
Posts 70
Added by game dev about 1 year ago

whats also interesting is that if you call this.removeChild(this.pSprite,true); more than once when the sprite is already removed it wont crash unlike in cocos2dx/c++


(1-7/7)