cocos2d-iphone

How to change the app preference settings through code?

情到浓时终转凉″ 提交于 2019-12-21 21:40:08
问题 I have listed my app in the device setting app.Now I can change my app settings through the device app settings app. Now what I am trying to do is the reverse. I am trying to make a app so that it can itself change its preferences in the device settings app if I change the preferences of my app from within the app. Any ideas Friends, Thank You All. 回答1: Nice and simple: [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"MyPreferenceKey"]; NSUserDefaults includes convenience methods

Game center facebook like

落爺英雄遲暮 提交于 2019-12-21 21:21:02
问题 So today i started developing with the new iOS 6 SDK and noticed that my game has a new Facebook Like button in Game Center(which is greyed out because i didn't specify anything on it yet). So my question is, how can i put a link of a facebook page behind that "Like" button? My iPhone game has a facebook page already btw. Thanks already, 回答1: Hope it is not too late. Just watched one of WWDC videos and they said, if someone will click the like button, it'll means that person like the game and

[ios.cocos2d+box2d]how to disable auto-rotation?

让人想犯罪 __ 提交于 2019-12-21 20:58:54
问题 I have created a project with cocos2d 0.99.5 + box2d. When I rotate my iphone, Screen automatically rotated too. So the boxes Flew up into the ceiling. How to disable auto-rotation? plz 回答1: In coco2d 0.99.5, the template creates a file called GameConfig.h, where you get to choose what system controls the app's rotation. The default is #define GAME_AUTOROTATION kGameAutorotationUIViewController Now take a look inside RootViewController.m, or whatever you've named it in your file. in the -

SimpleAudioEngine Cocos2d Leaking Memory

假装没事ソ 提交于 2019-12-21 20:14:47
问题 I am running Instruments and it indicates that the SimpleAudioEngine is leaking memory. The screenshot is attached. The memory leak is multiple times although the screenshot only shows one instance. Also, sometimes it points to the following implementation (my code): -(void) preloadGameSounds { // pre load the background sound [[SimpleAudioEngine sharedEngine] preloadEffect:@"farm_background_sound.mp3"]; // pre load the game sounds [[SimpleAudioEngine sharedEngine] preloadEffect:@

SimpleAudioEngine Cocos2d Leaking Memory

本秂侑毒 提交于 2019-12-21 20:14:28
问题 I am running Instruments and it indicates that the SimpleAudioEngine is leaking memory. The screenshot is attached. The memory leak is multiple times although the screenshot only shows one instance. Also, sometimes it points to the following implementation (my code): -(void) preloadGameSounds { // pre load the background sound [[SimpleAudioEngine sharedEngine] preloadEffect:@"farm_background_sound.mp3"]; // pre load the game sounds [[SimpleAudioEngine sharedEngine] preloadEffect:@

Storing and reading files from Documents directory iOS 5

泪湿孤枕 提交于 2019-12-21 20:12:32
问题 In my game, when a level is completed the app stores a "1" in a file in the Documents directory of the app. When the game then loads, a player can only play a level if the previous level has been completed. When I test the game via Xcode and on a device the app works properly and a level cannot be played until the previous level has been completed. However, when the app was approved and released on the App Store, the app behaves as if each level has been completed (no locked levels). I can't

glReadPixel stopped working with iOS6 Beta [duplicate]

故事扮演 提交于 2019-12-21 19:43:04
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Why is glReadPixels() failing in this code in iOS 6.0? I currently have an App in Appstore that uses the Cocos2D framework. For collision detection I am using glReadPixels. The screen only has white and black pixels and detecting a black pixel means collision. Everything works fine up to iOS 5.1.1 but in iOS6 Beta (all of them) glReadPixels stopped working. Now the RGB values returned by glReadPixels are always

Cocos2d: Detect touch on rotated sprite?

眉间皱痕 提交于 2019-12-21 19:12:17
问题 How would one detect a touch on a rotated CCSprite? I am familiar with the general technique of using ccTouchesBegan and contentSize, anchorPoint etc. to have a sprite detect if a touch was within its bounds ... but I am not sure how to proceed once the sprite has been rotated by some angle. I want the sprite itself to detect the touch (encapsulation) and report the event via a delegate to another object. If anyone has some code to share ... would be great. 回答1: Try using the CCNode

Cocos2d: Detect touch on rotated sprite?

时光总嘲笑我的痴心妄想 提交于 2019-12-21 19:11:29
问题 How would one detect a touch on a rotated CCSprite? I am familiar with the general technique of using ccTouchesBegan and contentSize, anchorPoint etc. to have a sprite detect if a touch was within its bounds ... but I am not sure how to proceed once the sprite has been rotated by some angle. I want the sprite itself to detect the touch (encapsulation) and report the event via a delegate to another object. If anyone has some code to share ... would be great. 回答1: Try using the CCNode

CCParallaxNode parallaxRatio (explanation)

三世轮回 提交于 2019-12-21 15:20:55
问题 I feel stupid asking this question, but I can not find a clear answer anywhere (or much of an answer at all) so I feel I must ask. Is there anyone out there who can explain clearly how the parallaxRatio of CCParallaxNode works? I have checked the source of CCParallaxNode and it does not explain it at all. I have searched the internet and stackOverflow extensively. I have tried to do good old trial and error. I'm still confused. [parallaxLayer addChild:backgroundEffect_subtleRed z:100