From 6bda20b7b7e196693d794f2f28c947d66b43d710 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 10 Apr 2015 12:04:44 -0400 Subject: [PATCH] v0.3.0: refactored beam effects, added Light Ray effect. --- assets/effects.png | Bin 17450 -> 3037 bytes .../effects/{DeathRay.java => Beam.java} | 26 +++++++++++---- .../effects/Effects.java | 30 ++++++++++-------- .../items/wands/WandOfDisintegration.java | 4 +-- .../sprites/EyeSprite.java | 4 +-- 5 files changed, 40 insertions(+), 24 deletions(-) rename src/com/shatteredpixel/shatteredpixeldungeon/effects/{DeathRay.java => Beam.java} (77%) diff --git a/assets/effects.png b/assets/effects.png index 708f04789f0cca5ae47cf47847dbe2661833a669..2e684a8e37b483a235bee34d568c26d9318ac216 100644 GIT binary patch delta 3001 zcmV;q3r6&+hymRfkQfaJ1^@s6b9#F8000U(kvbcHNXMO)cT`l@7KhKhcY2}CFalDB z-n+m6(tDF$MPZm3U?>9)Gc>Uwq5=^`M4BQavC@~mCR4i{s z){CyJy!Z0*`{S%{?X&l}`|Q2XS{DG4r!SY621@~u$`kN|Je=tfkx_K)0Du7=V1OwA zOjbsJx?iw+2oTB3&4r#Jaspoj0q}ZQyaI63&@+He2mha>S?PR%=$HTzo3l9?ED;xo zI3-JvF1F8#m>QQXW*8-Az9>Nv%ZWK*kqtikEV84R*{M9Xh{ZXlvs2k(?iKO2Od&_a zh_8qXGr62B5#JKAMv5?%E8;ie*i;TP0{|3%No*HzScxJw5iyA$667M{MTtq^NHl*T1?CO*}7&0ztZsv2j*bmJyf3G7=Z`5B*PvzoDiKdLpOAxi2 z$L0#SX*@cY_n(^h55xYX#km%V()ba7P-BdM)O9LAe(eV+3K1aD`^8=Vqi??WFd%+; z;VP4hbN}x*{b#|Y;w6Kd@Hx&UD1^=u@-r9r#Lp6-0Rcz?Dv$@tKpp4+LtqB1fGuzY zZonJ(gAfo2Rs$AD1gU@zvOpf#1PVbh*a`N4YETCnK{IFt$3Z7J1u$9dISw z03U@r;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5x01njv0-eS3Om z@c?fz=y-5w-#2})c4dap1IR=sxNNzCV$=t-O!<7@@l!|dUpYcLK08iN6XZrg)B3w`!LTwQ)p@^UY5iTeVp|%K@P()CH2p5!wP+NpcC?cppgbPYTs4c=J6cJP) z!Ud%v)E40qiU=wY;eyf-YKw3QMFbUya6xGZwMDpuB7zD;xS%wI+9F&+5kUnaTu>T9 zZ4oY^h@b)yE+`G5wg{I{L{NbU7nFujTZBs}BB(%w3ra(%Ey5)f5mX?;1*IX>{zqIg zUtb!e2Z3)2^1)XEHC`0kgRc|9sCMp701&ne03!AP!23z?JO}_=Q2_9AGXP+d0YHUy zc+*WAP^<3hNU{dc#MnttHaR&NAvjFgkjD1kI(k8oG|%1H13ZKOTw+&5O4W`l~;`QP9-WoF# zDuHNudhSu3(bWx?i|53(W6W);XYD?1*In|R)gSwSYQq5j*Y;?Ml70#B2V?DJe5zBqS>S?!LF$;wG;V1b9i nQV)gN`z&_sl6{DA*%0x;-?#M{zg1l>7=gXDGqJ#G^X~ruCQv9n diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/DeathRay.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Beam.java similarity index 77% rename from src/com/shatteredpixel/shatteredpixeldungeon/effects/DeathRay.java rename to src/com/shatteredpixel/shatteredpixeldungeon/effects/Beam.java index 9738f661a..b7dd5b9bb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/DeathRay.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Beam.java @@ -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 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Effects.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Effects.java index 9b627b1d5..9d949e910 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Effects.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Effects.java @@ -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; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java index c54245470..e60b9db10 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java @@ -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(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/EyeSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/EyeSprite.java index 59a56a3e8..aec19b662 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/EyeSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/EyeSprite.java @@ -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 ) ) ); } } }