cocos2d-iphone

Managing resources in a universal ios app

蓝咒 提交于 2020-01-05 09:03:50
问题 I am developing a cocos2d game. I need to make it universal. Problem is that I want to use minimun amount of images to keep the universal binary as small as possible. Is there any possibility that I can use same images I am using for iphone, retina and iPad somehow? If yes, how can I do that? What image size and quality should it be? Any suggestion? Thanks and Best regards 回答1: As for suggestions: provide HD resolution images for Retina devices and iPad, provide SD resolution images for non

OpenGL error 0x0502 in -[CCSprite draw] 530

我的梦境 提交于 2020-01-05 08:12:32
问题 I am using cocos2d 2.0. Here on one scene where i load data in tableview i get error saying "OpenGL error 0x0502 in -[CCSprite draw] 530" in log window . App runs well I searched and i realised there are some shader files missing. I have made sure all my files are there and compile sources are also up to date. But on on link i got some solution saying Well I don't know which draw function to modify and whats wrong with my cocos2d files. Is there any way to solve this issue? Can this crash my

Cocos2d layer hierarchy and draw order

 ̄綄美尐妖づ 提交于 2020-01-05 07:52:12
问题 I am stuck with the problem of layer hierarchy in cocos2d. I have a character with sprites for its body parts. The parent sprite of the body is the torso. Then I have arms and head that are the children of it, then elbows and hands are children of the arms. It works very well so far: I turn the elbow and the hand is turning with it, just like on a real puppet. The problem is when I want to make it wave, the hands get behind the head since head has a higher z-order than arms (which are parents

NSArray vs NSDictionary look up

老子叫甜甜 提交于 2020-01-05 04:35:13
问题 Which is quicker and less expensive for checking if an object already exists within a list. By using the NSArray contains object or by checking if a key already exists for an NSDictionary? Also does the NSArray containObject selecter iterate through the whole array elements? Also what about checking if a key already exists within a dictionary? Does that require iterating through all the keys. Finally, what is the best and quickest way to check if an object already exists within a large list

Cocos2d-iPhone and iPhone X resolution

柔情痞子 提交于 2020-01-05 04:21:07
问题 Can you believe we are still using Cocos2d-iPhone? Does anyone have a fix for making it work with the newest iPad's and iPhone X's? Our mode is landscape. 回答1: If cocos2d version 1.0 - 2.1 then update it to Cocos2d 2.2 Add iPhoneX splash screen in Images.xcassets In CCConfiguration.m file updated below function. In this we are handling contentScaleFactor 3. -(NSInteger) runningDevice { NSInteger ret=-1; #ifdef __CC_PLATFORM_IOS if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { ret =

Playing itunes song previews from cocos2d app

末鹿安然 提交于 2020-01-05 04:02:16
问题 I am trying to get itunes song previews to play in my app. I have found some other questions like this but none of the solutions have worked for me. I am already signed up with the Affiliate program that apple has. Here are some of the things I have tried: This got me the itunes preview URL that I am trying NSUInteger numberOfResults = 200; NSString *searchString = @"AC/DC"; NSString *encodedSearchString = [searchString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString

degenerated vertices and GL_LINE_STRIP

倾然丶 夕夏残阳落幕 提交于 2020-01-04 06:33:57
问题 I'm on iOS 5.1 I was trying to display several batch of lines in the same vertex array and I wanted to separate them using degenerated vertices. But it does not seem to work. I line is drawn between each batch of vertices. Googling the problem gave me results that degenerated vertices was not compatible with GL_LINE_STRIP but I'm not really sure about it. Can someone confirm that? And also what's the alternative ? 回答1: As far as I know, you can only draw a continuous line using a single

How to return a C-array from method in Objective-C?

一世执手 提交于 2020-01-04 04:11:19
问题 I have a function that returns a variable and I want to know how to return an array the issue is it isn't an NSArray it is just an average C array like this... -(b2Fixture*) addFixturesToBody:(b2Body*)body forShapeName:(NSString*)shape { BodyDef *so = [shapeObjects objectForKey:shape]; assert(so); FixtureDef *fix = so->fixtures; int count = -1; b2Fixture *Fixi[4]; while(fix) { count++; NSLog(@"count = %d",count); Fixi[count]= body->CreateFixture(&fix->fixture); if (Fixi[count]!=0) { NSLog(@

cocos2d starting particles from a specific time in the future

拜拜、爱过 提交于 2020-01-04 01:44:08
问题 I am developing a cocos2d based app with a space background in which I am exploiting a CCQuadParticleSystem to make blinking stars. I have generated this particle system with ParticleDesigner. As soon as I load the particle system white dots representing stars start appearing in the background and after a while they fade out so that, after few seconds in which the particle system reaches the regime state, a night sky full of stars comes out. My problem is that I would like to know if there is

Cocos2d - lunar eclipse effect on iPhone

我是研究僧i 提交于 2020-01-03 19:35:32
问题 i have a question about achieving an effect like on a lunar eclipse. The effect should look like in the first seconds of this gif. So just like a black shadow which goes over the circle. The ideal situation would be a function where i can passed a parameter in percentage to get this amount as a shadow on the circle: The problem which i am facing is that my background is an gradient. So it's not possible to have a black circle which moves over the moon to get the effect. I tried something with