v0.8.0: Added a new earth particle type, fixed a bug with rock particles
This commit is contained in:
parent
2925e445b8
commit
2bdb567870
|
@ -243,7 +243,7 @@ public class Speck extends Image {
|
||||||
scale.set( Random.Float( 1, 2 ) );
|
scale.set( Random.Float( 1, 2 ) );
|
||||||
speed.set( 0, 64 );
|
speed.set( 0, 64 );
|
||||||
lifespan = 0.2f;
|
lifespan = 0.2f;
|
||||||
y -= speed.y * lifespan;
|
this.y -= speed.y * lifespan;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NOTE:
|
case NOTE:
|
||||||
|
|
|
@ -36,13 +36,18 @@ public class EarthParticle extends PixelParticle {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final Emitter.Factory FALLING = new Factory() {
|
||||||
|
@Override
|
||||||
|
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||||
|
((EarthParticle)emitter.recycle( EarthParticle.class )).resetFalling( x, y );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public EarthParticle() {
|
public EarthParticle() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
color( ColorMath.random( 0x444444, 0x777766 ) );
|
color( ColorMath.random( 0x444444, 0x777766 ) );
|
||||||
angle = Random.Float( -30, 30 );
|
angle = Random.Float( -30, 30 );
|
||||||
|
|
||||||
lifespan = 0.5f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset( float x, float y ) {
|
public void reset( float x, float y ) {
|
||||||
|
@ -51,7 +56,18 @@ public class EarthParticle extends PixelParticle {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
|
||||||
left = lifespan;
|
left = lifespan = 0.5f;
|
||||||
|
size = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetFalling( float x, float y ) {
|
||||||
|
reset(x, y);
|
||||||
|
|
||||||
|
left = lifespan = 1f;
|
||||||
|
size = 8;
|
||||||
|
|
||||||
|
acc.y = 15;
|
||||||
|
speed.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,6 +75,6 @@ public class EarthParticle extends PixelParticle {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
float p = left / lifespan;
|
float p = left / lifespan;
|
||||||
size( (p < 0.5f ? p : 1 - p) * 16 );
|
size( (p < 0.5f ? p : 1 - p) * size );
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user