cocos2d-iphone

Proper cocos2d scene restart?

梦想与她 提交于 2020-01-13 06:28:07
问题 How do I restart cocos2d scene and clean memory after the previous one? [director replaceScene:s] is displaying pink screen. Can't get it to work. The work-around I made is below, however after closing scene this way app runs very slow and slowly reacts to touch. MainViewController.m : - (IBAction)startScene { [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888]; if ([director runningScene]) { [director end]; works = NO; } if (!works) { EAGLView *glview = [EAGLView

Why does xcode archive succeed but create an empty .xcarchive file?

痞子三分冷 提交于 2020-01-13 04:22:50
问题 Background I have an application I'm trying to archive and submit to the app store for approval. Part of the process requires the archive to be prepared and loaded using application loader. I used product-> archive and it prompts archive succeeded but it does not appear on the Organizer -> Archive tab. Detail of Project build 1 app target, "AppName" 1 static library, cocos2d libraries (cocos2d v0.99.5-rc1) Xcode Version 4.0.2 First steps Setting "Skip Install" to "No": Project AppName target

Cocos2D/iOS7: continuously increasing memory usage for boilerplate code

陌路散爱 提交于 2020-01-12 07:25:10
问题 This is what it looks like with iOS7 simulator when application is just running without any user interaction(also I'm not running any code of mine, only boilerplate Cocos2D): No such issue with 5.0->6.1. The code producing this problem is Cocos2D boilerplate code which I tried to minimize with commenting and this is the minimum code from App delegate: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Create the main window window

Touches priority in cocos2d/cocos2d-x

自作多情 提交于 2020-01-12 05:50:09
问题 I am trying to play around with touches in cocos2d-x . I have question on the priority of the touches for example , When I use CCMenuItemSprite or CCControlButton which are added on the Layer which has setTouchEnabled(true) or even If I put a What I found is touch is not first given to ccTouchesBegan (...I mean Layer) instead it is taken by CCMenuItemSprite or CCCOntrolButton call backs . Moreover , If I add an extra layer top on all the layers and setTouchEnable (True) same results I get

Scoring System In Cocos2D

时间秒杀一切 提交于 2020-01-11 14:29:10
问题 My game has a collision detection where when my missile hits the enemy the enemy disappears. I want to add a scoring system that adds 1 point every time my missile hits the enemy. I'll post my game code below (I used the HelloWorldLayer.m)** Here is the code: Link - http://pastebin.com/iGP83SCv In the collision section i just want it to add 1 point every time the projectile hits the enemy "sprout" and display the score in label. Example: Score:0000 PS, please explain it as easy as possible.

iOS app validation error: Missing plist key CFBundleShortVersionString

£可爱£侵袭症+ 提交于 2020-01-11 08:54:18
问题 I built an iOS game with SpriteBuilder and cocos2d. When I attempt to submit it to the AppStore, I get the following error: ERROR ITMS-9000: "Missing plist key. The Info.plist file is missing the required key: CFBundleShortVersionString." How do I fix this? Thanks! 回答1: This is an easy fix. You just need to add the CFBundleShortVersionString key to your Info.plist file. Click your Info.plist file in your project. Right click and select "Add Row". Then paste in the string

cocos2d convertToWorldSpace

大憨熊 提交于 2020-01-10 15:41:13
问题 I'm not sure convertToWorldSpace works. I have spriteA which is the parent. I set it to position 40,40 for example and add it to the scene. I have a second spriteB which I set at position 80,80. I add spriteB to spriteA. I print out the position of spriteB: 80,80. I then print [self convertToWorldSpace:spriteB.position]. And, I still get 80,80. Shouldn't spriteB position be different here? 回答1: In your case if you want know the position of your spriteB in the current world you must call the

Cocos2d, iOS and XCode: how can I debug/understand this stacktrace?

。_饼干妹妹 提交于 2020-01-07 09:26:28
问题 I am developing a Cocos2d 2.0 game and can't quiet get around on why my App is crashing. The console output is as following: 2013-02-08 10:52:08.298 AppName[994:15203] cocos2d: CCSpriteBatchNode: resizing TextureAtlas capacity from [29] to [40]. 2013-02-08 10:52:08.299 AppName[994:15203] cocos2d: CCSpriteBatchNode: resizing TextureAtlas capacity from [40] to [54]. 2013-02-08 10:52:08.300 AppName[994:15203] cocos2d: CCSpriteBatchNode: resizing TextureAtlas capacity from [54] to [73]. (lldb)

cocos2d my image retina doesn't resize [closed]

牧云@^-^@ 提交于 2020-01-07 09:22:44
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have a problem in my application with cocos2d retina picture. When I run the application, the image retina is displayed, but it doesn't resize. Help me. 回答1: First check the your application enabled or not. if(

Cocos2d-x creating an object based upon CCLayerColor

时光怂恿深爱的人放手 提交于 2020-01-06 21:06:03
问题 Cocos2d-x 2.1rc0 OS X 10.8, XCode 4.6.2 Playing around with the HellowWorld with Box2D example to gain some concepts. Creating an class that is an extension of CCLayerColor. Previously, before I created a separate object I was doing: // background CCLayerColor *background = CCLayerColor::create(cGhostWhite); background->setContentSize(CCSizeMake(1024, 768)); background->setPosition(0,0); this->addChild(background,0); This worked. After trying to create my own object I am getting and error: