Java Code Examples for com.watabou.noosa.particles.Emitter#recycle()

The following examples show how to use com.watabou.noosa.particles.Emitter#recycle() . 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: NewCavesBossLevel.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void emit(Emitter emitter, int index, float x, float y) {
	if (energySourceSprite == null){
		for (Char c : Actor.chars()){
			if (c instanceof Pylon && c.alignment != Char.Alignment.NEUTRAL){
				energySourceSprite = c.sprite;
				break;
			} else if (c instanceof OldDM300){
				energySourceSprite = c.sprite;
			}
		}
		if (energySourceSprite == null){
			return;
		}
	}

	SparkParticle s = ((SparkParticle) emitter.recycle(SparkParticle.class));
	s.resetStatic(x, y);
	s.speed.set((energySourceSprite.x + energySourceSprite.width/2f) - x,
			(energySourceSprite.y + energySourceSprite.height/2f) - y);
	s.speed.normalize().scale(DungeonTilemap.SIZE*2f);

	//offset the particles slightly so they don't go too far outside of the cell
	s.x -= s.speed.x/8f;
	s.y -= s.speed.y/8f;
}
 
Example 2
Source File: Splash.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	PixelParticle p = (PixelParticle)emitter.recycle( PixelParticle.Shrinking.class );
	
	p.reset( x, y, color, 4, Random.Float( 0.5f, 1.0f ) );
	p.speed.polar( Random.Float( dir - cone / 2, dir + cone / 2 ), Random.Float( 40, 80 ) );
	p.acc.set( 0, +100 );
}
 
Example 3
Source File: Splash.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	PixelParticle p = (PixelParticle)emitter.recycle( PixelParticle.Shrinking.class );
	
	p.reset( x, y, color, 4, Random.Float( 0.5f, 1.0f ) );
	p.speed.polar( Random.Float( dir - cone / 2, dir + cone / 2 ), Random.Float( 40, 80 ) );
	p.acc.set( 0, +100 );
}
 
Example 4
Source File: Splash.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	PixelParticle p = (PixelParticle)emitter.recycle( PixelParticle.Shrinking.class );
	
	p.reset( x, y, color, 4, Random.Float( 0.5f, 1.0f ) );
	p.speed.polar( Random.Float( dir - cone / 2, dir + cone / 2 ), Random.Float( 40, 80 ) );
	p.acc.set( 0, +100 );
}
 
Example 5
Source File: Spark.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
    PixelParticle p = (PixelParticle)emitter.recycle( PixelParticle.Shrinking.class );

    p.reset( x, y, color, 4, Random.Float( 0.5f, 1.0f ) );
    p.speed.polar( Random.Float( dir - cone / 2, dir + cone / 2 ), Random.Float( 40, 60 ) );
    p.acc.set( 0, +20 );
}
 
Example 6
Source File: Splash.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	PixelParticle p = (PixelParticle)emitter.recycle( PixelParticle.Shrinking.class );
	
	p.reset( x, y, color, 4, Random.Float( 0.5f, 1.0f ) );
	p.speed.polar( Random.Float( dir - cone / 2, dir + cone / 2 ), Random.Float( 40, 80 ) );
	p.acc.set( 0, +100 );
}
 
Example 7
Source File: LeafParticle.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class ));
	p.color( ColorMath.random( Dungeon.level.color1, Dungeon.level.color2 ) );
	p.reset( x, y );
}
 
Example 8
Source File: CityLevel.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	SmokeParticle p = (SmokeParticle)emitter.recycle( SmokeParticle.class );
	p.reset( x, y );
}
 
Example 9
Source File: SewerLevel.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	WaterParticle p = (WaterParticle)emitter.recycle( WaterParticle.class );
	p.reset( x, y );
}
 
Example 10
Source File: LeafParticle.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class ));
	p.color( ColorMath.random( 0x004400, 0x88CC44 ) );
	p.reset( x, y );
}
 
Example 11
Source File: LeafParticle.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class ));
	p.color( ColorMath.random( 0x004400, 0x88CC44 ) );
	p.reset( x, y );
}
 
Example 12
Source File: CityLevel.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	SmokeParticle p = (SmokeParticle)emitter.recycle( SmokeParticle.class );
	p.reset( x, y );
}
 
Example 13
Source File: SewerLevel.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	WaterParticle p = (WaterParticle)emitter.recycle( WaterParticle.class );
	p.reset( x, y );
}
 
Example 14
Source File: CityLevel.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	SmokeParticle p = (SmokeParticle)emitter.recycle( SmokeParticle.class );
	p.reset( x, y );
}
 
Example 15
Source File: CityLevel.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	SmokeParticle p = (SmokeParticle)emitter.recycle( SmokeParticle.class );
	p.reset( x, y );
}
 
Example 16
Source File: LeafParticle.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class ));
	p.color( ColorMath.random( Dungeon.level.color1, Dungeon.level.color2 ) );
	p.reset( x, y );
}
 
Example 17
Source File: CityLevel.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	SmokeParticle p = (SmokeParticle)emitter.recycle( SmokeParticle.class );
	p.reset( x, y );
}
 
Example 18
Source File: SewerLevel.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	WaterParticle p = (WaterParticle)emitter.recycle( WaterParticle.class );
	p.reset( x, y );
}
 
Example 19
Source File: LeafParticle.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
	LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class ));
	p.color( ColorMath.random( Dungeon.level.color1, Dungeon.level.color2 ) );
	p.reset( x, y );
}
 
Example 20
Source File: BloodSink.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
    BloodParticle p = (BloodParticle)emitter.recycle( BloodParticle.class );
    p.reset( x, y );
}