Question

All is in the question, I've worked enough with cocos2d to say it's a great library but today I only wanna use particle system in a total UIKit project. As long as I know, unfortunately, I have to implement one with OpenGL. Any suggestions ?

Was it helpful?

Solution

You can use Core Animation and CAReplicatorLayer to generate particle systems without having to drop down to OpenGL ES. Joe Ricioppo's "To 1e100f And Beyond with CAReplicatorLayer" gives an introduction to how to use this class. Also, Apple has their ReplicatorDemo sample application, which I ported to the iPad.

On the Mac, there's also the CAEmitterLayer, which became available in iOS as of 5.0. Apple's sample applications for this include Fire, which shows off fire and smoke effects, and Fireworks, which simulates a fireworks display.

OTHER TIPS

For a UIKit-only project you could use Particle Playground (Mac App Store Link) to configure your emitter on your mac in a simulator and the export it as code ready for integration in your project. PP is quite similar to Particle Designer as mentioned by matt.

If you don't want to use a helper so you can dive deeper into the CAEmitter(Layer/Cell) then I would recommend reading this tutorial on Ray Wenderlich's site or this article on Arg! Team's blog. They have helped me a lot in configuring my own emitters.

Full disclosure: I am the developer of Particle Playground. I grew tired of the whole tweak-recompile-observe-loop and developed PP in my spare time.

Note that CAEmitterLayer was added in iOS 5. That makes particle effects much easier.

I haven't used it yet, but I have seen examples that do. I'm not sure how hard Apple's fire sample would be to port to iOS 5. I might just give it a try

I too, find designing particles in UIKit a challenge so I created an app for it. Used it to create various particles in my games now. So easy! It is a iDevice app so you can play with particles while in a bus or at a mall and immediately export out the codes.

If anybody is interested: http://iapps.emirbytes.com/particlex/index.html

In UIKit you build particle systems by using the QuartzCore framework. For a complete example read this post:

http://www.raywenderlich.com/6063/uikit-particle-systems-in-ios-5-tutorial

You should use CAEmitterLayer

Here are some tutorials

Here are some ways to playground it

You should also consider Particle Emitter (http://particledesigner.71squared.com/) which was designed to be used as a cocos2d plug-in.

A tutorial is provided here: http://www.71squared.com/2009/05/iphone-game-programming-tutorial-8-particle-emitter/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top