Skip to content

Gamua/Sparrow-Extension-Particle-System

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sparrow Extension: Particle System

The Sparrow Extension class "SXParticleSystem" provides an easy way to display particle systems from within the Sparrow Framework. That way, adding special effects like explosions, smoke, snow, fire, etc. is very easy to do.

The particle system is controlled by a configuration file in the format that is created by Particle Designer. While you don't need that tool to create particle systems, it makes designing them much easier.

Installation

In the src-directory, you will find 2 classes - the SXParticleSystem and a helper class. Add those classes directly to your Sparrow-powered game.

Demo-Project

The demo-directory contains a sample project. If you have configured your system for Sparrow, the project should compile and run out of the box.

The project contains 4 sample configurations. Switch between configurations in Game.m by changing the init-method:

mParticleSystem = [[SXParticleSystem alloc] initWithContentsOfFile:@"sun.pex"];

The following configurations are available:

  • drugs.pex
  • fire.pex
  • sun.pex
  • waterfall.pex

Sample Code

This is all you have to do to create a particle system. The class SXParticleSystem is a subclass of SPDisplayObject and behaves as such. You can add it as a child to the stage or to any other container. As usual, you have to add it to a juggler (or call its advanceTime: method once per frame) to animate it.

// create particle system
SXParticleSystem *ps = [[SXParticleSystem alloc] initWithContentsOfFile:@"sun.pex"];    
ps.x = 160.0f;
ps.y = 240.0f;

// add it to the stage and the juggler
[self addChild:ps];
[self.juggler addObject:ps];
[ps release];

// start emitting particles
[ps start];

// stop emitting particles
[ps stop];

More information

Find more information about this extension on the Sparrow Wiki.

About

A particle system for the Sparrow framework, compatible with the "Particle Designer" from 71squared.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 80.2%
  • C++ 19.8%