Forum > C++ > Delay Action in Sequence not Running

Delay Action in Sequence not Running

By notamonopoly Posted 2013-05-02 13:26 Comments 2
  • Posts: 33

I’m using cocos2d-2.1rc0-x-2.1.2-hotfix

I have a simple sequence I am trying to run but for some reason the CCDelayTime never seems to run, or it never finishes, I’m not sure which.

this~~>runAction, // <~~ this is the issue
CCCallFunc::create(this, callfunc_selector(Player::finished)),

Player::finished is never called if the CCDelayTime comes before it. If I comment out the CCDelayTime then Player::finished is called immediately without issue. I’ve also tried CCSequence::createWithTwoAction and the result is the same.

Does anyone have any suggestions?

  • Posts: 33

#1 RE: 2013-05-02 13:47

Fixed it.

Instead of saying “this~~>runAction", I changed it to "this~~>getParent()->runAction”.

I’m not sure I understand why. The class where this is called is a custom class that extends several other custom classes that all stem from CCSprite. This class has been previously added to a custom Layer class, extending CCLayer.

In any case, it works now so I guess that’s all that matters.

  • Posts: 16
  • Location: GuangZhou.GuangDong.China

#2 RE: 2013-05-03 06:19

use schedule instead is better

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps