cocos2d-iphone

-[CFString retain]: message sent to deallocated instance 0x215076c0

烂漫一生 提交于 2019-12-12 03:44:57
问题 I know this subject has been discussed several times, but I cannot figure out what is causing this error message. I've been stuck here for a couple weeks now and its driving me crazy. The first part of the method sets up a match for 2-4 players. Once a match is found, it tries to add 3 and 4 players within a certain limit. Right now, the limit is just set to 3 seconds, but I envision it being much larger once it is ready for release. I know this is a memory error somewhere in the

Why “CCTextureCache+CCBigImageExtensions” isn't linked in my Kobold2D project?

妖精的绣舞 提交于 2019-12-12 03:42:07
问题 I am using CCBigImage in an iOS/Kobold2d project as the sprite would be too big to be loaded at once. Unfortunately when executing the application it stops with ERROR: Uncaught exception -[CCTextureCache addImageFromAnotherThreadWithName:target:selector:]: unrecognized selector sent to instance 0xa17d010 when loading the plist file into CCBigImage. I nailed it down to the point that CCBigImage* bg = [CCBigImage nodeWithTilesFile:@"bg1dot5.plist" tilesExtension: @"pvr.ccz" tilesZ: 0] calls

Save the high score cocos2d

江枫思渺然 提交于 2019-12-12 03:34:14
问题 I try to explain better the situation. The variables are: int punteggio; CCLabelTTF *labelPunteggio; Then in the init metod i print my score on the screen: - (id)init { if ((self = [super init])) { // PUNTEGGIO labelPunteggio = [CCLabelTTF labelWithString:@"0000" fontName:@"Marker Felt" fontSize:13]; [self addChild:labelPunteggio]; .... } } And this is the function to add score on Punteggio: for example, every time i kill a monster i add 10 point. -(void)aggiungiPunti { punteggio = punteggio

Continuous Scrolling of background in cocos2d

放肆的年华 提交于 2019-12-12 03:33:40
问题 My Code For Continuous Scrolling ...... NSArray *spaceDusts = [NSArray arrayWithObjects:_spacedust1, _spacedust2, nil]; for (CCSprite *spaceDust in spaceDusts) { if ([_backgroundNode convertToWorldSpace:spaceDust.position].x < - spaceDust.contentSize.width) { [_backgroundNode incrementOffset:ccp(2*spaceDust.contentSize.width,0) forChild:spaceDust]; } } Background image size is 1024*384 when rune this into simulator its work properly but when i use in device(iphone) its set the background into

CCJumpBy on a sprite

旧街凉风 提交于 2019-12-12 03:30:50
问题 These are my first Cocos2D projects, I'm trying to make a sprite jump in the same place when touched , but I can't make it response because I don't know how to set touch actions on sprites. Here is the code : -(void) spriteEffect { CCSprite *actionEffect = avatar; id jump = [CCJumpBy actionWithDuration:1 position: ccp(0, 0) height:50 jumps:2]; id sequence = [CCSequence actions: jump, nil]; [actionEffect runAction:sequence]; return yes } Should I use a - (BOOL) ccTouchBegan:(UITouch *)touch

Get the sender touch for ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

醉酒当歌 提交于 2019-12-12 03:21:38
问题 How can i find in a multi touch cocos2d app what was the touch that called ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event ? I can get all the touches using [event allTouches] but how can i find which touch called the function, for example when i would like for that specific touch to display a specific NSLog. 回答1: The touch events provide you with a UITouch* object for each finger. The UITouch* remains the same throughout the whole touch, from began to ended/cancelled. You can

how to disable retina image scaling in cocos2d-x framework

怎甘沉沦 提交于 2019-12-12 03:19:36
问题 I'm porting my android game to osx I'm having problems on devices with retina display, the sprites are either unnececary scaled or the sprites offset are scaled and not in place, I'd like to have a possibility to control this by myself. Is it possible to work in retina mode without scale factor, can I somehow enable usage of a full screen 960x640 and with scale factor still set to 1.0? Could you please tell me how can I do it? 回答1: You can disable retinal display in AppDelegate.cpp file. In

Using CCEaseOut together with CCSequence?

无人久伴 提交于 2019-12-12 03:10:08
问题 I want my action have an effect ease in / ease out, but I already have CCSequence. If I put CCEaseOut in front of my code, movement become weird. Is it possible to make CCEaseOut/CCEaseIn with CCSequence ? Here is my code : [player runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCFadeTo actionWithDuration:2 opacity:255], [CCDelayTime actionWithDuration:1], [CCFadeTo actionWithDuration:7 opacity:0],nil]]; Thanks in advance 回答1: You can use CCEase* with most actions but not

cocos2d load random image from sprite sheet

泄露秘密 提交于 2019-12-12 03:03:16
问题 Ok so I am conceptualizing for a game I want to make and have played a little bit but ran in to a problem. I am learning iOS programming and learning cocos2d also. I have about 20 images. They are all the same size 64x64. Basically they are grouped as 5 different shapes (square, circle, etc.) each in 5 different colors. What I want to be able to do, is randomly drop them down the screen in portrait. There will only ever be one per column falling. There can be duplicates across the screen, I

Block interface until operation is done

人走茶凉 提交于 2019-12-12 02:52:39
问题 I have a login method that connects to a server to check the user info when the user clicks on the login button. How can i block the view showing an activity indicator so that the user does not click on the button again? 回答1: Why don't you just set the userInteractionEnabled to false for the button? btn.userInteractionEnabled = NO; and set it back to YES after the login is completed? You can set this property to every responsive UI element in the view you wish to disable. BTW This off-curse