The ccsprite tag has no wiki summary.
0
votes
1answer
59 views
How to get position of CCSprite added to CCParallaxNode?
I have a CCparallaxNodeExtras that scrolls infinite (following the space game tutorial). I added as a child a CCSprite made of other CCSprite, like this:
_backgroundNode = ...
0
votes
2answers
74 views
CCSprite as an iVar
So I built my first game app, and it was a lot of fun. I'm really trying to expand on some of the ideas, but I'm running in to some serious variable scope issue. What I want to do is encapsulate a ...
0
votes
0answers
195 views
cocos2d fragment shader transparency
I'm playing with custom fragment shaders for a CCSprite (see http://www.raywenderlich.com/4428/how-to-mask-a-sprite-with-cocos2d-2-0).
But I can't figure out why I get a white color whith the ...
1
vote
2answers
173 views
Crash due to removal of Elements like CCSprite from NSMutableArray
So, here's how it goes.
I am currently working on Cocos2d game, which consists of many Obstacles. One obstacle gets added on the screen at an interval of 10 seconds like this.
ObstacleSprite* ...
0
votes
1answer
274 views
Keeping the CCSprite on the screen
In my cocos2d app I have a CCSprite moving on the screen but it moves off the screen. How can I prevent the CCSprite from moving off the screen?
Thanks
2
votes
1answer
320 views
Image 1 becomes image 2 with sliding effect from left to right?
I would like to show a second image appearing while a "door" is closing on my character. I've got my character in the middle of the screen and a door coming from the left. When the door passes my ...
-1
votes
1answer
144 views
Make a CCSprite come up from bottom of the screen in intervals
I have a cocos2d iOS app. I have a CCSprite that I need to come up from the bottom of the screen every few seconds (like 2 or 3 seconds). How would I do this?
0
votes
1answer
125 views
CCSprite x and y comparison
I have 2 CCSprites and I want to tell if their x and y are equal I tried this:
if(sam.position.x == tom.position.x && sam.position.y == tom.position.y){
NSLog(@"Hooray!");
}
Although I do ...
1
vote
2answers
715 views
Basic game architechture best practices in Cocos2D on iOS
Consider the following simple game: 20 squares floating around an iPhone's screen. Tapping a square causes that square to disappear.
What's the "best practices" way to set this up in Cocos2D?
Here's ...
1
vote
1answer
406 views
Cocos2D Accelerometer Z axis
I am making a 2D scroller game where the player controls an airplane via the accelerometer I would like to know if it is possible to scale in and to scale out the sprite/airplane using the ...
1
vote
1answer
1k views
Smooth animation in Cocos2d for iOS
I move a simple CCSprite around the screen of an iOS device using this code:
[self schedule:@selector(update:) interval:0.0167];
- (void) update:(ccTime) delta {
CGPoint currPos = self.position;
...
1
vote
1answer
266 views
Cocos2d not getting the texture which is added to CCTextureCache using thread
I convert the image into texture in a thread using the following line of code to reduce the image to texture converting time.
[[CCTextureCache sharedTextureCache] addImage:@"imageName"];
But when i ...
1
vote
3answers
2k views
How to determine an irregular area of a CCSprite?
In my simple game I use boundingBox for pick coins and other stuff, but I need use irregular area detection of Sprite(with out Alpha)... There is alternative to boundingBox?
Here is code:
...
1
vote
1answer
2k views
Count number of CCSprite added to a CCLayer
Does cocos2d has a method that returns the amount of CCSprites added to a CCLayer?
A have SceneControlLayer object, and I added some CCSprites to it.
@interface SceneControlLayer : CCLayer {
}
...
4
votes
1answer
1k views
Should I be subclassing CCSprites?
When I am working with cocos2d I can add CCSprites to the layer or 'stage' and manipulate them.
Now, to do my ongoing calculations for movement AI and such, things that will always run, should I:
...
2
votes
1answer
1k views
Programmatically set color of Box2D body's sprite or image
In my basic Cocos2D + Box2D iPhone app I have a bunch of circular Box2D bodies. I'd like to change the color of the circles programatically. What's the easiest way to do this?
So far I'm just ...
1
vote
1answer
796 views
Stretching textures for CCSprites in Cocos2D
I'm making a game for iPhone and iPad w/ Cocos2D and Box2D. I scale the size of square objects ("blocks") using a pixel-to-meters ratio depending on the particular device. Can I stretch or shrink ...