I have two sprites. Both should animate. But sprite1 should animate first and after completion of the animation of sprite1, sprite2 animation should start. Can I say to a sprite to run from a certain time and end at a certain time ? This is my problems. Please explain how can I do that.
Thank You.
...
My problem is, I did coding for a sprite. It should change it should change it's image from( 1, 2, 3). It should look like count down time to start a game. 1, 2, 3 are 3 png images. But the images are not displayed in equal intervals of time. I mean time between (1 - 2), (2 - 3) is not same. It is random. Please help me with my problem. ...
I added a label by using CCLabel to my layer. Now I want it do disappear after some time like (2sec). How can I make it to disappear?
CCLabel *labelPerfectDraw = [CCLabel labelWithString:@"Perfect Draw" fontName:@"Marker Felt" fontSize:30 ];
labelPerfectDraw.color = ccc3(0x00, 0x00, 0xff);
labelPerfectDraw.position = cc...
I have two sprites in my app. Both should have touches enabled and both touches are independent of one another. And if I touch the screen (not on sprites) it should have different touches. My problem is all three sprite1, sprite2, remaining screen should have independent touches. But my program is taking all the touches as same. How can ...
If I try to do actions over menuItems but the actions are not running as expected.
I think code below should make the menuItem rotate by 90 degrees but when I run it, the menuItem translates from its coordinates to another coordinate then returns to its original coordinate. The complete translation takes 3 seconds.
What I need is for t...
Alright, I am very confused, so I hope you friends can help me out. I'm working on a project using Cocos2D, the most recent version (.99 RC 1). I make some player objects and some buttons to change the object's life. But the weird thing is, the code crashes when I try to change their life by -5. Or any negative value for that matter,...
Hi there,
I'm making a little iphone game, and I would get some clues.
Let's imagine:
Two background sprites moving pretty fast from right to left, and moving up and down with accelerometer.
I guess I can't use animations here, cause the movement of the background is recalculated at each frame.
So I use a schedule with an interval of ...
Hi All,
Id like to start my game, with the initial game play layout as the background, with a buttons layer over the top with maybe 'Tap to start' and a high score etc.
and similarly, when the game finishes, id like to just 'pause' the final game play layout and overlay a game over menu of sorts.
I tried calling [[CCDirector sharedDir...
I have a sprite and if it is touched the touch should be recognized. I used the coordinates to do so. I took the coordinates (min x, min y, max x , max y)of the sprite image. But The sprite image is not a rectangular shape. So, even if I touch the coordinates outside the sprite and inside the rectangular bounds the sprite is recognized....
That's the question xD
Given an instance of a CCSprite in cocos2d in iphone, what method can I use to obtain the image width and height?
Thanks!
Manuel
...
In my application one player and 10 targets are there. Each target appears one after the other (from target1 to target10). It's a shooting game. If we hit the first target then second target will come. The targets have properties like name, speedOfGunDraw, probability to hit the player, speedOfFire.
What should I do to make them appear...
Hey everyone,
So i'm trying to use GameKit along with Cocos2D so that when a user clicks on the multiplayer menu item it will display the GKPeerPickerController. I'm however, running into some snags. It doesn't seem to want to compile. However, it doesn't give me an error inside of the code that's in my selector. Anyways here's the code...
I'm looking to make an RPG with Cocos2D on the iPhone. I've done a fair bit of research, and I really like the model Cocos2D uses for scenes. I can instantiate a scene, set up my characters etc. and it all works really nicely... what I have problems with is structuring a game loop and separating the code from the scenes.
For example, wh...
Hi All,
I have near about 255 image frames for background animation, 99 frames of enemy sprite and 125 frames of player sprite.
All animations are running simultaneously on the screen. That is background animation is running and 4-5 enemies are on the screen are present at a time, also player is there at the same time.
Take a look at ...
I am using Cocos2D for my main framework. In some cases, I want Cocos2D to load a nib file and have that be the view:
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
TargetPlayerViewController *myController = [[TargetPlayerViewController alloc]initWithNibName:@"TargetPlayerViewController" bundle:nil];
[window ...
Hi,
I have a character that goes through multiple states. The state changes are reflected by means of a sprite image (texture) change. The state change is triggered by a user tapping on the sprite. This works consistently and quite well.
I then added an animation during State0. Now, when the user taps - setTexture gets executed to cha...
I am writing a small game by using cocos2d. It is a shooting game. Player on one side and enemy on other side. To run the both actions of player shooting and enemy shooting do we should use threads ? Or can we do without using them. At present I am not using threads. But I can manage to do both actions of player and enemy at same time. S...
Hi,
I am doing my program in cocos2d.
I am using NSDate to get the current time of the start of animation. And I know my animation takes 3 seconds. So I can get the time at completion of animation by using NSInterval and using the previous time and animation time. But, if If the animation time interval is not fixed how can I calculate t...
I have written my code in following way in cocos2d.
id actionTo = [CCFadeOut actionWithDuration:4.0f];
id actionTo0 = [CCSequence actionWithDuration:2.0f];
if (m < enemyNumber)
id actionTo1 = [CCCallFunc actionWithTarget:self selector:@selector(goToNextScene)];
else
id actionTo1 = [CCCallFunc actionWithTarget:self selector:@...
In an application, i saw that they used to display pictures of vehicles. But what was amazing was when we touch and swipe in that picture, it rotates in 3d way left and right. And from the front view we can rotate and get to see its back view also. It is a very good feature and i was trying to replicate it. But couldnt get an idea of how...