v0.8.0: added sprites for DM-200s and DM-201s

This commit is contained in:
Evan Debenham 2020-04-14 14:49:38 -04:00
parent 2e6107ad72
commit 91373fdda1
4 changed files with 49 additions and 20 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

View File

@ -106,6 +106,7 @@ public class Assets {
public static final String SPAWNER = "spawner.png"; public static final String SPAWNER = "spawner.png";
public static final String DM100 = "dm100.png"; public static final String DM100 = "dm100.png";
public static final String PYLON = "pylon.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 ITEMS = "items.png";
public static final String TERRAIN_FEATURES = "terrain_features.png"; public static final String TERRAIN_FEATURES = "terrain_features.png";

View File

@ -23,21 +23,20 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.DM200; 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.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
//TODO currently just uses DM-300's sprite scaled to 80%
public class DM200Sprite extends MobSprite { public class DM200Sprite extends MobSprite {
public DM200Sprite () { public DM200Sprite () {
super(); 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 = new Animation( 10, true );
idle.frames( frames, 0, 1 ); idle.frames( frames, 0, 1 );
@ -46,15 +45,15 @@ public class DM200Sprite extends MobSprite {
run.frames( frames, 2, 3 ); run.frames( frames, 2, 3 );
attack = new Animation( 15, false ); 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 = new Animation( 8, false );
die.frames( frames, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 8 ); die.frames( frames, 9, 10, 11 );
play( idle ); play( idle );
scale.set( 0.8f );
} }
public void zap( int cell ) { public void zap( int cell ) {
@ -75,6 +74,18 @@ public class DM200Sprite extends MobSprite {
Sample.INSTANCE.play( Assets.SND_PUFF ); 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 @Override
public void onComplete( Animation anim ) { public void onComplete( Animation anim ) {
if (anim == zap) { if (anim == zap) {

View File

@ -24,40 +24,49 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.DM201; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.DM201;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
//TODO currently just DM-200s with treads chopped off
public class DM201Sprite extends MobSprite { public class DM201Sprite extends MobSprite {
public DM201Sprite () { public DM201Sprite () {
super(); 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 = new Animation( 2, true );
idle.frames( frames, 0, 1 ); idle.frames( frames, c+0, c+1 );
run = idle.clone(); run = idle.clone();
attack = new Animation( 15, false ); 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 = new Animation( 8, false );
die.frames( frames, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 8 ); die.frames( frames, c+9, c+10, c+11 );
play( idle ); play( idle );
scale.set( 0.8f );
} }
@Override @Override
public void resetColor() { public void place(int cell) {
super.resetColor(); 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 ) { 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 ); 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 );
}
} }