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?
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…
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…
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…
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…
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…
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)…
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]…
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:…
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…
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…
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…
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…
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…
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…