cocos2d-iphone

How to crop some part of sprite?

谁说我不能喝 提交于 2019-12-12 13:28:02
问题 I am working on a game like tap tap ants(https://itunes.apple.com/us/app/tap-tap-ants/id348839552?mt=8) in iPhone. I want to crop some portion of sprite. when an ant touches cake sprite, some portion of cake disappear. I researched a lot but could not find any solution. Plz help 回答1: You can use spritesheets in the form of CCSpriteBatchNode to set a display frame on a sprite. As done so below. This allows you to select a boxed region of the spritesheet to be displayed. CCSpriteBatchNode

How to transfer a CCSprite from one parent to another?

社会主义新天地 提交于 2019-12-12 11:18:27
问题 I have a CCSprite called sprite that is a child of a CCLayer called movingLayer that is itself a child of the current CCLayer running my game logic, so it is self in this case. movingLayer is moving back and forth across the screen in a repeat forever action and sprite is riding along on it. I want to get sprite to "get off" of movingLayer and "get on" to self where it can do some actions of its own. When I try to do this, I need to tell movingLayer to remove sprite and self to add sprite.

How to set background color in CCLabelTTF in cocos2d

烂漫一生 提交于 2019-12-12 11:09:46
问题 I am currently using Cocos2d FrameWork for my Game. I need to change the background color in a CCLabelTTF.I know how to set font color, can someone please tell me how to change background color of the CCLabelTTF object. CCLabelTTF *nameLabel=[CCLabelTTF labelWithString:[NSString stringWithFormat:@"%@",[plyName objectAtIndex:i]] fontName:@"Arial" fontSize:20]; nameLabel.position=ccp(100,y1); nameLabel.color=ccc3(245, 222, 179); [self addChild:nameLabel]; This is my sample code for adding Label

issue with CCScrollLayer in cocos2d-iphone-2.1-beta2

隐身守侯 提交于 2019-12-12 10:45:23
问题 Hi there I'm having problems as stated with CCScrollLayer in the lateste cocos2d beta, mainly that on compiling I get: use of undeclared identifier 'CC_GL_BLEND' . Is there any way to sort this problem that anyone has found yet? 回答1: Safely you can comment that line..anyway blending is already enabled...and everything works fine after this change in cocos2D 2.1 beta. // Set GL Values #if COCOS2D_VERSION >= 0x00020000 // ccGLEnable(CC_GL_BLEND); //Guru ccPointSize( 6.0 * CC_CONTENT_SCALE

Unable to authenticate the package: 721772200.itmsp

早过忘川 提交于 2019-12-12 10:43:31
问题 I am writing because I have a serious problem - I have bought the Commander Cool game on the cartoonsmart site. However, a serious problem occured. The application cannot be accepted by the iTune Connect validation. I tried to publish it from two different developer accounts and the error still occurs. The error suggests some problems with the certificate but I am sure it is 100% right because I have published more than 20 apps in the App Store as for now. I ask you for help because you are

How to read a plist data and get int from it?

て烟熏妆下的殇ゞ 提交于 2019-12-12 10:00:44
问题 Currently using cocos2d. I have a plist data name myplist.plist. Inside the plist are all integers.. How do i read the data and the int in it? 回答1: NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *dictionaryPath = [path stringbyAppendingPathComponent:@"myplist.plist"]; NSDictionary *integerDictionary = [[NSDictionary alloc] initWithContentsOfFile:dictionaryPath]; int myInteger1 = [[integerDictionary objectForKey:@"integer1"] intValue]; int myInteger2 = [[integerDictionary

How to convert 32 bit PNG to RGB565?

旧街凉风 提交于 2019-12-12 09:11:54
问题 How can I accomplish this? A programmatic solution (Objective-c) is great, but even a non-progarmmatic one is good. I have pixelmator -> But that doesn't give you the option. I can't seem to do it with Preview either. I have tried googling, but haven't been able to find a solution so far. The only tool I have been able to use to do this is TexturePacker, but that creates a sprite sheet. 回答1: You can use libpng to convert the PNG image to three-byte (8:8:8) RGB. Then you can downsample to the

How can I implement a virtual joystick for a cocos2d game outside the cocos2d environment?

北城以北 提交于 2019-12-12 08:58:14
问题 I am developing an iPad game that uses cocos2d and requires a virtual joystick. I have a prototype up and running using SneakyJoystick. However, I realized that my game design requires me to use CCTransitions to move the user between different instances of CCScene in order to get the visual effect I want. The problem is, I don't want the user controls (like the joystick) to be affected by the CCTransitions- I want them to remain on the screen (in a different part of the screen than the part

Cocos2d move animation on a path

主宰稳场 提交于 2019-12-12 08:44:55
问题 Is it possible in Cocos2d to create a move animation that would go on a specific path? For example, how should I do if I need an object to move on an arc or full circle? Regards! 回答1: Sure you can do this using : ccBezierConfig bezier; bezier.controlPoint_1 = ccp(320,0); // control point 1 bezier.controlPoint_2 =ccp(0,0); // control point 2 bezier.endPosition = ccp(endPoint.x,endPoint.y) ; id bezierForward = [CCBezierTo actionWithDuration:3 bezier:bezier]; [ball runAction:bezierForward]; you

Cocos2d-iPhone or Sparrow for first time 2D iOS game development?

送分小仙女□ 提交于 2019-12-12 08:18:11
问题 I've just gotten basic UIKit down. I've made several personal apps and such, but now I'm ready to move on to a game with some other developers. Both of these frameworks look powerful and have tons of bells and whistles. Does anyone have a preference? Are there pros and cons when compared to each other? They both seem to have similar syntax and performance. 回答1: while working as a game developer specifically for ios, cocos2d is best suitable.Some of the reason are as: 1.Open source and