cocos2d-iphone

RPG Game loop and class structure (cocos2D for iPhone)

落爺英雄遲暮 提交于 2019-12-21 12:45:18
问题 I'm looking to make an RPG with Cocos2D on the iPhone. I've done a fair bit of research, and I really like the model Cocos2D uses for scenes. I can instantiate a scene, set up my characters etc. and it all works really nicely... what I have problems with is structuring a game loop and separating the code from the scenes. For example, where do I put my code that will maintain the state of the game across multiple scenes? and do I put the code for events that get fired in a scene in that scene

Does cocos2d framework work on iPad?

半腔热情 提交于 2019-12-21 10:33:11
问题 Does Cocos2d iPhone framework work on iPad? My guess would be yes, but wanted to check if someone has a definitive answer after porting iPhone project with cocos2d to iPad, or starting a new one. 回答1: Cocos2d v0.99.0-rc was released today which formally supports the iPad. http://www.cocos2d-iphone.org/archives/511 回答2: Apple confirms that all applications available in the app store can be run on iPad See this link: http://www.apple.com/ipad/app-store/ With that said, Cocos2D is just an

Move CCCamera with the ccTouchesMoved method? (cocos2d,iphone)

青春壹個敷衍的年華 提交于 2019-12-21 06:18:20
问题 so I got this working: -(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *myTouch = [touches anyObject]; CGPoint location = [myTouch locationInView:[myTouch view]]; location = [[CCDirector sharedDirector] convertToGL:location]; for( UITouch *touch in touches ) { CGPoint touchLocation = [touch locationInView: [touch view]]; CGPoint prevLocation = [touch previousLocationInView: [touch view]]; touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation];

Move CCCamera with the ccTouchesMoved method? (cocos2d,iphone)

做~自己de王妃 提交于 2019-12-21 06:18:05
问题 so I got this working: -(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *myTouch = [touches anyObject]; CGPoint location = [myTouch locationInView:[myTouch view]]; location = [[CCDirector sharedDirector] convertToGL:location]; for( UITouch *touch in touches ) { CGPoint touchLocation = [touch locationInView: [touch view]]; CGPoint prevLocation = [touch previousLocationInView: [touch view]]; touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation];

Using CCTouchDispatcher Cocos2d 2.0 Beta-2 ARC

落爺英雄遲暮 提交于 2019-12-21 05:41:13
问题 I am creating a game with cocos2d 2.0 BETA 2.0 [The newest one]. And i need to add a joystick in other class. so I call this "CCTouchDispatcher" in my second class. But I can't call like this: [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES]; So I made this one: _tocuhDispatcher = [[CCTouchDispatcher alloc] init]; [_tocuhDispatcher addTargetedDelegate:self priority:0 swallowsTouches:YES]; But still can't detect the touches. If I enable the touches

Using CCTouchDispatcher Cocos2d 2.0 Beta-2 ARC

只愿长相守 提交于 2019-12-21 05:41:06
问题 I am creating a game with cocos2d 2.0 BETA 2.0 [The newest one]. And i need to add a joystick in other class. so I call this "CCTouchDispatcher" in my second class. But I can't call like this: [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES]; So I made this one: _tocuhDispatcher = [[CCTouchDispatcher alloc] init]; [_tocuhDispatcher addTargetedDelegate:self priority:0 swallowsTouches:YES]; But still can't detect the touches. If I enable the touches

Sandbox Game Center Turn Event Notifications Not Consistent

拟墨画扇 提交于 2019-12-21 05:30:22
问题 I'm making a turn-based game, using the Game Center Turn-Based Gaming functionality. I'm using the simulator and my iPhone to test notifications of turn events. The results are very inconsistent. About 75% of the time when I make a move on the simulator and pass the turn I don't get any notifications on my iPhone. It seems that this function doesn't get called: handleTurnEventForMatch:didBecomeActive: I set the GKEventHandlerDelegate in the code that authenticates the local user and it seems

Getting absolute position of CCSprite in cocos2d

↘锁芯ラ 提交于 2019-12-21 05:27:07
问题 In my game, I have a CCSprite that orbits another CCSprite , much like an electron orbiting a nucleus. I have the electron as a child of the nucleus, to make animation much simpler. All I have to do is rotate the nucleus and the electron follows suite quite nicely. However, my problem comes from wanting to have the orbit animation appear a little snazzier, by either adding something like a particle system trail, or a ribbon effect following the path of the electron. I cannot simply add a

Cocos2d portrait mode not working on iPhone

主宰稳场 提交于 2019-12-21 05:06:39
问题 I'm building a cocos2d game which is supposed to be in portrait mode. I changed the RootViewController.m to portrait mode, and everything works fine, both on the simulator and on my iPad. However, when I run the game on my iPhone, it defaults back to landscape mode. Any ideas on how to fix this? Thanks. 回答1: I have a better solution that will work 100%: Replace all the stuff that was in the RootViewController.m / shouldAutorotateToInterfaceOrientation Method with following: return (

Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement)

别来无恙 提交于 2019-12-21 04:27:11
问题 I have a 100% reproducible crash here. Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement). It crashes instantly when pushing the home button. Crash on line 275 in CCGLView.m: if(![_context presentRenderbuffer:GL_RENDERBUFFER]) The itching thing is, I downloaded a fresh copy of official cocos2diphone 2.1 the other second, installed its templates and ran the staple application after hooking it up to the same app id as my problematic app