How do i implement effects in cocos2d? - ios

What is the best and most efficient way to add effects to a game built with cocos2d?
I mean effects like an explosion.
Are they just animation / sprits?
If not, then what should i receive from the designer?

You can run cocos2d project which comes with library and in the top left drop down list you can choose Particle System Test and build it. So you will able to see all basic particle effects cocos2d has.
Also there is a nice application ParticleDesigner, where you can make your nice looking particles and generate a file to add to cocos2d project, it also has a lot of samples, so it would be good for you to download it and see.
And cocos2d supports animations as well, so you can make animations from frames, but of course in the case of explosions particles would look much better

I would take a look at CCParticleSystem and or CCParticleSystemQuad. You or your designer can use tools like ParticleDesigner to create great looking particle effects.

Related

How to create a fluid graph animation in iOS

inspired by the the animated graph from Joe Ski on his dribbles profile I wonder where to start if I want to implement something like this on iOS.
Is CoreGraphics and drawRect combined with NSTimer the right starting point? Where comes CoreAnimation into the game? Or is CorePlot the platform to build on?
Can you please advice me where I have to dig into?
You need to start by exploring the Core Animation framework and have some knowledge about Core Graphics. This is how I would go about it:
Define your shapes with UIBezierPaths
Define the target shapes with different paths
Animate the "path" key with CABasicAnimation between the start and target paths
Happy exploring!
Generally, if you'd like to implement an advanced custom animation, I think you should start with CADisplayLink (and CVDisplayLink for MacOS).
CADisplayLink allows you to intervene every single time the screen is refreshed, e.g: ~60 times/second if you are having 60fps.
If you look at its examples, you'll see that it also gives you timing information so that you don't need to rely on NSTimer which doesn't go well with animations actually.
In you particular case, as Mundi said, CABasicAnimation might be enough as well.
Also, you can follow BAFluidView example on Github which uses CAKeyframeAnimation to achieve something similar.

Cool bubble effect using something like CCParticle in Cocos2d (no third party tools)

I would like to achieve a cool particle effect like in here.
The bubble should be similar to an explosion starting from the centre and expanding. I'd like to add an animated wave coming out from the left and right side of the bubble and looking like this. I guess I could use to two distinct animation and put together as I assume this has never been done in a Cocos2d game.
Also, I would like to avoid using non-Cocos2d tools as particle designer. In chapter 1 of the Cocos2d cookbook I found some cool particle examples and the code doesn't seem too complex. Instead, using third party tools I need to import their classes and use their file format to create particles and I have to pay. Even more there doesn't seem to be many particle effect files shared (at least not the ones I want).
Thanks a lot.
EDIT: I added a comment with a theory on how the first of the two animation could work.
Your best chance is with Particle Designer. You can modify the emitters in the library and visualize your changes. It's the easiest way to achieve a great effect. Once you find the combination of values that you like , you can simply create an emitter from code and set all those properties yourself. You don't have to pay or use any class (which you actually don't have to , it's already built in cocos2D) . So just download the free version of Particle Designer and then set the values from code. It's the same thing , it only takes a bit more work to do.

What options for decent particle effects engines do I have for iOS?

The core question is "what are my options for decent particle effects in an iOS app?"
I wrote an iPad app where I wanted to use a large amount of UIKit objects in the UI and just keep to a native iPad codebase feel. However I wanted nice particle effects, so instead of going with cocos2d and distancing myself from using native objects directly, I wrote my own particle effects engine utilizing quartz. It works, but the performance is very underwhelming.
Do I have to go with an openGL ES solution to get any good performance at all (openGL and uikit view don't play nicely together); Are there any libraries out there that will let me simply add a UIView that contains the particle effects systems layered in my app as I see fit to place it (pretty much what I've tried to do with pretty bad performance)?
(Forgive me if my usage/knowledge of GL is rusty; I've been out of sight for a few months and do not have a strong handle on it.)
I believe they've added particle effects to Core Animation as of iOS 5. Try this video or look up CAEmitterLayer.

Language/Program for simple 2D animation

I want to write something like this: http://www.youtube.com/watch?v=5S4KpCkHDqM I mean, I want to have 2D gaming space, but to have stylized as 3D, so my characters will move on the surface, but will have nice 3D effect. I wounder if Flash/ActionScript will do? Any other suggestions?
Flash and Actionscript can definitely accomplish this. There are at least 2 ways to accomplish the 3D look in 2D space.
The easiest is to do as #Blender said in the comments. Render some 3D images and bring them into flash. There are easy tools in flash to create animated sprites, including a native movieClip class, that has a timeline to play back frame-based animation.
But there is also full 3D in flash. You can bring low-polygon 3D models into flash easily using free and open source libraries such as Away3d (away3d.org) and papervision (papervision3d.org). Presently, flash player 10 has runs slowly when using these libraries.
But Adobe is about to release a new version of the player (version 11) that supports open GL for 3D and has significant performance improvements.
Away3D and papervision have already developed version of their libraries to support the new beta player and openGL.
So to summarize, yes - flash can make a game like that. It is currently the best way to develop games that are intended to be played in a browser. Because at least for the time being it has the most widespread support, and is stable between platforms and browsers.
Your example is pretty much entirely 2D: it just uses effects like shadows, animation and parallax scrolling between layers to achieve a (mildly) 3D effect.
As Plastic Sturgeon and Blender have pointed out, Blender might help for creating your assets - but it has a pretty steep learning curve, and you might be more comfortable 'faking it' in Adobe Illustrator or Photoshop if you've used those before.
Once you've created your assets, you need a platform to put together your gameplay: Flash is one possibility, but you could also look at Unity3D, which has good support for 2D and 3D, and has a browser plug-in if you want to make your game web-based.
If you're looking for a java-based solution, you could try Processing, which is cross-platform, and can export to javascript for web deployment. It's not exactly designed as a gaming environment, but it might do the trick - and it's free.
Hope this helps.

Particle effects in a uiview

I'd like to write/use particle effects in a uiview so I'm thinking of writing a simple one using quartz. It'd be strictly 2d. Am I shooting myself in the foot by not using gl, or are there othet projects or solutions out there that wrap particle systems nicely in a uiview?
Cocos2d for iPhone has some really neat particle effects. Maybe check there? It can run on the Mac too iirc.
From iOS 5, you can use the UIKit Particle System to achieve what you want. Here's a tutorial on that: http://www.raywenderlich.com/6063/uikit-particle-systems-in-ios-5-tutorial
You can add Cocos2d view on the top of all Views, then run cocos2d particle. Check my demo here: https://github.com/lephukhanhhuy/KHParticleView

Resources