Fireworks simulation on iPhone

A while ago, i created a pretty basic particle system to create some fireworks, recently i did some changes, and created a simple demo application for the system.

Here is a demo :

Also i’ll add the source code here, asap. Mean while take a look and admire the view ;) .

Fireworks source code – here is a zip with the source code, have fun playing with it, and remember to give me the credits if you use it in your projects ;) .

One Response to “Fireworks simulation on iPhone”

  1. Pete Says:

    I really enjoyed your demo on the Fireworks. Thank you. Is it possible to insert a png of stars to the fireworks rather than the squares you have in your demo? What do I have to do to add that? Thanks for your help. Pete

    Also, this part of the code says that there is potential leak in aFireWork.

    “aFireWork = [[FireWorks alloc]init];” in:

    - (void)resetFireworks:(NSTimer*)theTimer {

    NSLog(@”enter”);

    CGRect currentFrame = fWView_.frame;

    FireWorks *aFireWork;
    aFireWork = [[FireWorks alloc]init];
    aFireWork.origin = CGPointMake(arc4random()%((int)currentFrame.size.width), arc4random()%((int)currentFrame.size.height));
    [aFireWork generateParticles:100];

    [fWView_.fireworks addObject:aFireWork];

    if([fWView_.fireworks count]>10) {
    FireWorks *firstFireWork = [fWView_.fireworks objectAtIndex:0];
    [firstFireWork removeSistem];
    [fWView_.fireworks removeObjectAtIndex:0];
    }
    }

Leave a Reply