Question

As part of a current project I've been asked to display a candle onscreen. Users should be able to tilt the device to tilt the flame, and perform an action (eg. tap) to blow out the flame. I'm at a real loss on how to achieve this. Some ideas I've had:

  • purchase a movie of a candle from a stock video site. This won't let me tilt or blow out the flame though
  • obtain a number of frames and animate them to give the appearance of a flickering flame
  • use some form of particle emitter

I guess my preference would probably be to use the particle emitter, as I can't see the video working and getting the necessary assets for the frame animation could be a problem. I know Cocos2D has a particle emitter, but this is part of a larger UIKit project which can't be ripped apart and started again to build on top of Cocos2D.

Does anyone have any ideas on how I can achieve this?

Was it helpful?

Solution

You could look at the Nehe tutorial on particle generation:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=19

It wouldn't be hard to adapt this to produce something that looks like a candle.

(You can embed a GL view inside another view for this.)

OTHER TIPS

For a previous project we had a website that had to "burn" to reveal the new website underneath. This was accomplished by recording the image of a burning piece of paper and then getting someone that was good at graphic manipulation to clean up and loop the video - this was done in Flash.

What you could do is apply this technique to your candle video. Figure out the shots you need to take to simulate all the states you want to create, including tilting and blowing the flame out, and record them. Then pass this off to someone that can create the animation loops.

Obviously something like this is going to cost a bit of money, but it's going to create the best result.

Realistic flames are really hard using a graphic engine and it's going to look fake - unless you've got a large budget.

This isn't really an Objective-C question. What you need is an introduction to writing OpenGL shaders.

You may still be able to use a particle generator in GL and run it in a layer on top of your other interface so you won't have to rip apart your whole app. I have seen some people complain about performance mixing these methodologies, but for a simple case it should work fine.

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