I have worked of couple of iOS apps using Objective-C and XCode. Most of my apps are children's interactive books, completely written in Objective-C and all interactive animations are UIView based. In my next book, I would like to add some Physics based animations. What are my best options? I have never worked on Cocos2D or used any other physics based animations engines. I recently started reading about Chipmunk physics based animation engine. Should I be using Chipmunk along with Objective-C for achieving physics based animations or consider switching to Cocos2D? I am not considering game development at the moment. I would greatly appreciate your suggestions/advice.
Thanks,
Ramesh.
You can use Chipmunk without Cocos2d as you can see from its examples.
But i would recommend using Cocos2d along with Chipmunk. Cocos2d comes with a project template with Chipmunk, there are a lot of examples and all.
We did an interactive book with Cocos2d and Chipmunk with a lot of physics interactions and it works just great.
Related
EDIT: To make the question clearer, I'll quote what Chris said in the comment, the question is "How can I do on OS X what UIKit Dynamics does on iOS?"
I want to add gravity effect to my UI elements in my OS X app, and I wonder if there are some best practices?
If I were developing an iOS app, I would turn to dynamic features introduced to UIKit in iOS7, but I couldn't find anything like that in AppKit. I've even tried to use Sprite Kit in a AppKit based app for its physics simulation, but I couldn't find a way to remove the annoying grey background in SKView even when I've set background to SKColor.clearColor().
So, I wonder if adding gravity is really that hard? Is there any best practices? I've found some apps, like Pixelmator, integrated some cool gravity features, so I guess that's possible? Can anyone help me out of here? Big thanks!
A small discussion: with the release of OS X 10.10, Apple is abandoning skeuomorphism, so is it still a good idea in design to add physics simulation in your app? Like the rope effect in Pixelmator app?
I am pretty new to making games, but I am pretty familiar with programing iOS. I am creating a shape matching game, so there would be an array of different shapes and the user would drag the shape to the correct corresponding shape if they get it right it would stay and if they get it wrong it would shoot back. Now my question is would that be easier using cocso2d or any game engine or would it be just as easy not using one, just using a touch event?
Since the game you are describing is not graphically intense - I would recommend using UIKit. Couple of reasons why I would use UIKit over cocos2d:
Interface builder / Storyboards are awesome. You can lay out your
screens and game elements on screen. (I know tools exist to do this
using cocos like CocosBuilder, but IMO they just don't compare to
working directly in XCode)
UIKit animations couldn't be easier and you can do some pretty powerful things with minimal code.
You have direct access elements such as UITableView, UICollectionView, UIScrollView, etc. There are cocos nodes that mimic these, but they don't match up in terms of response and behavior.
For more graphically intense games I would still use cocos2d hands down. Some scenarios when you would use it:
You have a large number of sprites with a large number of animations (opengl is fast)
You want to use opengl based effects like particles, lighting, etc.
You need a physics engine
You want to work off a prebuilt game engine (there are tons such as levelsvg, kobold2d, line starter kit, etc)
Hope this helps you.
I've created many types of interfaces using the Cocoa API — some of them using documented basic animation techniques and others simply by experimenting (such as placing an animated .gif inside an NSImage class) — which had somewhat catastrophic consequences. The question I have is what is the correct or the most effective way to create an animated and dynamic GUI so that it runs optimally and properly?
The closest example I can think of that would use a similar type of animation would be something one might see done in flash on any number of interactive websites or interfaces. I'm sure flash can be used in a Cocoa app, although if there is a way to achieve a similar result without re-inventing the wheel, or having to use 3rd party SDKs, I would love to get some input. Keep in mind I'm not just thinking of animation for games, iOS, etc. — I'm most interested in an animated GUI for Mac OS X, and making it 'flow' as one might interact in it.
If u wish to add many graphics animations, then go for OpenGLES based xcode project for iOS. That helps u to reduce performance problem. You can render each of the frames in gif as 2D texture.
I would recommend that you take a look at Core Animation. It is Apples framework for hardware accelerated animations for both OS X and iOS. It's built for making animated GUIs.
You can animate the property changes for things like position, opacity, color, transforms etc and also animate gradients with CAGradientLayer and animate non-rectagunal shapes using CAShapeLayer and a lot of other things.
A good resource to get you started is the Core Animation Programming Guide.
I'm working in Objective-C for a Mac cocoa application. It's a pretty simple question, but I can't find an answer. I just want to move a sprite across the screen, like in a Snake game. Do I need to use NSTimer or NSAnimation, and how would I use it?
Thanks
You could use Core Animation. It provides a unified way to move and animate visual elements on the screen.
If you plan to create a simple game, "Cocoa with Love" has a nice "Asteroid" example:
http://cocoawithlove.com/2009/02/asteroids-style-game-in-coreanimation.html
Another game-related Core Animation project is Apple's Geek Game Board:
http://developer.apple.com/library/mac/#samplecode/GeekGameBoard/Introduction/Intro.html
Well, actually it depends on how you imagined your application, there's a lot of way to make things move. If you do not need anything complex or particularly efficient you may just access and modify the NSView frame property. Otherwise you should consider use Core Animation or OpenGL.
Core Animation Programming Guide
OpenGL Programming Guide for MacOSX
I'm new in iPhone development, and I want to make a custom Reel/Spinner like the Reel in many iPhone fishing games, and I want capture the touch events, such as if the reel is moved to the right/left.
Where should I start?
Thank You!
I would look at using OpenGL ES.
On the other hand, you can often get very good results with just old fashion "flipbook" animation created by simply displaying slightly different images in sequence.
If you're just starting out, I would suggest you go over the MoveMe application tutorial. It will teach you many of the fundamentals of detecting touch events and responding using animations. If you need another sample, you can also have a look at the Touches sample.
Once you feel comfortable with detecting touch events, I would look into Core Animation. The Cookbook has a lot of examples on how to do many different tasks. The Animation Programming Guide also has some valuable information as to how to do various types of animations.
If you have any specific questions while figuring things out, post them here, and welcome to Stack Overflow!