some aspects of cocos2d not working with spritebuilder? - ios

I'm fairly new to developing with apple and everything and I just recently got into spritebuilder (or formerly known cocosbuilder) There is this problem that is just boggling my mind.
From this line in XCode:
[_bird runAction:[CCSequence actions:bird_floatAnimation,nil];
when I type CCSequence just about anywhere I get unknown reciever ccsequence, did you mean ccbsequence? same thing with CCRepeatForever. Funny thing is that I can use CCActionMoveTo and CCActionMoveBy and run it and it works fine.
So what happened? This is driving me insane. I am using SpriteBuilder 1.0 with Cocos2d v3.

The solution is so simple! Found the answer here on the spritebuilder forum
To my misunderstanding and ignorance, since cocos2d v3, some of the classes and methods have been renamed so instead of CCSequence its CCActionSeqence..
amazing..

Related

Ccos2d can not found CCMoveTo

I´m starting using cocos2D. In the init function of the helloworld class, I,m trying to create a CCMoveTo object but I can not, it does not find it.
Thanks for the help.
I assume you are either using the latest version of cocos2d and created your project via SpriteBuilder or you are using an older version of cocos2d and created your project via an Xcode template. If so...
If you are using the latest version of cocos2d, but are using learning materials that are older, then things have changed a little. For move actions try using:
CCActionMoveTo
CCActionMoveBy

How to use Cocos2d-Swift in existing project

I got an existing Objective-C project. Now I decided to rewrite some code and add Cocos2d to it. I know this framework for a long time and I recently discovered that they stopped the support for Cocos2d and created a new version called Cocos2d-x. There I found the Swift library and I asked me how to use the Cocos2d-Swift framework in my existing Objective-C project ? A step by step tutorial would be great. I searched a bit in the internet and found this:
Stackoverflow Link
But since the post is from 2011 it does not cover how to add the swift library, since Swift wasn't introduced at this moment.
Cocos2d-swift is a bit of a misnomer : it is currently written in objective-c. The software is now distributed with SpriteBuilder, that is why there is no 'install.sh' as there used to be. So integrating it into your project should not be too difficult. Use SpriteBuilder (from the AppStore) to create a 'blank' SB project, and see how cocos2d is integrated in there. Then, what you see is what you integrate !
caveat : Cocos2d is now ARC, so it is best your project defaults ARC. Otherwise you will have to do a lot of Xcode click-click-click to make the reference count strategy file specific.

Adding Cocos2d to existing project

I would like to appologize in advance however I think this question is overlooked. I have a project I have been working on and I would like to incorporate coco2d. How can I implement the coco2d-iphone-2.0 download. All the tutorials I have tried have either been outdated or left me with errors.
I keep getting ARC Semantic Issue and ARC Restriction once I follow steps of other tutorials to add coco2d to an existing project.
Thus, could someone be so kind as to put a step but step approach to adding the latest stable version of coco2d to an already existing project.
Sorry if this seems trivial.
I think the easiest way would be through cocoapods. have a look at this web site http://cocoapods.org/

Transitioning a project from Cocos2d v1.x to v2.x and then to ARC

I might sound lazy but I am slightly confused on how to proceed on this subject. I have followed this guide which is very well done.
My goal is to convert the Cocos2d v1.x game project to Cocos2d v2.x and then refactor the project code to ARC.
To get started I created an empty HelloWorld Cocos2d v2.x project and created the v2.x static library (as from Steffen's guide). I then rafactored the code to ARC and the HelloWorld worked smoothly.
The issue is when I try to add to the same project the classes I had already written that don't complain to ARC (assuming that there will be not many Cocos2d v2.x vs v1.x problems - e.g. use of deprecated methods and classes like TouchJSON - my project doesn't at least as far I can see). So, I added a couple of Game classes that don't depend from the rest of the game (to reduce the number of potential Cocos2d v2. Vs v1 issues) to the project to see if the ARC covnersion worked for those as a proof of concept. After adding them I choosed: EDIT->Refactor option from XCode.
But now the compiler gives me some ARC warning messages like "ARC forbids explicit message send of autorelease" in the following method:
return [[[self alloc] init] autorelease];
Or similar problems with the dealloc method already written.
I was assuming that EDIT->Refactor would have changed the added code but it appears to work only once. Any hint on this? should I add all my code to the new project template before refactoring the code?
EDIT:To verify whether it was an XCode bug I created an empty iOS project with no Cocos2d libraries and then converted it to ARC. Then created a new empty sublcass of NSObject and added a dealloc method and run the conversion again, it did work! So I might have not followed correctly some of the steps to create and link to the static library..
In addition to this there are some other small issues (not XCode related, but Cocos2d v2.x related), like the fact that the CDXPropertyModifierAction is not automatically included to the CocosDenshion folder and I had to add it to the project after creating the static library (when I noticed the issue).. but I guess this is more template creation related.
Thanks for reading!
so, yeah, I can confirm that the solution in the comment did work. As usual with some IT things is was just about playing around a bit with the various options and see if it works changing the prospective (its not a bug but is me being stupid or lazy).
What worked for me was to use the EDIT->Refactor from the XCode menu and de-select the files created in the first instance by the Cocos2d 2.x template that I had converted after creating the static library (e.g. main.m and AppDelegate.m) (ask if this is unclear).
This converted smoothly all my newly converted Cocos2d 2.x classes into ARC complaint classes and yeah, I have my project fully supporting both Cocos2d 2.x and ARC :).
Please find below the screenshot of the files I deselected to get it working:

using panoramaGL library in ios5 and running HelloPanorama

I've been search around how to setup panoramaGL for a whole day and none of these answers my questions. emm, maybe that's because I am new to ios developing and I start with ios5 with all ARC cool features. I did find a pretty comprehensive guide at http://www.codeproject.com/Articles/60635/Panorama-360-iPod-Touch-iPhone but it's a little bit out of date to me. I cannot follow this guide in xcode 4.3 with ios 5.0 sdk.
Emm, so here is the question, assuming panoramaGL and helloPanorama works perfectly fine in whatever xcode version and sdk version it is created in. Is there a way , without any code modification, I can import the library and using the api along with my app developed in ios5? Of course I don't mind some minor modification and I did dive into those code and comment all the retain or release stuff. but wired errors keep popping up. I really need help here.
If it finally turns out to be impossible to reuse it in ios5.0, I will probably need to write the whole thing line by line with my understand of the complicated panorama algorithm...
Thanks so much for the help!
It seems someone is working on another library based on panoramaGL. Works on IOS 5.
See http://code.google.com/p/tk-panorama/
The new version of PanoramaGL 0.1 r2 was released, please check http://code.google.com/p/panoramagl/. This version runs on iOS >= 4.x and supports Hotspots.
Please check HelloPanoramaGL example

Resources