Java Code Examples for com.badlogic.gdx.graphics.g2d.ParticleEffect#start()

The following examples show how to use com.badlogic.gdx.graphics.g2d.ParticleEffect#start() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActuatorEntity.java    From Entitas-Java with MIT License 6 votes vote down vote up
public ActuatorEntity addParticleEffectActuator(ParticleEffect effect,
		boolean autoStart, float locaPosX, float locaPosY) {
	ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
	if (component == null) {
		component = new ParticleEffectActuator(effect, autoStart, locaPosX,
				locaPosY);
	} else {
		component.particleEffect = effect;
		component.actuator = (indexOwner) -> {
			GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
			RigidBody rc = owner.getRigidBody();
			Transform transform = rc.body.getTransform();
			effect.setPosition(transform.getPosition().x + locaPosX,
					transform.getPosition().y + locaPosY);
			effect.update(Gdx.graphics.getDeltaTime());
			if (autoStart && effect.isComplete())
				effect.start();
		};
	}
	addComponent(ActuatorComponentsLookup.ParticleEffectActuator, component);
	return this;
}
 
Example 2
Source File: ActuatorEntity.java    From Entitas-Java with MIT License 6 votes vote down vote up
public ActuatorEntity replaceParticleEffectActuator(ParticleEffect effect,
		boolean autoStart, float locaPosX, float locaPosY) {
	ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
	if (component == null) {
		component = new ParticleEffectActuator(effect, autoStart, locaPosX,
				locaPosY);
	} else {
		component.particleEffect = effect;
		component.actuator = (indexOwner) -> {
			GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
			RigidBody rc = owner.getRigidBody();
			Transform transform = rc.body.getTransform();
			effect.setPosition(transform.getPosition().x + locaPosX,
					transform.getPosition().y + locaPosY);
			effect.update(Gdx.graphics.getDeltaTime());
			if (autoStart && effect.isComplete())
				effect.start();
		};
	}
	replaceComponent(ActuatorComponentsLookup.ParticleEffectActuator,
			component);
	return this;
}
 
Example 3
Source File: PlayerSmokeTrails.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public SmokeEffect (TrackEffect owner) {
	this.owner = owner;
	effect = new ParticleEffect();
	effect.load(Gdx.files.internal("data/partfx/smoke-small.p"), Art.particles, "");

	baseEmitter = effect.getEmitters().get(0);

	MaxParticleLifeMinMs = baseEmitter.getLife().getHighMin();
	MaxParticleLifeMaxMs = baseEmitter.getLife().getHighMax();
	OriginalParticleScaling = baseEmitter.getScale().getHighMax();
	// MaxParticlesPerEmitterPerSec = baseEmitter.getEmission().getHighMax();

	effect.start();
}
 
Example 4
Source File: ParticleEffectActuator.java    From Entitas-Java with MIT License 5 votes vote down vote up
public ParticleEffectActuator(ParticleEffect effect, boolean autoStart, float locaPosX, float locaPosY) {
    this.particleEffect = effect;
    this.actuator = (indexOwner)-> {
        GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
        RigidBody rc = owner.getRigidBody();
        Transform transform = rc.body.getTransform();
        effect.setPosition(transform.getPosition().x + locaPosX, transform.getPosition().y + locaPosY);
        effect.update(Gdx.graphics.getDeltaTime());
        if(autoStart && effect.isComplete()) effect.start();

    };
}
 
Example 5
Source File: Particle.java    From Bomberman_libGdx with MIT License 5 votes vote down vote up
public Particle(String particleFileString, float x, float y) {
    particleEffect = new ParticleEffect();
    particleEffect.load(Gdx.files.internal(particleFileString), Gdx.files.internal("particles"));
    particleEffect.setPosition(x, y);
    particleEffect.scaleEffect(1 / GameManager.PPM);
    particleEffect.start();
}
 
Example 6
Source File: LegacyCompareTest.java    From talos with Apache License 2.0 4 votes vote down vote up
public LegacyActor (FileHandle effect, TextureAtlas atlas) {
	particleEffect = new ParticleEffect();
	particleEffect.loadEmitters(effect);
	particleEffect.loadEmitterImages(atlas);
	particleEffect.start();
}