V0.2.1 : Initial Improvements to Goo's sprite

This commit is contained in:
Evan Debenham 2014-09-29 01:16:40 -04:00
parent 91a06bac4b
commit 1c48866338
3 changed files with 38 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -109,7 +109,20 @@ public class Goo extends Mob {
protected boolean doAttack( Char enemy ) { protected boolean doAttack( Char enemy ) {
if (pumpedUp || Random.Int( 3 ) > 0) { if (pumpedUp || Random.Int( 3 ) > 0) {
return super.doAttack( enemy ); boolean visible = Dungeon.visible[pos];
if (visible) {
if (pumpedUp)
((GooSprite)sprite).pumpAttack();
else
sprite.attack( enemy.pos );
} else {
attack( enemy );
}
spend( attackDelay() );
return !visible;
} else { } else {

View File

@ -23,6 +23,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
public class GooSprite extends MobSprite { public class GooSprite extends MobSprite {
private Animation pump; private Animation pump;
private Animation pumpAttack;
public GooSprite() { public GooSprite() {
super(); super();
@ -32,19 +33,22 @@ public class GooSprite extends MobSprite {
TextureFilm frames = new TextureFilm( texture, 20, 14 ); TextureFilm frames = new TextureFilm( texture, 20, 14 );
idle = new Animation( 10, true ); idle = new Animation( 10, true );
idle.frames( frames, 0, 1 ); idle.frames( frames, 2, 1, 0, 0, 1 );
run = new Animation( 10, true ); run = new Animation( 15, true );
run.frames( frames, 0, 1 ); run.frames( frames, 3, 2, 1, 2 );
pump = new Animation( 20, true ); pump = new Animation( 20, true );
pump.frames( frames, 0, 1 ); pump.frames( frames, 4, 3, 2, 1, 0 );
pumpAttack = new Animation ( 20, false );
pumpAttack.frames( frames, 4, 3, 2, 1, 0, 7);
attack = new Animation( 10, false ); attack = new Animation( 10, false );
attack.frames( frames, 5, 0, 6 ); attack.frames( frames, 8, 9, 10 );
die = new Animation( 10, false ); die = new Animation( 10, false );
die.frames( frames, 2, 3, 4 ); die.frames( frames, 5, 6, 7 );
play( idle ); play( idle );
} }
@ -53,8 +57,21 @@ public class GooSprite extends MobSprite {
play( pump ); play( pump );
} }
public void pumpAttack() { play( pumpAttack ); }
@Override @Override
public int blood() { public int blood() {
return 0xFF000000; return 0xFF000000;
} }
@Override
public void onComplete( Animation anim ) {
super.onComplete(anim);
if (anim == pumpAttack) {
idle();
ch.onAttackComplete();
}
}
} }