V0.1.0 Partial Commit

changed package and application names to differentiate from main PD
release
This commit is contained in:
Evan Debenham
2014-08-03 14:46:22 -04:00
parent 65dd9c2dc0
commit aed303672a
474 changed files with 3468 additions and 3458 deletions
@@ -0,0 +1,60 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
public class BloodParticle extends PixelParticle.Shrinking {
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 );
}
};
public BloodParticle() {
super();
color( 0xCC0000 );
lifespan = 0.8f;
acc.set( 0, +40 );
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
size = 4;
speed.set( 0 );
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = p > 0.6f ? (1 - p) * 2.5f : 1;
}
}
@@ -0,0 +1,60 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.ColorMath;
import com.watabou.utils.Random;
public class EarthParticle extends PixelParticle {
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 );
}
};
public EarthParticle() {
super();
color( ColorMath.random( 0x444444, 0x777766 ) );
angle = Random.Float( -30, 30 );
lifespan = 0.5f;
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
}
@Override
public void update() {
super.update();
float p = left / lifespan;
size( (p < 0.5f ? p : 1 - p) * 16 );
}
}
@@ -0,0 +1,64 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
public class ElmoParticle extends PixelParticle.Shrinking {
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 );
}
@Override
public boolean lightMode() {
return true;
};
};
public ElmoParticle() {
super();
color( 0x22EE66 );
lifespan = 0.6f;
acc.set( 0, -80 );
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
size = 4;
speed.set( 0 );
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = p > 0.8f ? (1 - p) * 5 : 1;
}
}
@@ -0,0 +1,65 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class EnergyParticle extends PixelParticle {
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 );
}
@Override
public boolean lightMode() {
return true;
};
};
public EnergyParticle() {
super();
lifespan = 1f;
color( 0xFFFFAA );
speed.polar( Random.Float( 2 * PointF.PI ), Random.Float( 24, 32 ) );
}
public void reset( float x, float y ) {
revive();
left = lifespan;
this.x = x - speed.x * lifespan;
this.y = y - speed.y * lifespan;
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = p < 0.5f ? p * p * 4 : (1 - p) * 2;
size( Random.Float( 5 * left / lifespan ) );
}
}
@@ -0,0 +1,64 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
public class FlameParticle extends PixelParticle.Shrinking {
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 );
}
@Override
public boolean lightMode() {
return true;
};
};
public FlameParticle() {
super();
color( 0xEE7722 );
lifespan = 0.6f;
acc.set( 0, -80 );
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
size = 4;
speed.set( 0 );
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = p > 0.8f ? (1 - p) * 5 : 1;
}
}
@@ -0,0 +1,109 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class FlowParticle extends PixelParticle {
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 );
}
};
public FlowParticle() {
super();
lifespan = 0.6f;
acc.set( 0, 32 );
angularSpeed = Random.Float( -360, +360 );
}
public void reset( float x, float y ) {
revive();
left = lifespan;
this.x = x;
this.y = y;
am = 0;
size( 0 );
speed.set( 0 );
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = (p < 0.5f ? p : 1 - p) * 0.6f;
size( (1 - p) * 4 );
}
public static class Flow extends Group {
private static final float DELAY = 0.1f;
private int pos;
private float x;
private float y;
private float delay;
public Flow( int pos ) {
super();
this.pos = pos;
PointF p = DungeonTilemap.tileToWorld( pos );
x = p.x;
y = p.y + DungeonTilemap.SIZE - 1;
delay = Random.Float( DELAY );
}
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
super.update();
if ((delay -= Game.elapsed) <= 0) {
delay = Random.Float( DELAY );
((FlowParticle)recycle( FlowParticle.class )).reset(
x + Random.Float( DungeonTilemap.SIZE ), y );
}
}
}
}
}
@@ -0,0 +1,69 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.watabou.utils.ColorMath;
import com.watabou.utils.Random;
public class LeafParticle extends PixelParticle.Shrinking {
public static int color1;
public static int color2;
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 ));
p.color( ColorMath.random( 0x004400, 0x88CC44 ) );
p.reset( x, y );
}
};
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 ));
p.color( ColorMath.random( Dungeon.level.color1, Dungeon.level.color2 ) );
p.reset( x, y );
}
};
public LeafParticle() {
super();
lifespan = 1.2f;
acc.set( 0, 25 );
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
speed.set( Random.Float( -8, +8 ), -20 );
left = lifespan;
size = Random.Float( 2, 3 );
}
}
@@ -0,0 +1,88 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.ColorMath;
import com.watabou.utils.Random;
public class PoisonParticle extends PixelParticle {
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 );
}
@Override
public boolean lightMode() {
return true;
};
};
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 );
}
@Override
public boolean lightMode() {
return true;
};
};
public PoisonParticle() {
super();
lifespan = 0.6f;
acc.set( 0, +30 );
}
public void resetMissile( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
speed.polar( Random.Float( 3.1415926f ), Random.Float( 6 ) );
}
public void resetSplash( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
speed.polar( Random.Float( 3.1415926f ), Random.Float( 10, 20 ) );
}
@Override
public void update() {
super.update();
// alpha: 1 -> 0; size: 1 -> 4
size( 4 - (am = left / lifespan) * 3 );
// color: 0x8844FF -> 0x00FF00
color( ColorMath.interpolate( 0x00FF00, 0x8844FF, am ) );
}
}
@@ -0,0 +1,82 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.ColorMath;
import com.watabou.utils.Random;
public class PurpleParticle extends PixelParticle {
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() {
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
((PurpleParticle)emitter.recycle( PurpleParticle.class )).resetBurst( x, y );
}
@Override
public boolean lightMode() {
return true;
}
};
public PurpleParticle() {
super();
lifespan = 0.5f;
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
speed.set( Random.Float( -5, +5 ), Random.Float( -5, +5 ) );
left = lifespan;
}
public void resetBurst( float x, float y ) {
revive();
this.x = x;
this.y = y;
speed.polar( Random.Float( 360 ), Random.Float( 16, 32 ) );
left = lifespan;
}
@Override
public void update() {
super.update();
// alpha: 1 -> 0; size: 1 -> 5
size( 5 - (am = left / lifespan) * 4 );
// color: 0xFF0044 -> 0x220066
color( ColorMath.interpolate( 0x220066, 0xFF0044, am ) );
}
}
@@ -0,0 +1,93 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.ColorMath;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class ShadowParticle extends PixelParticle.Shrinking {
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() {
@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() {
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
((ShadowParticle)emitter.recycle( ShadowParticle.class )).resetUp( x, y );
}
};
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
speed.set( Random.Float( -5, +5 ), Random.Float( -5, +5 ) );
size = 6;
left = lifespan = 0.5f;
}
public void resetCurse( float x, float y ) {
revive();
size = 8;
left = lifespan = 0.5f;
speed.polar( Random.Float( 2 * PointF.PI ), Random.Float( 16, 32 ) );
this.x = x - speed.x * lifespan;
this.y = y - speed.y * lifespan;
}
public void resetUp( float x, float y ) {
revive();
speed.set( Random.Float( -8, +8 ), Random.Float( -32, -48 ) );
this.x = x;
this.y = y;
size = 6;
left = lifespan = 1f;
}
@Override
public void update() {
super.update();
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;
}
}
@@ -0,0 +1,66 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.Random;
public class ShaftParticle extends PixelParticle {
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 );
}
@Override
public boolean lightMode() {
return true;
}
};
public ShaftParticle() {
super();
lifespan = 1.2f;
speed.set( 0, -6 );
}
private float offs;
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
offs = -Random.Float( lifespan );
left = lifespan - offs;
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = p < 0.5f ? p : 1 - p;
scale.x = (1 - p) * 4;
scale.y = 16 + (1 - p) * 16;
}
}
@@ -0,0 +1,55 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.Random;
public class SnowParticle extends PixelParticle {
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 );
}
};
public SnowParticle() {
super();
speed.set( 0, Random.Float( 5, 8 ) );
lifespan = 1.2f;
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y - speed.y * lifespan;
left = lifespan;
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = (p < 0.5f ? p : 1 - p) * 1.5f;
}
}
@@ -0,0 +1,62 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.Random;
public class SparkParticle extends PixelParticle {
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 );
}
@Override
public boolean lightMode() {
return true;
};
};
public SparkParticle() {
super();
size( 2 );
acc.set( 0, +50 );
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan = Random.Float( 0.5f, 1.0f );
speed.polar( Random.Float( 3.1415926f ), Random.Float( 20, 40 ) );
}
@Override
public void update() {
super.update();
size( Random.Float( 5 * left / lifespan ) );
}
}
@@ -0,0 +1,61 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.Random;
public class WebParticle extends PixelParticle {
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++) {
((WebParticle)emitter.recycle( WebParticle.class )).reset( x, y );
}
}
};
public WebParticle() {
super();
color( 0xCCCCCC );
lifespan = 2f;
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
angle = Random.Float( 360 );
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = p < 0.5f ? p : 1 - p;
scale.y = 16 + p * 8;
}
}
@@ -0,0 +1,114 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class WindParticle extends PixelParticle {
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 );
}
};
private static float angle = Random.Float( PointF.PI * 2 );
private static PointF speed = new PointF().polar( angle, 5 );
private float size;
public WindParticle() {
super();
lifespan = Random.Float( 1, 2 );
scale.set( size = Random.Float( 3 ) );
}
public void reset( float x, float y ) {
revive();
left = lifespan;
super.speed.set( WindParticle.speed );
super.speed.scale( size );
this.x = x - super.speed.x * lifespan / 2;
this.y = y - super.speed.y * lifespan / 2;
angle += Random.Float( -0.1f, +0.1f );
speed = new PointF().polar( angle, 5 );
am = 0;
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = (p < 0.5f ? p : 1 - p) * size * 0.2f;
}
public static class Wind extends Group {
private int pos;
private float x;
private float y;
private float delay;
public Wind( int pos ) {
super();
this.pos = pos;
PointF p = DungeonTilemap.tileToWorld( pos );
x = p.x;
y = p.y;
delay = Random.Float( 5 );
}
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
super.update();
if ((delay -= Game.elapsed) <= 0) {
delay = Random.Float( 5 );
((WindParticle)recycle( WindParticle.class )).reset(
x + Random.Float( DungeonTilemap.SIZE ),
y + Random.Float( DungeonTilemap.SIZE ) );
}
}
}
}
}
@@ -0,0 +1,54 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.ColorMath;
import com.watabou.utils.Random;
public class WoolParticle extends PixelParticle.Shrinking {
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 );
}
};
public WoolParticle() {
super();
color( ColorMath.random( 0x999999, 0xEEEEE0 ) );
acc.set( 0, -40 );
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan = Random.Float( 0.6f, 1f );
size = 5;
speed.set( Random.Float( -10, +10 ), Random.Float( -10, +10 ) );
}
}