示例#1
0
  public void generateExplosion(Vector3f position) {
    ParticleEmitter explosion = new ParticleEmitter("Explosion", ParticleMesh.Type.Triangle, 10);
    Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat_red.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
    explosion.setMaterial(mat_red);
    explosion.setImagesX(2);
    explosion.setImagesY(2); // 2x2 texture animation
    explosion.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red
    explosion.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
    explosion.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
    explosion.setGravity(0, 0, 0);
    explosion.setStartSize(2);
    explosion.setEndSize(4);
    explosion.setLowLife(1);
    explosion.setHighLife(2);
    explosion.setParticlesPerSec(0);
    explosion.getParticleInfluencer().setVelocityVariation(4);
    explosion.setLocalTranslation(position);
    explosions.attachChild(explosion);
    explosion.emitAllParticles();

    explosionAudio.playInstance();
  }
示例#2
0
文件: Duck.java 项目: barthoz/ogogame
 /** Business Logic */
 public void quack(AudioNode audio, boolean force) {
   if (quackable || force) {
     audio.playInstance();
     quackable = false;
   }
 }