Java Code Examples for com.watabou.noosa.particles.PixelParticle#reset()

The following examples show how to use com.watabou.noosa.particles.PixelParticle#reset() . 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: 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 2
Source File: Fireball.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set( 
			Random.Float( -40, +40 ), 
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example 3
Source File: Splash.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, 80 ) );
	p.acc.set( 0, +100 );
}
 
Example 4
Source File: Fireball.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set(
			Random.Float( -40, +40 ),
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example 5
Source File: Splash.java    From unleashed-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 6
Source File: Fireball.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set( 
			Random.Float( -40, +40 ), 
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example 7
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 8
Source File: Fireball.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set(
			Random.Float( -40, +40 ),
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example 9
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 10
Source File: NewFireball.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( 0x000000, COLOR ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set( 
			Random.Float( -70, +40 ),
			Random.Float( -60, +70 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example 11
Source File: Fireball.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set( 
			Random.Float( -40, +40 ), 
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example 12
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 13
Source File: Fireball.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set(
			Random.Float( -40, +40 ),
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example 14
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 );
}