cleaned up formatting:
- removed trailing whitespace - changed all leading whitespace to tabs - removed IDE created author comments
This commit is contained in:
@@ -208,9 +208,9 @@ public class BadgeBanner extends Image {
|
||||
break;
|
||||
case 38:
|
||||
p.offset( 5, 5 );
|
||||
break;
|
||||
case 39:
|
||||
p.offset( 5, 4 );
|
||||
break;
|
||||
case 39:
|
||||
p.offset( 5, 4 );
|
||||
break;
|
||||
case 40:
|
||||
case 41:
|
||||
@@ -256,10 +256,10 @@ public class BadgeBanner extends Image {
|
||||
break;
|
||||
}
|
||||
|
||||
p.x *= image.scale.x;
|
||||
p.x *= image.scale.x;
|
||||
p.y *= image.scale.y;
|
||||
p.offset(
|
||||
-image.origin.x * (image.scale.x - 1),
|
||||
p.offset(
|
||||
-image.origin.x * (image.scale.x - 1),
|
||||
-image.origin.y * (image.scale.y - 1) );
|
||||
p.offset( image.point() );
|
||||
|
||||
|
||||
@@ -22,33 +22,33 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
|
||||
public class BannerSprites {
|
||||
|
||||
public enum Type {
|
||||
PIXEL_DUNGEON,
|
||||
BOSS_SLAIN,
|
||||
GAME_OVER,
|
||||
SELECT_YOUR_HERO,
|
||||
PIXEL_DUNGEON_SIGNS
|
||||
};
|
||||
public enum Type {
|
||||
PIXEL_DUNGEON,
|
||||
BOSS_SLAIN,
|
||||
GAME_OVER,
|
||||
SELECT_YOUR_HERO,
|
||||
PIXEL_DUNGEON_SIGNS
|
||||
};
|
||||
|
||||
public static Image get( Type type ) {
|
||||
Image icon = new Image( Assets.BANNERS );
|
||||
switch (type) {
|
||||
case PIXEL_DUNGEON:
|
||||
icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) );
|
||||
break;
|
||||
case BOSS_SLAIN:
|
||||
icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) );
|
||||
break;
|
||||
case GAME_OVER:
|
||||
icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) );
|
||||
break;
|
||||
case SELECT_YOUR_HERO:
|
||||
icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) );
|
||||
break;
|
||||
case PIXEL_DUNGEON_SIGNS:
|
||||
icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) );
|
||||
break;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
public static Image get( Type type ) {
|
||||
Image icon = new Image( Assets.BANNERS );
|
||||
switch (type) {
|
||||
case PIXEL_DUNGEON:
|
||||
icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) );
|
||||
break;
|
||||
case BOSS_SLAIN:
|
||||
icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) );
|
||||
break;
|
||||
case GAME_OVER:
|
||||
icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) );
|
||||
break;
|
||||
case SELECT_YOUR_HERO:
|
||||
icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) );
|
||||
break;
|
||||
case PIXEL_DUNGEON_SIGNS:
|
||||
icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) );
|
||||
break;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ import com.watabou.noosa.Image;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.PointF;
|
||||
|
||||
/**
|
||||
* Created by Evan on 23/05/2015.
|
||||
*/
|
||||
public class Chains extends Group {
|
||||
|
||||
private static final double A = 180 / Math.PI;
|
||||
|
||||
@@ -31,8 +31,8 @@ public class CheckedCell extends Image {
|
||||
|
||||
origin.set( 0.5f );
|
||||
|
||||
point( DungeonTilemap.tileToWorld( pos ).offset(
|
||||
DungeonTilemap.SIZE / 2,
|
||||
point( DungeonTilemap.tileToWorld( pos ).offset(
|
||||
DungeonTilemap.SIZE / 2,
|
||||
DungeonTilemap.SIZE / 2 ) );
|
||||
|
||||
alpha = 0.8f;
|
||||
|
||||
@@ -6,9 +6,6 @@ import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Gizmo;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
/**
|
||||
* Created by Evan on 14/05/2015.
|
||||
*/
|
||||
public class DarkBlock extends Gizmo{
|
||||
|
||||
private CharSprite target;
|
||||
|
||||
@@ -86,10 +86,10 @@ public class Fireball extends Component {
|
||||
bLight.x = x - bLight.width / 2;
|
||||
bLight.y = y - bLight.height / 2;
|
||||
|
||||
emitter.pos(
|
||||
x - bLight.width / 4,
|
||||
y - bLight.height / 4,
|
||||
bLight.width / 2,
|
||||
emitter.pos(
|
||||
x - bLight.width / 4,
|
||||
y - bLight.height / 4,
|
||||
bLight.width / 2,
|
||||
bLight.height / 2 );
|
||||
|
||||
fLight.x = x - fLight.width / 2;
|
||||
@@ -104,8 +104,8 @@ public class Fireball extends Component {
|
||||
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 ),
|
||||
spark.speed.set(
|
||||
Random.Float( -40, +40 ),
|
||||
Random.Float( -60, +20 ) );
|
||||
spark.acc.set( 0, +80 );
|
||||
sparks.add( spark );
|
||||
|
||||
@@ -157,8 +157,8 @@ public class Flare extends Visual {
|
||||
texture.bind();
|
||||
|
||||
script.uModel.valueM4( matrix );
|
||||
script.lighting(
|
||||
rm, gm, bm, am,
|
||||
script.lighting(
|
||||
rm, gm, bm, am,
|
||||
ra, ga, ba, aa );
|
||||
|
||||
script.camera( camera );
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
|
||||
public class IceBlock extends Gizmo {
|
||||
|
||||
private float phase;
|
||||
private float phase;
|
||||
|
||||
private CharSprite target;
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ public class MagicMissile extends Emitter {
|
||||
|
||||
public static class MagicParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((MagicParticle)emitter.recycle( MagicParticle.class )).reset( x, y );
|
||||
@@ -214,7 +214,7 @@ public class MagicMissile extends Emitter {
|
||||
|
||||
public static class EarthParticle extends PixelParticle.Shrinking {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((EarthParticle)emitter.recycle( EarthParticle.class )).reset( x, y );
|
||||
@@ -246,7 +246,7 @@ public class MagicMissile extends Emitter {
|
||||
|
||||
public static class WhiteParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((WhiteParticle)emitter.recycle( WhiteParticle.class )).reset( x, y );
|
||||
@@ -286,7 +286,7 @@ public class MagicMissile extends Emitter {
|
||||
|
||||
private Emitter emitter;
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((SlowParticle)emitter.recycle( SlowParticle.class )).reset( x, y, emitter );
|
||||
@@ -330,7 +330,7 @@ public class MagicMissile extends Emitter {
|
||||
|
||||
public static class ForceParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((ForceParticle)emitter.recycle( ForceParticle.class )).reset( x, y );
|
||||
@@ -368,7 +368,7 @@ public class MagicMissile extends Emitter {
|
||||
|
||||
public static class ColdParticle extends PixelParticle.Shrinking {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((ColdParticle)emitter.recycle( ColdParticle.class )).reset( x, y );
|
||||
|
||||
@@ -58,9 +58,9 @@ public class Speck extends Image {
|
||||
public static final int VENOM = 108;
|
||||
public static final int PARALYSIS = 109;
|
||||
public static final int DUST = 110;
|
||||
public static final int STENCH = 111;
|
||||
public static final int STENCH = 111;
|
||||
public static final int FORGE = 112;
|
||||
public static final int CONFUSION = 113;
|
||||
public static final int CONFUSION = 113;
|
||||
|
||||
private static final int SIZE = 7;
|
||||
|
||||
@@ -104,8 +104,8 @@ public class Speck extends Image {
|
||||
case TOXIC:
|
||||
case VENOM:
|
||||
case PARALYSIS:
|
||||
case STENCH:
|
||||
case CONFUSION:
|
||||
case STENCH:
|
||||
case CONFUSION:
|
||||
case DUST:
|
||||
frame( film.get( STEAM ) );
|
||||
break;
|
||||
@@ -218,7 +218,7 @@ public class Speck extends Image {
|
||||
angularSpeed = Random.Float( -360, +360 );
|
||||
break;
|
||||
|
||||
case ROCK:
|
||||
case ROCK:
|
||||
angle = Random.Float( 360 );
|
||||
angularSpeed = Random.Float( -360, +360 );
|
||||
scale.set( Random.Float( 1, 2 ) );
|
||||
@@ -287,28 +287,28 @@ public class Speck extends Image {
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
|
||||
case STENCH:
|
||||
hardlight( 0x003300 );
|
||||
angularSpeed = -30;
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
case STENCH:
|
||||
hardlight( 0x003300 );
|
||||
angularSpeed = -30;
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
|
||||
case CONFUSION:
|
||||
hardlight( Random.Int( 0x1000000 ) | 0x000080 );
|
||||
angularSpeed = Random.Float( -20, +20 );
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
case CONFUSION:
|
||||
hardlight( Random.Int( 0x1000000 ) | 0x000080 );
|
||||
angularSpeed = Random.Float( -20, +20 );
|
||||
angle = Random.Float( 360 );
|
||||
lifespan = Random.Float( 1f, 3f );
|
||||
break;
|
||||
|
||||
case DUST:
|
||||
hardlight( 0xFFFF66 );
|
||||
angle = Random.Float( 360 );
|
||||
speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) );
|
||||
lifespan = 0.5f;
|
||||
break;
|
||||
case DUST:
|
||||
hardlight( 0xFFFF66 );
|
||||
angle = Random.Float( 360 );
|
||||
speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) );
|
||||
lifespan = 0.5f;
|
||||
break;
|
||||
|
||||
case COIN:
|
||||
case COIN:
|
||||
speed.polar( -PointF.PI * Random.Float( 0.3f, 0.7f ), Random.Float( 48, 96 ) );
|
||||
acc.y = 256;
|
||||
lifespan = -speed.y / acc.y * 2;
|
||||
@@ -340,12 +340,12 @@ public class Speck extends Image {
|
||||
am = p < 0.2f ? p * 5f : (1 - p) * 1.25f;
|
||||
break;
|
||||
|
||||
case KIT:
|
||||
case KIT:
|
||||
case MASTERY:
|
||||
am = 1 - p * p;
|
||||
break;
|
||||
|
||||
case EVOKE:
|
||||
case EVOKE:
|
||||
|
||||
case HEALING:
|
||||
am = p < 0.5f ? 1 : 2 - p * 2;
|
||||
@@ -408,7 +408,7 @@ public class Speck extends Image {
|
||||
case STEAM:
|
||||
case TOXIC:
|
||||
case PARALYSIS:
|
||||
case CONFUSION:
|
||||
case CONFUSION:
|
||||
case DUST:
|
||||
am = p < 0.5f ? p : 1 - p;
|
||||
scale.set( 1 + p * 2 );
|
||||
@@ -416,10 +416,10 @@ public class Speck extends Image {
|
||||
|
||||
case VENOM:
|
||||
hardlight( ColorMath.interpolate( 0x8844FF, 0x00FF00 , p ));
|
||||
case STENCH:
|
||||
am = (p < 0.5f ? p : 1 - p) * 2;
|
||||
scale.set( 1 + p * 2 );
|
||||
break;
|
||||
case STENCH:
|
||||
am = (p < 0.5f ? p : 1 - p) * 2;
|
||||
scale.set( 1 + p * 2 );
|
||||
break;
|
||||
|
||||
case JET:
|
||||
am = (p < 0.5f ? p : 1 - p) * 2;
|
||||
@@ -435,29 +435,29 @@ public class Speck extends Image {
|
||||
}
|
||||
}
|
||||
|
||||
public static Emitter.Factory factory( final int type ) {
|
||||
return factory( type, false );
|
||||
}
|
||||
public static Emitter.Factory factory( final int type ) {
|
||||
return factory( type, false );
|
||||
}
|
||||
|
||||
public static Emitter.Factory factory( final int type, final boolean lightMode ) {
|
||||
public static Emitter.Factory factory( final int type, final boolean lightMode ) {
|
||||
|
||||
Emitter.Factory factory = factories.get( type );
|
||||
Emitter.Factory factory = factories.get( type );
|
||||
|
||||
if (factory == null) {
|
||||
factory = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit ( Emitter emitter, int index, float x, float y ) {
|
||||
Speck p = (Speck)emitter.recycle( Speck.class );
|
||||
p.reset( index, x, y, type );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return lightMode;
|
||||
}
|
||||
};
|
||||
factories.put( type, factory );
|
||||
}
|
||||
if (factory == null) {
|
||||
factory = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit ( Emitter emitter, int index, float x, float y ) {
|
||||
Speck p = (Speck)emitter.recycle( Speck.class );
|
||||
p.reset( index, x, y, type );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return lightMode;
|
||||
}
|
||||
};
|
||||
factories.put( type, factory );
|
||||
}
|
||||
|
||||
return factory;
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Splash {
|
||||
emitter.burst( FACTORY, n );
|
||||
}
|
||||
|
||||
private static final SplashFactory FACTORY = new SplashFactory();
|
||||
private static final SplashFactory FACTORY = new SplashFactory();
|
||||
|
||||
private static class SplashFactory extends Emitter.Factory {
|
||||
|
||||
|
||||
@@ -8,64 +8,61 @@ import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.Image;
|
||||
|
||||
/**
|
||||
* Created by Evan on 20/04/2015.
|
||||
*/
|
||||
public class Surprise extends Image {
|
||||
|
||||
private static final float TIME_TO_FADE = 0.8f;
|
||||
private static final float TIME_TO_FADE = 0.8f;
|
||||
|
||||
private float time;
|
||||
private float time;
|
||||
|
||||
public Surprise() {
|
||||
super(Effects.get(Effects.Type.EXCLAMATION));
|
||||
origin.set(width / 2, height / 2);
|
||||
}
|
||||
public Surprise() {
|
||||
super(Effects.get(Effects.Type.EXCLAMATION));
|
||||
origin.set(width / 2, height / 2);
|
||||
}
|
||||
|
||||
public void reset(int p) {
|
||||
revive();
|
||||
public void reset(int p) {
|
||||
revive();
|
||||
|
||||
x = (p % Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - width) / 2;
|
||||
y = (p / Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - height) / 2;
|
||||
x = (p % Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - width) / 2;
|
||||
y = (p / Level.WIDTH) * DungeonTilemap.SIZE + (DungeonTilemap.SIZE - height) / 2;
|
||||
|
||||
time = TIME_TO_FADE;
|
||||
}
|
||||
time = TIME_TO_FADE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if ((time -= Game.elapsed) <= 0) {
|
||||
kill();
|
||||
} else {
|
||||
float p = time / TIME_TO_FADE;
|
||||
alpha(p);
|
||||
scale.y = 1 + p/2;
|
||||
}
|
||||
}
|
||||
if ((time -= Game.elapsed) <= 0) {
|
||||
kill();
|
||||
} else {
|
||||
float p = time / TIME_TO_FADE;
|
||||
alpha(p);
|
||||
scale.y = 1 + p/2;
|
||||
}
|
||||
}
|
||||
|
||||
public static void hit(Char ch) {
|
||||
hit(ch, 0);
|
||||
}
|
||||
public static void hit(Char ch) {
|
||||
hit(ch, 0);
|
||||
}
|
||||
|
||||
public static void hit(Char ch, float angle) {
|
||||
if (ch.sprite.parent != null) {
|
||||
Surprise s = (Surprise) ch.sprite.parent.recycle(Surprise.class);
|
||||
ch.sprite.parent.bringToFront(s);
|
||||
s.reset(ch.pos);
|
||||
s.angle = angle;
|
||||
}
|
||||
}
|
||||
public static void hit(Char ch, float angle) {
|
||||
if (ch.sprite.parent != null) {
|
||||
Surprise s = (Surprise) ch.sprite.parent.recycle(Surprise.class);
|
||||
ch.sprite.parent.bringToFront(s);
|
||||
s.reset(ch.pos);
|
||||
s.angle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
public static void hit(int pos) {
|
||||
hit(pos, 0);
|
||||
}
|
||||
public static void hit(int pos) {
|
||||
hit(pos, 0);
|
||||
}
|
||||
|
||||
public static void hit(int pos, float angle) {
|
||||
Group parent = Dungeon.hero.sprite.parent;
|
||||
Wound w = (Wound) parent.recycle(Wound.class);
|
||||
parent.bringToFront(w);
|
||||
w.reset(pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
public static void hit(int pos, float angle) {
|
||||
Group parent = Dungeon.hero.sprite.parent;
|
||||
Wound w = (Wound) parent.recycle(Wound.class);
|
||||
parent.bringToFront(w);
|
||||
w.reset(pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,12 +63,12 @@ public class Wound extends Image {
|
||||
}
|
||||
|
||||
public static void hit( Char ch, float angle ) {
|
||||
if (ch.sprite.parent != null) {
|
||||
Wound w = (Wound) ch.sprite.parent.recycle(Wound.class);
|
||||
ch.sprite.parent.bringToFront(w);
|
||||
w.reset(ch.pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
if (ch.sprite.parent != null) {
|
||||
Wound w = (Wound) ch.sprite.parent.recycle(Wound.class);
|
||||
ch.sprite.parent.bringToFront(w);
|
||||
w.reset(ch.pos);
|
||||
w.angle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
public static void hit( int pos ) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class BlastParticle extends PixelParticle.Shrinking {
|
||||
public BlastParticle() {
|
||||
super();
|
||||
|
||||
color( 0xEE7722 );
|
||||
color( 0xEE7722 );
|
||||
acc.set( 0, +50 );
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class BloodParticle extends PixelParticle.Shrinking {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((BloodParticle)emitter.recycle( BloodParticle.class )).reset( x, y );
|
||||
|
||||
@@ -23,9 +23,9 @@ import com.watabou.noosa.particles.Emitter.Factory;
|
||||
import com.watabou.utils.ColorMath;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class EarthParticle extends PixelParticle {
|
||||
public class EarthParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((EarthParticle)emitter.recycle( EarthParticle.class )).reset( x, y );
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.watabou.noosa.particles.Emitter.Factory;
|
||||
|
||||
public class ElmoParticle extends PixelParticle.Shrinking {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((ElmoParticle)emitter.recycle( ElmoParticle.class )).reset( x, y );
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class EnergyParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((EnergyParticle)emitter.recycle( EnergyParticle.class )).reset( x, y );
|
||||
@@ -59,7 +59,7 @@ public class EnergyParticle extends PixelParticle {
|
||||
super.update();
|
||||
|
||||
float p = left / lifespan;
|
||||
am = p < 0.5f ? p * p * 4 : (1 - p) * 2;
|
||||
am = p < 0.5f ? p * p * 4 : (1 - p) * 2;
|
||||
size( Random.Float( 5 * left / lifespan ) );
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import com.watabou.noosa.particles.Emitter.Factory;
|
||||
|
||||
public class FlameParticle extends PixelParticle.Shrinking {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((FlameParticle)emitter.recycle( FlameParticle.class )).reset( x, y );
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class FlowParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((FlowParticle)emitter.recycle( FlowParticle.class )).reset( x, y );
|
||||
@@ -100,7 +100,7 @@ public class FlowParticle extends PixelParticle {
|
||||
|
||||
delay = Random.Float( DELAY );
|
||||
|
||||
((FlowParticle)recycle( FlowParticle.class )).reset(
|
||||
((FlowParticle)recycle( FlowParticle.class )).reset(
|
||||
x + Random.Float( DungeonTilemap.SIZE ), y );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class LeafParticle extends PixelParticle.Shrinking {
|
||||
public static int color2;
|
||||
|
||||
|
||||
public static final Emitter.Factory GENERAL = new Factory() {
|
||||
public static final Emitter.Factory GENERAL = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class ));
|
||||
@@ -39,7 +39,7 @@ public class LeafParticle extends PixelParticle.Shrinking {
|
||||
}
|
||||
};
|
||||
|
||||
public static final Emitter.Factory LEVEL_SPECIFIC = new Factory() {
|
||||
public static final Emitter.Factory LEVEL_SPECIFIC = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
LeafParticle p = ((LeafParticle)emitter.recycle( LeafParticle.class ));
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class PoisonParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory MISSILE = new Factory() {
|
||||
public static final Emitter.Factory MISSILE = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((PoisonParticle)emitter.recycle( PoisonParticle.class )).resetMissile( x, y );
|
||||
@@ -36,7 +36,7 @@ public class PoisonParticle extends PixelParticle {
|
||||
};
|
||||
};
|
||||
|
||||
public static final Emitter.Factory SPLASH = new Factory() {
|
||||
public static final Emitter.Factory SPLASH = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((PoisonParticle)emitter.recycle( PoisonParticle.class )).resetSplash( x, y );
|
||||
|
||||
@@ -26,14 +26,14 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class PurpleParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory MISSILE = new Factory() {
|
||||
public static final Emitter.Factory MISSILE = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((PurpleParticle)emitter.recycle( PurpleParticle.class )).reset( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
public static final Emitter.Factory BURST = new Factory() {
|
||||
public static final Emitter.Factory BURST = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((PurpleParticle)emitter.recycle( PurpleParticle.class )).resetBurst( x, y );
|
||||
|
||||
+35
-38
@@ -5,56 +5,53 @@ import com.watabou.noosa.particles.PixelParticle;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
/**
|
||||
* Created by Evan on 11/04/2015.
|
||||
*/
|
||||
public class RainbowParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory BURST = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((RainbowParticle)emitter.recycle( RainbowParticle.class )).resetBurst( x, y );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
public static final Emitter.Factory BURST = new Emitter.Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((RainbowParticle)emitter.recycle( RainbowParticle.class )).resetBurst( x, y );
|
||||
}
|
||||
@Override
|
||||
public boolean lightMode() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public RainbowParticle() {
|
||||
super();
|
||||
color( Random.Int( 0x1000000 ) );
|
||||
lifespan = 0.5f;
|
||||
}
|
||||
public RainbowParticle() {
|
||||
super();
|
||||
color( Random.Int( 0x1000000 ) );
|
||||
lifespan = 0.5f;
|
||||
}
|
||||
|
||||
|
||||
public void reset( float x, float y ) {
|
||||
revive();
|
||||
public void reset( float x, float y ) {
|
||||
revive();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
speed.set( Random.Float(-5, +5), Random.Float( -5, +5 ) );
|
||||
speed.set( Random.Float(-5, +5), Random.Float( -5, +5 ) );
|
||||
|
||||
left = lifespan;
|
||||
}
|
||||
left = lifespan;
|
||||
}
|
||||
|
||||
public void resetBurst( float x, float y ) {
|
||||
revive();
|
||||
public void resetBurst( float x, float y ) {
|
||||
revive();
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) );
|
||||
speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) );
|
||||
|
||||
left = lifespan;
|
||||
}
|
||||
left = lifespan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
// alpha: 1 -> 0; size: 1 -> 5
|
||||
size( 5 - (am = left / lifespan) * 4 );
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
// alpha: 1 -> 0; size: 1 -> 5
|
||||
size( 5 - (am = left / lifespan) * 4 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,21 +26,21 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class ShadowParticle extends PixelParticle.Shrinking {
|
||||
|
||||
public static final Emitter.Factory MISSILE = new Factory() {
|
||||
public static final Emitter.Factory MISSILE = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((ShadowParticle)emitter.recycle( ShadowParticle.class )).reset( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
public static final Emitter.Factory CURSE = new Factory() {
|
||||
public static final Emitter.Factory CURSE = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((ShadowParticle)emitter.recycle( ShadowParticle.class )).resetCurse( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
public static final Emitter.Factory UP = new Factory() {
|
||||
public static final Emitter.Factory UP = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((ShadowParticle)emitter.recycle( ShadowParticle.class )).resetUp( x, y );
|
||||
@@ -88,6 +88,6 @@ public class ShadowParticle extends PixelParticle.Shrinking {
|
||||
float p = left / lifespan;
|
||||
// alpha: 0 -> 1 -> 0; size: 6 -> 0; color: 0x660044 -> 0x000000
|
||||
color( ColorMath.interpolate( 0x000000, 0x440044, p ) );
|
||||
am = p < 0.5f ? p * p * 4 : (1 - p) * 2;
|
||||
am = p < 0.5f ? p * p * 4 : (1 - p) * 2;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class ShaftParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((ShaftParticle)emitter.recycle( ShaftParticle.class )).reset( x, y );
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class SnowParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((SnowParticle)emitter.recycle( SnowParticle.class )).reset( x, y );
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class SparkParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((SparkParticle)emitter.recycle( SparkParticle.class )).reset( x, y );
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class WebParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
for (int i=0; i < 3; i++) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class WindParticle extends PixelParticle {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((WindParticle)emitter.recycle( WindParticle.class )).reset( x, y );
|
||||
@@ -103,8 +103,8 @@ public class WindParticle extends PixelParticle {
|
||||
|
||||
delay = Random.Float( 5 );
|
||||
|
||||
((WindParticle)recycle( WindParticle.class )).reset(
|
||||
x + Random.Float( DungeonTilemap.SIZE ),
|
||||
((WindParticle)recycle( WindParticle.class )).reset(
|
||||
x + Random.Float( DungeonTilemap.SIZE ),
|
||||
y + Random.Float( DungeonTilemap.SIZE ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class WoolParticle extends PixelParticle.Shrinking {
|
||||
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
public static final Emitter.Factory FACTORY = new Factory() {
|
||||
@Override
|
||||
public void emit( Emitter emitter, int index, float x, float y ) {
|
||||
((WoolParticle)emitter.recycle( WoolParticle.class )).reset( x, y );
|
||||
|
||||
Reference in New Issue
Block a user