The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
17 views

applyImpulse on CCSprite not making realistic moves

I am developing a jump game, in that when tapped on screen, I need to make the player jump up. So, I used following code. [_player.physicsBody applyImpulse: ccp(0, player.physicsBody.mass * 155)]; ...
0
votes
0answers
35 views

Cocos2D v3 CCParallaxNode scrolling can't keep player in focus

I am very fresher to game development and I need to develop a game like NinjaJump. I have created a CCParallaxNode to setup scrolling background and added CCPhysicsNode to setup Physics world. I have ...
5
votes
1answer
209 views

How to read a color of a pixel from texture (cocos2d-js)?

How to read a color of a pixel at [x,y] from a texture (in cocos2d-js)?
1
vote
2answers
303 views

Should I draw directly on a CCLayer or a CCSprite?

Now I am a little confused in my cocos2d-x cpp project. I want to draw lines with user's finger touch. Following the screenshot of a CCScene: In the screen, there are two squares. I want show an ...
0
votes
1answer
324 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
87 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 ...
1
vote
2answers
241 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
510 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
378 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
164 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
144 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 ...
2
votes
2answers
932 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
494 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
2k 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
337 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
2k 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
1k 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 ...