I'm trying to draw two sprites on the same screen. I have defined the two sprite objects in two separate class files.
If I comment out two lines (see "item 1" comment below) then I get a display as [a backgroundimage[background2.jpg] with a sprite[grossini.png] on the left side.
If I uncomment the two lines I do not get the background...
Hello! I have a CCLabelAtlas that I have on a layer to display the current score within my game...the problem that I am having with it is that it does not update when I use [scoreLabel setString:]. Here's how I have it laid out:
In the header:
@interface GameScene : CCLayer {
...
CCLabelAtlas* scoreLabel;
}
And in the init:
score...
I have created a UIScrollView in a cocos2d application. I am adding sprites dynamically, over 3 pages. On the first page, touch works perfectly on a sprite, however if I use the scroll view and navigate to the second page, touch does not work quite right... the sprite will respond to the touch when I touch the screen, approximately the a...
What I want to do is create a huge texture(w/ width of more than 1024) using a 1024x1024 image. I can retrieve the images using an AtlasSpriteManager, but whenever I try to retrieve the texture from the manager I can only get the first image.
I need to set the position of every AtlasSprite in the manager to make a lengthy texture.
Any ...
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 have a NSDate *date1 in class1 implementation file(I initialized it as Global variable). I have NSDate *date2 in class 2 implementation file (initialized it as Global variable).
I need to calculate the NSTimeInterval between the two dates in class 2. But I could not do it. I could not access date1 in this class. It is giving error as (...
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,...
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....
I have issue with userlocation in mkmapview.
The thing is that i have navigation controller which pushes mapview , as soon as it pushes it userlocation is queried. But if user pop mapview view before userlocation animation is finished , it throws exception because animation is trying to access deallocated mapview instance.
So my quest...
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...
I've got some jerky movement of my sprite.
Basically, when the user touches a point on the screen, the sprite should move to that point. This is working mostly fine... it's even taking into account a delta - because frame rate may not be consistant.
However, I notice that the y movement usually finishes before the x movement (even whe...
I have a bit of a strange problem. I am trying to send in-app email. I am also using Cocos2d. It works, so far as I get the mail window and I can send mail, but it is extremely slow. It seems to only accept touches every second or so. I checked the cpu usage, and it is quite low. I paused my director, so nothing else should be happ...
Hi All
IPhone SDK has UIViewAnimationTransitionCurlUp/Down
I want Curl left-right like a reading a book.
Is any way to do this without Landscape Orientation.
Thanks
Amit Battan
...
Hi All
I am using animated image (gif image) in webview
but problem is that it showing while background for transparent image. even I set the background color of webview is transparent.
Is any way to do it transparent or any other way to show transparent animated image in Iphone SDk
Thanks
Amit Battan
...
Hi
I am working on an app where I need to save a part of iphone's screen shot as JPEG and then send this through email. The part of screen has some text labels, fields etc. Any ideas please on how can I save part of screen as JPEG (I am a newbie therefore any help/sample code is highly appreciated)
...
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:@...
I have writing a small shooting game in cocos2d. Winning the game is to eliminate all the 10 enemies. After that end screen comes showing 'You Won' and 'Play Again'. If I go for 'Play Again' option the game is starting from where I need. But, the problem is that the game is continuing from previously ended state.
I mean it is not startin...
for ( tempI = 0; tempI < 10; tempI++ )
{
tempJ = 1;
NSArray *objectsForArray = [NSArray arrayWithObjects:@"array[tempI][tempJ]", @"array[tempI][tempJ+1]", @"array[tempI][tempJ+2]", nil];
}
Can I write the code as above. I need to store an float value (array[][]) in NSArray. Can I do it ?
My problem is, I have a matrix as
...
I am using cocos2d to build an iPhone game. It's mostly done, but along the way I came across some things that I would like to handle better. I am fairly new to Objective C, and honestly I do more Perl scripting in my day-to-day job than anything, so my C skills are a little rusty.
One of them is the fact that I have modified cocos2d ...
My game is a small shooting game in cocos2d. The enemy generates the bullets to shoot player at intervals of time. I have created a random y , so that bullets touch the opposite edge at random heights. If the bullet touches the player the enemy wins.
But, I need to set probability for the enemy accuracy. If the probability of enemy is gi...