Is it possible to develop an app mixing UIViewController and iOS specific API elements with Cocos2D views?
A Cocos2D app runs on a UIView and hence I guess it is possible to switch between one view (Cocos2D) and another (iOS), is this correct? Are there any good examples of apps doing this?
The core idea is to develop some graphical animations using Cocos2D and others using UIKit.
Actually you can add any UIView as a subview to CCDirector.sharedDirector().view anytime in a Cocos2D running app.
I bet the only reason you really should mix Cocos2D and UIKit is for creating menus and other UI in UIKit and run game scene using Cocos2D. To do that you can simply find a place where Cocos2D is initialized and replace it with your own UIKit things and then anywhere you want you can run a Cocos2D scene using the code you had replaced. If you want to do that the method you are looking for is
- (void) setupCocos2dWithOptions:(NSDictionary*)config
Maybe consider using SpriteKit since it won't increase the footprint of your app and is already in a very usable state. It uses the same concepts as cocos2d which makes it very easy for you if you know cocos2d already. Also it fits better in the UIKit environment.
Related
I'm currently developing a 2d mobile game for ios using SpriteKit as framework.
I made all animations with adobe after effects and now I have to import them into the app.
Instead of using sequence of texture as recommended by Apple and other tutorial, I read that there is an add-on for after effects named Bodymovin. It exports less frame and a .json file.
Then in Xcode I installed a pod named Lottie to make it works.
Well this is ok for UIViewController.
Someone know if there is a working way to export animations from after effects and make it work simply in SpriteKit?
Thank you
Its called Lottie animations, where you create your vector animations in After effects and download them as JSONs and import it in the iOS app and start using. But there are some serious restrictions to the method such as text effects won't work..
Have a look at the below - https://lottiefiles.com
There is another similar tool that generates core animation code named as Squall. This is a bit advanced than the Lottie. But this method also has its restrictions.
Here is the link for this tool - http://www.marcuseckert.com/squall/
In present situation, other than these two, you may be out of luck in bringing your animations from adobe after effects to sprite kit in iOS.
Does anybody have an idea how the genre selection bubbles in Apple music were made? The movement seems to be done with UiKit Dynamics. I definitely see collision behaviors but can't seem to reproduce the fluidity of the drag movement and the gravity towards the center of the view. I tried using UIPushBehavior and UiSnapBehavior, but no luck.
I don't think that it was done with UIKit Dynamics, I think they was using SpriteKit.
I created a component that's can simulate similar physics
https://github.com/ProudOfZiggy/SIFloatingCollection_Swift
It is possible with UIKitDynamics as well, but can be done with SpriteKit as well which makes it much easier to implement, I have written a small component which give similar kind of effect in Objecti-C using SpriteKit. You can find it here, Its not exactly the same but its near and you can take same approach to create your own or polish it as well.
i have developed it using box2d and libGdx on android,, so using libGdx u can use my code logic for iOS also...
have a look at my project, hope it helps,
https://github.com/mohitKejriwal/Bubble-UI-Android
I would like to create an iPhone/iWatch app featuring a spinning wheel. The spinning wheel will allow the user to control the behaviour of the app and should be touchable; in other words other than spinning (long touch) the wheel should be able to detect short touches.
To design the architecture of this App I have a doubt: should I use UIImage view subclasses only or should I use SpriteKit and mix it with UIKit?
Example of spinning wheel.
Many thanks
On iPhone I've already done this by only using UIKit... And I didn't have any problem with it. So I would answer pure UIKit. On iWatch, I don't have the knowledge to answer you about this part.
You said you want to subclass UIImageView, but I don't think you want to do that. Instead, you should subclass UIView and manage UIImageView instances privately.
Also, if and only if you want to use SpritKit only for that component in your application, you should avoid using it because the less dependency you have, the more happy you are. But it's my personal thought about that.
Several years ago I was curious about creating some objects (spoon, ball, tv, ...) in 3d modeling program, export the textures, and then have a screen in iOS app, that can open one object at a time with a possibility to rotate and zoom it. This seemed quite basic and most used case but I didn't find any simple and ready to use solutions/libraries/plugins, just raw OpenGL ES (GlKit), so I refused to use it, as it would require too much knowledge and time as I haven't done any 3d stuff before and my primary work is not related with 3d.
There are also Unity and Cocos3d engines, and it looks like they allow to extend the code by using iOS plugins (xibs/storyboards, navigation with view controllers and etc), but this means you have to make your app project as Unity/Cocos3d first, and only then add your usual UIKit stuff as a plugin. Now that is not acceptable because the project should be written using UIKit first, and I expect to add 3d viewing stuff as a separate component that encapsulates all the necessary stuff inside it as a black box, because I don't want to mess my project up, as this 3d stuff is an optional feature.
Now, after several years I'v searched for the thing again looking for simple 3d viewing plugins/solutions for UIKit, but the situation is pretty much the same imho. I saw iOS8 there will add Scene Kit, but I'm not sure will it be something close to what I expect. So, still I'm not sure is there any solution that would require minimum time efforts, or is OpenGL ES the best solution for this need.
Check out the CC3DemoMultiScene demo app in the latest version of Cocos3D. It demonstrates how to include a Cocos3D scene in a standard UIKit storyboard, and to have the GL view only a component of a larger UIView.
Right now I am properly and completely implemented Cocos2D and FontLabel (Cocos2D needed file), into my project. I need to use Cocos2D in only one of my UIViews. Does anyone have any tutorials or tips they can give me so I can use Cocos2d like I usually would but just in my UIView in my UIKit app?
The second edition of my book Learn iPhone and iPad Cocos2D Game Development has a chapter on Cocos2D with UIKit integration, both for adding UIKit views to Cocos2D as well as adding Cocos2D to an existing UIKit app.
If you're looking for example code try the UIKit template project provided by Kobold2D, although it doesn't contain the "UIKit app with Cocos2D" example.