Back to project page libgdx-demo-pax-britannica.
The source code is released under:
Copyright (c) 2010 Ben Abraham, Renaud B?dard, Henk Boom, Daniel Burton, Matthew Gallant Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ...
If you think the Android project libgdx-demo-pax-britannica listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.swagner.paxbritannica.particlesystem; /*from w w w . j a va2s. c o m*/ import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; import de.swagner.paxbritannica.Resources; public class SparkParticleEmitter extends ParticleEmitter { Vector2 particleVelocity = new Vector2(); public SparkParticleEmitter() { super(); life = 1.0f; damping =5.95f; set(Resources.getInstance().spark); } public void addLaserExplosion(Vector2 position, Vector2 velocity) { for (int i = 1; i <= 10; ++i) { random.set(MathUtils.cos((float) ((MathUtils.random() * MathUtils.PI * 2f) * Math.sqrt(MathUtils.random()))), (float) (MathUtils.sin(MathUtils.random() * MathUtils.PI * 2f) * Math.sqrt(MathUtils.random()))); particleVelocity.set(-velocity.x + random.x, -velocity.y + random.y); addParticle(position, particleVelocity, 1f, 1); } } }