From 91373fdda164750507b9202147d9b88865fed83b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 14 Apr 2020 14:49:38 -0400 Subject: [PATCH] v0.8.0: added sprites for DM-200s and DM-201s --- core/src/main/assets/dm200.png | Bin 0 -> 853 bytes .../shatteredpixeldungeon/Assets.java | 1 + .../sprites/DM200Sprite.java | 29 +++++++++---- .../sprites/DM201Sprite.java | 39 +++++++++++++----- 4 files changed, 49 insertions(+), 20 deletions(-) create mode 100644 core/src/main/assets/dm200.png diff --git a/core/src/main/assets/dm200.png b/core/src/main/assets/dm200.png new file mode 100644 index 0000000000000000000000000000000000000000..79e2b9924e0c3db0c030b80057f5abfda17ef096 GIT binary patch literal 853 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K595|SPuu&dIbSrdhAT|P&-P=ii06D6<^OlI zPIenade3{F-{tz~#pbjtg-_>be>wG|$nIg}eZA@%2VYIS`1DW6mB?^aXP2eTSG6CX zzG-f1knMJQ(li(E^4hch3&W31H_p$hxR$f`*{yG)eyaQC)CM2keDBVhYP0tWUr)^l zT2@qjy8kN^YkKW}#+o~IO;e`^2Tr`utPRCp5a4JF#85!y)NW3=}wvO~3@I zV#kW!fQNznD~b$zcRsKADg2|zCv{4aGRu_S0ROd~&J0!O>ow{bzopr08RXYjQ{`u literal 0 HcmV?d00001 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java index 27abe0945..82e35edfe 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java @@ -106,6 +106,7 @@ public class Assets { public static final String SPAWNER = "spawner.png"; public static final String DM100 = "dm100.png"; public static final String PYLON = "pylon.png"; + public static final String DM200 = "dm200.png"; public static final String ITEMS = "items.png"; public static final String TERRAIN_FEATURES = "terrain_features.png"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM200Sprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM200Sprite.java index 6c9e1a020..1b3dd65db 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM200Sprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM200Sprite.java @@ -23,21 +23,20 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.DM200; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shaman; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.watabou.noosa.TextureFilm; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; -//TODO currently just uses DM-300's sprite scaled to 80% public class DM200Sprite extends MobSprite { public DM200Sprite () { super(); - texture( Assets.DM300 ); + texture( Assets.DM200 ); - TextureFilm frames = new TextureFilm( texture, 22, 20 ); + TextureFilm frames = new TextureFilm( texture, 21, 18 ); idle = new Animation( 10, true ); idle.frames( frames, 0, 1 ); @@ -46,15 +45,15 @@ public class DM200Sprite extends MobSprite { run.frames( frames, 2, 3 ); attack = new Animation( 15, false ); - attack.frames( frames, 4, 5, 6, 0 ); + attack.frames( frames, 4, 5, 6 ); - zap = attack.clone(); + zap = new Animation( 15, false ); + zap.frames( frames, 7, 8, 8, 7 ); - die = new Animation( 20, false ); - die.frames( frames, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 8 ); + die = new Animation( 8, false ); + die.frames( frames, 9, 10, 11 ); play( idle ); - scale.set( 0.8f ); } public void zap( int cell ) { @@ -75,6 +74,18 @@ public class DM200Sprite extends MobSprite { Sample.INSTANCE.play( Assets.SND_PUFF ); } + @Override + public void place(int cell) { + if (parent != null) parent.bringToFront(this); + super.place(cell); + } + + @Override + public void die() { + emitter().burst( Speck.factory( Speck.WOOL ), 8 ); + super.die(); + } + @Override public void onComplete( Animation anim ) { if (anim == zap) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM201Sprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM201Sprite.java index 1178f3e18..ce044c431 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM201Sprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/DM201Sprite.java @@ -24,40 +24,49 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.DM201; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.watabou.noosa.TextureFilm; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; -//TODO currently just DM-200s with treads chopped off public class DM201Sprite extends MobSprite { public DM201Sprite () { super(); - texture( Assets.DM300 ); + texture( Assets.DM200 ); - TextureFilm frames = new TextureFilm( texture, 22, 16 ); + TextureFilm frames = new TextureFilm( texture, 21, 18 ); + + int c = 12; idle = new Animation( 2, true ); - idle.frames( frames, 0, 1 ); + idle.frames( frames, c+0, c+1 ); run = idle.clone(); attack = new Animation( 15, false ); - attack.frames( frames, 4, 5, 6, 0 ); + attack.frames( frames, c+4, c+5, c+6 ); - zap = attack.clone(); + zap = new Animation( 15, false ); + zap.frames( frames, c+7, c+8, c+8, c+7 ); - die = new Animation( 20, false ); - die.frames( frames, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 8 ); + die = new Animation( 8, false ); + die.frames( frames, c+9, c+10, c+11 ); play( idle ); - scale.set( 0.8f ); } @Override - public void resetColor() { - super.resetColor(); + public void place(int cell) { + if (parent != null) parent.bringToFront(this); + super.place(cell); + } + + @Override + public void die() { + emitter().burst( Speck.factory( Speck.WOOL ), 8 ); + super.die(); } public void zap( int cell ) { @@ -79,4 +88,12 @@ public class DM201Sprite extends MobSprite { Sample.INSTANCE.play( Assets.SND_MISS, 0.6f, 0.6f, 1.5f ); } + @Override + public void onComplete( Animation anim ) { + if (anim == zap) { + idle(); + } + super.onComplete( anim ); + } + }