Posts

Showing posts with the label cocos-2d iPhone

Creating Virtual Controller in Cocos-2d

**ATTENTION** I am currently not so sure if there is a better way to do, but I found this way handy and good for now. I am currently creating an iPhone game using cocos-2d, iphone game library, and I wanted to create a overlay buttons. I found it's easy using 'Menu' of cocos-2d, because they have animation buttons and it's easy to adjust their positions, align and opacity. Problem is, they don't have "Button Down" event. So I create a child class of MenuItem to catch their button-down-event by overriding selected/unselected methods. Here is "VirtualButton.h". #import #import "cocos2d.h" @interface VirtualButton : MenuItemImage { id myTarget; SEL selectedCallback; BOOL pushed; } - (void) setOnClickCallback:(id)target selectedCallback:(SEL)selected_cb; - (void) selected; - (void) unselected; @end and here is "VirtualButton.m'. #import "VirtualButton.h" @implementation VirtualButton - (void) setOnClickCallback:(id)tar...

Ughh.. Xcode!

I am not sure if it is missing or I don't see right place, but when iPhone program throws exception, the debugger shows it is stopped by UNCAUGHT EXCEPTION, but what kind of exception was that. It has been long since I used visual studio on Windows, but I think it could do that. I can't help thinking Visual Studio on Win is better than Xcode on Mac, or is it just matter of experience?

Programing iPhone game using cocos-2d

I am trying to create an iPhone program, for the first time, and this is also my first time creating a program in Xcode, and one more thing, this is my first time to create a game with cocos-2d. So, you know, it is very confusing about everything. I followed this instruction(Whitepaper: Introduction to Cocos2d iPhone) to create a new project onece, and it worked OK. But it was necessary to use new feature on cocos-2d, so I downloaded source code by SVN. It was so annoying to create new project all over again, so I followed this instruction(Creating a new Target-cocos2d-iphone-discuss/Google Group) , and, Ooops! I got into a huge(?) mess. Whenenver I changed a project little bit(even its project name), debugger stops launching OR program crashes on the line [[Director sharedDirector] attachInWindow: window] with UNCAUGHT_EXCEPTION. I spent two annoying days to avoid this problem and I finally give up. My go-around is just create a sub folder inside the cocos-2d and follow the first di...