Code Monkey home page Code Monkey logo

starling-extension-particle-system's Introduction

Starling Extension: Particle System

The Starling Particle System classes provide an easy way to display particle systems from within the Starling Framework. That way, adding special effects like explosions, smoke, snow, fire, etc. is very easy to do.

The extension consists of three classes:

  1. Particle: stores the state of a particle, like its position and color
  2. ParticleSystem: the base class for particle systems. Implements a very simple particle movement. To create a custom particle system, extend this class and override the methods createParticle, initParticle, and advanceParticle.
  3. PDParticleSystem: a particle system subclass that can display particle systems created with the Particle Designer from 71squared.

Installation

Which version to download depends on the Starling version you are using:

  • If you work with a release version of Starling, download the Particle System with the equivalent tag (Starling 1.1 -> Particle System 1.1).
  • If you work with the latest development version of Starling, download the head revision of the Particle System.

After downloading, you will find the three classes described above in the src-directory. You can either copy them directly to your Starling-powered application, or you add the source path to your FlexBuilder project.

Demo-Project

The demo-directory contains a sample project. To compile it, add a reference to the Starling library and add the source directory that contains the particle system classes.

The project contains 4 sample configurations. Switch between configurations in Demo.as by hitting the space bar.

Sample Code

The class ParticleSystem extends DisplayObject and behaves accordingly. You can add it as a child to the stage or 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
mParticleSystem = new PDParticleSystem(psConfig, psTexture);
mParticleSystem.emitterX = 320;
mParticleSystem.emitterY = 240;

// add it to the stage and the juggler
addChild(mParticleSystem);
Starling.juggler.add(mParticleSystem);

// start emitting particles
mParticleSystem.start();

// stop emitting particles
mParticleSystem.stop();

More information

You can find more information in the Starling Wiki.

starling-extension-particle-system's People

Contributors

alex-zhang avatar ericsoco avatar kutu avatar primaryfeather avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.