Questions tagged [ccaction]

CCAction is a class from the popular Cocos2d engine

CCAction is a class from the popular Cocos2d engine

Class Reference

64 questions
0
votes
1 answer

how can I time a sprite to create the effect of lightning?

I want to get the lightning effect right for sprites in cocos2d. I know CCActions can help achieve the effect but How can I make an image appear for 0.2 seconds every 2 - 4 seconds?
NSCodeman
  • 51
  • 4
0
votes
0 answers

Running different actions on parent and child node

I'm trying to run a shake action on my gameLayer The game layer also contains a CCSprite child that is running another action at this time. When I run my shake action, it runs. However the effect only appears after the sprite has finished its…
David Zhang
  • 346
  • 2
  • 13
0
votes
1 answer

Creating a class to run a single action on multiple sprites

I'm trying to rotate numerous sprites (about 48 different ones) around an arbitrary point (using this article: http://indiedevstories.com/2012/08/14/custom-cocos2d-action-rotating-sprite-around-arbitrary-point/ ) and I managed to create the custom…
evanlws
  • 93
  • 1
  • 12
0
votes
2 answers

Cocos2D: Multiple actions: CCMoveTo CCAnimate

I don´t understand, I absolutely cannot get this to work, I want a sequence of actions that plays an animation and moves the sprite using the CCAnimate ans CCMoveTo classes. Is there a bug or something special about these classes, cause it will not…
Tom Lilletveit
  • 1,872
  • 3
  • 31
  • 57
0
votes
1 answer

run more than one CCAction with same CCSprite

I'm currently developing a mobile game with Kobold2d (cocos2d), but I having some trouble to animate one CCSprite with more than one animation. My question is: With the same CCSprite (player) how to animate it with two different animation. I'm using…
0
votes
1 answer

Action sequence in Cocos2d

I have an array of sprites. I want to loop through the array and tell each spirite to move a certain distance at a random angle, and fade out while doing so. Preferably with easing. Is there a way to set up a sequence to do this? Can you have a…
soleil
  • 12,133
  • 33
  • 112
  • 183
0
votes
0 answers

CCRotateBy actions are intermittently jumpy/jerky? Cocos2d

I have a subclass of cpCCSprite, which is just for using chipmunk spaceManager and my class looks like this: @implementation Helmet +(id) helmetWithGame:(Game*)game { return [[[self alloc] helmetInit:game] autorelease]; } - (id)…
Stephen
  • 499
  • 9
  • 28
0
votes
3 answers

CCAnimation is not working

In my init method I init frames for an animation like this. walkingFrames = [NSMutableArray array]; for(int i =2; i<34; i = i+2){ if(i<10){ [walkingFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache]…
bluestunt
  • 479
  • 4
  • 11
0
votes
1 answer

Preload CCAction?

I notice in my Cocos2D app that whenever I load a specific CCAction for the first time there a slight lag (maybe like 0.3 seconds) however this does not occur the second time. This is the most noticeable with the CCShake action:…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
0
votes
2 answers

CCAction in box2d world

i'm newbie to both cocos2d and box2d and i've been struggling for two days with this problem : i have a scene with many sprites dropping down (with bodies attached to them). and i have a BackgroundLayer from which i add my background image into the…
Jazzmanouch
  • 183
  • 10
0
votes
2 answers

Wait till all CCActions on different CCSprites are complete

I am developing a simple cocos2d game in which I want to animate two CCSprites simultaneously, and for this purpose I simply set CCActions on respective `CCSprite's as follows. [first runAction:[CCMoveTo actionWithDuration:1…
atastrophic
  • 3,153
  • 3
  • 31
  • 50
0
votes
2 answers

Repeat CCAction Certain Number of Times?

In Cocos2D 2.x, I am doing runAction to do some animations in my game. It is working great but I want the animation to repeat a certain number of times. So pretty much my pseudo-code is this: CCSequence... action1, action2 [sprite…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
0
votes
2 answers

Cocos2D ignoring a CCAction

I'm trying to run two CCMoveTo actions on my sprite like this: [mySprite runAction:moveUp]; [mySprite runAction:moveRight]; I know that I can combine this motion into a single CCMoveTo however having them separate has some benefits (for example I…
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
0
votes
2 answers

Moving a CCSprite and getting a callback

I move an instance of CCSprite in my Cocos2D-based iPhone game like this: [mySprite runAction:[CCMoveBy actionWithDuration:1.0 position:ccp(10, 10)]]; How can I get a callback everytime the sprite moves? I'd…
SundayMonday
  • 19,147
  • 29
  • 100
  • 154
0
votes
1 answer

Why am I able to reuse CCActionInterval?

I'm building a simple 2D game in Cocos2d which involves having enemies cross the screen across different, predefined paths. The nextFrame method has the following code: int indexCount = 0; for (Enemy *e in enemies) { if ([cocosGuy…
wonderlr
  • 165
  • 2
  • 5