zoukankan      html  css  js  c++  java
  • Starling 粒子particlesystem 使用实例

    转自:http://wiki.starling-framework.org/extensions/particlesystem

    // embed configuration XML
    [Embed(source="fire.pex", mimeType="application/octet-stream")]
    private static const FireConfig:Class;
     
    // embed particle texture
    [Embed(source = "fire_particle.png")]
    private static const FireParticle:Class;
     
    // instantiate embedded objects
    var psConfig:XML = XML(new FireConfig());
    var psTexture:Texture = Texture.fromBitmap(new FireParticle());
     
    // create particle system
    var ps:PDParticleSystem = new PDParticleSystem(psConfig, psTexture);
    ps.x = 160;
    ps.y = 240;
     
    // add it to the stage and the juggler
    addChild(ps);
    Starling.juggler.add(ps);
     
    // change position where particles are emitted
    ps.emitterX = 20;
    ps.emitterY = 40;
     
    // start emitting particles
    ps.start();
     
    // emit particles for two seconds, then stop
    ps.start(2.0);
     
    // stop emitting particles; on restart, it will continue from the current state
    ps.pause();
     
    // stop emitting particles; on restart, it will start from scratch
    ps.stop();
  • 相关阅读:
    BETA 版冲刺前准备
    alpha事后诸葛亮
    alpha冲刺10
    alpha冲刺9
    alpha冲刺8
    alpha冲刺7
    alpha冲刺6
    alpha冲刺5
    第十一次作业
    Alpha冲刺一 (10/10)
  • 原文地址:https://www.cnblogs.com/sevenyuan/p/2871616.html
Copyright © 2011-2022 走看看