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

@ -108,8 +108,21 @@ public class Goo extends Mob {
@Override
protected boolean doAttack( Char enemy ) {
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 {

View File

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