v0.3.0: refactored beam effects, added Light Ray effect.
This commit is contained in:
parent
7cce41e650
commit
6bda20b7b7
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 3.0 KiB |
|
@ -27,16 +27,16 @@ import com.watabou.noosa.audio.Sample;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.watabou.utils.PointF;
|
||||
|
||||
public class DeathRay extends Image {
|
||||
public class Beam extends Image {
|
||||
|
||||
private static final double A = 180 / Math.PI;
|
||||
|
||||
private static final float DURATION = 0.5f;
|
||||
private float duration;
|
||||
|
||||
private float timeLeft;
|
||||
|
||||
public DeathRay( PointF s, PointF e ) {
|
||||
super( Effects.get( Effects.Type.RAY ) );
|
||||
|
||||
private Beam(PointF s, PointF e, Effects.Type asset, float duration) {
|
||||
super( Effects.get( asset ) );
|
||||
|
||||
origin.set( 0, height / 2 );
|
||||
|
||||
|
@ -50,14 +50,26 @@ public class DeathRay extends Image {
|
|||
|
||||
Sample.INSTANCE.play( Assets.SND_RAY );
|
||||
|
||||
timeLeft = DURATION;
|
||||
timeLeft = this.duration = duration;
|
||||
}
|
||||
|
||||
public static class DeathRay extends Beam{
|
||||
public DeathRay(PointF s, PointF e){
|
||||
super(s, e, Effects.Type.DEATH_RAY, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public static class LightRay extends Beam{
|
||||
public LightRay(PointF s, PointF e){
|
||||
super(s, e, Effects.Type.LIGHT_RAY, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
float p = timeLeft / DURATION;
|
||||
float p = timeLeft / duration;
|
||||
alpha( p );
|
||||
scale.set( scale.x, p );
|
||||
|
|
@ -26,24 +26,28 @@ public class Effects {
|
|||
RIPPLE,
|
||||
LIGHTNING,
|
||||
WOUND,
|
||||
RAY
|
||||
DEATH_RAY,
|
||||
LIGHT_RAY
|
||||
};
|
||||
|
||||
public static Image get( Type type ) {
|
||||
Image icon = new Image( Assets.EFFECTS );
|
||||
switch (type) {
|
||||
case RIPPLE:
|
||||
icon.frame( icon.texture.uvRect( 0, 0, 16, 16 ) );
|
||||
break;
|
||||
case LIGHTNING:
|
||||
icon.frame( icon.texture.uvRect( 16, 0, 32, 8 ) );
|
||||
break;
|
||||
case WOUND:
|
||||
icon.frame( icon.texture.uvRect( 16, 8, 32, 16 ) );
|
||||
break;
|
||||
case RAY:
|
||||
icon.frame( icon.texture.uvRect( 16, 16, 32, 24 ) );
|
||||
break;
|
||||
case RIPPLE:
|
||||
icon.frame(icon.texture.uvRect(0, 0, 16, 16));
|
||||
break;
|
||||
case LIGHTNING:
|
||||
icon.frame(icon.texture.uvRect(16, 0, 32, 8));
|
||||
break;
|
||||
case WOUND:
|
||||
icon.frame(icon.texture.uvRect(16, 8, 32, 16));
|
||||
break;
|
||||
case DEATH_RAY:
|
||||
icon.frame(icon.texture.uvRect(16, 16, 32, 24));
|
||||
break;
|
||||
case LIGHT_RAY:
|
||||
icon.frame(icon.texture.uvRect(16, 23, 32, 31));
|
||||
break;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.DeathRay;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Death;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
||||
|
@ -113,7 +113,7 @@ public class WandOfDisintegration extends Wand {
|
|||
protected void fx( Ballistica beam, Callback callback ) {
|
||||
|
||||
int cell = beam.path.get(Math.min(beam.dist, distance()));
|
||||
curUser.sprite.parent.add( new DeathRay( curUser.sprite.center(), DungeonTilemap.tileCenterToWorld( cell ) ) );
|
||||
curUser.sprite.parent.add(new Beam.LightRay(curUser.sprite.center(), DungeonTilemap.tileCenterToWorld( cell )));
|
||||
callback.call();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.watabou.noosa.TextureFilm;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.DeathRay;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
|
||||
|
||||
public class EyeSprite extends MobSprite {
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class EyeSprite extends MobSprite {
|
|||
|
||||
if (anim == attack) {
|
||||
if (Dungeon.visible[ch.pos] || Dungeon.visible[attackPos]) {
|
||||
parent.add( new DeathRay( center(), DungeonTilemap.tileCenterToWorld( attackPos ) ) );
|
||||
parent.add( new Beam.DeathRay( center(), DungeonTilemap.tileCenterToWorld( attackPos ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user