0

I'm trying to do what I did hundred of times with cocos2d, but with cocos2d-x seems I have less luck.

If i do

CCsequence *squence = CCSequence::create(someAction1, someAction2, NULL);

the compiler says:

No matching function for call to 'create'

I've found this problem around the internet but without any solution. By the way, if I do a simple action like:

CCAction *action = CCMoveTo::create(5.0f, CCPointMake(0,0));

sprite->runAction(action);

the action is not even called, and the sprite is not nil (I've printed his size etc), printing info about that sprite it is the exact object it should be

Raptor
  • 53,206
  • 45
  • 230
  • 366
Adarkuccio
  • 973
  • 4
  • 12
  • 24
  • How do you create the sequenced actions? Are they all subclasses of CCFiniteTimeAction? – CodeSmile Nov 08 '13 at 10:17
  • I've tried both CCAction *action = CCMoveTo::create(x, (y,z)); and CCFiniteTimeAction *action = CCMoveTo::create(x, (y,z)); nothing is fired, I've also tried to setup a simple project with only a background image added as child as the only layer and then call an action with it but nothing is moving, so the normal action is not fired and the sequence says error about the 'create' method – Adarkuccio Nov 08 '13 at 10:24
  • writing the sequence like this: sprite->runAction(CCSequence::create((CCfiniteTimeAction*)a, NULL)); is not showing error about 'create' anymore, but the problem is still not fired – Adarkuccio Nov 08 '13 at 10:49

2 Answers2

0

Try this:

CCFiniteTimeAction *action = CCMoveTo::create(x, (y,z));
CCsequence *squence = CCSequence::create(action, NULL);

I think the error is because CCSequence expects CCFiniteTimeAction classes but you're declaring them as CCAction which makes the compiler think you're passing the wrong type, complaining that there is no create function that takes CCAction as parameters.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
0

You can try like this

CCMoveBy *action = CCMoveBy::create(.5, CCPointMake(ball->getPositionX(), ball->getPositionY()+100));
CCMoveBy* action_back = (CCMoveBy*)action->reverse();
ball->runAction(CCSequence::create(action, action_back, NULL));

ball is sprite

Singhak
  • 8,508
  • 2
  • 31
  • 34