v0.8.0: finalized DM-300's sprite

This commit is contained in:
Evan Debenham 2020-04-15 23:46:09 -04:00
parent f24901740d
commit e40a5b5ab1
4 changed files with 53 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 843 B

View File

@ -454,7 +454,7 @@ public class NewDM300 extends Mob {
spend(3f);
yell(Messages.get(this, "charging"));
sprite.showStatus(CharSprite.POSITIVE, Messages.get(this, "invulnerable"));
sprite.resetColor();
((DM300Sprite)sprite).charge();
chargeAnnounced = false;
GLog.h(Messages.get(this, "charging_hint"));

View File

@ -35,6 +35,7 @@ import com.watabou.utils.Callback;
public class DM300Sprite extends MobSprite {
private Animation charge;
private Animation slam;
private Emitter superchargeSparks;
@ -44,25 +45,39 @@ public class DM300Sprite extends MobSprite {
texture( Assets.DM300 );
TextureFilm frames = new TextureFilm( texture, 22, 20 );
setAnimations(false);
}
idle = new Animation( 10, true );
idle.frames( frames, 0, 1 );
private void setAnimations( boolean enraged ){
int c = enraged ? 10 : 0;
run = new Animation( 10, true );
run.frames( frames, 2, 3 );
TextureFilm frames = new TextureFilm( texture, 25, 22 );
idle = new Animation( enraged ? 15 : 10, true );
idle.frames( frames, c+0, c+1 );
run = new Animation( enraged ? 15 : 10, true );
run.frames( frames, c+0, c+2 );
attack = new Animation( 15, false );
attack.frames( frames, 4, 5, 6 );
attack.frames( frames, c+3, c+4, c+5 );
//unaffected by enrage state
if (charge == null) {
charge = new Animation(4, true);
charge.frames(frames, 0, 10);
slam = attack.clone();
zap = attack.clone();
zap = new Animation(15, false);
zap.frames(frames, 6, 7, 7, 6);
die = new Animation(20, false);
die.frames( frames, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 8 );
die.frames(frames, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10);
}
play( idle );
if (curAnim != charge) play(idle);
}
public void zap( int cell ) {
@ -83,6 +98,10 @@ public class DM300Sprite extends MobSprite {
Sample.INSTANCE.play( Assets.SND_PUFF );
}
public void charge(){
play( charge );
}
public void slam( int cell ){
turnTo( ch.pos , cell );
play( slam );
@ -108,10 +127,17 @@ public class DM300Sprite extends MobSprite {
if (anim == die && !exploded) {
exploded = true;
Sample.INSTANCE.play(Assets.SND_BLAST);
emitter().burst( BlastParticle.FACTORY, 25 );
emitter().burst( BlastParticle.FACTORY, 100 );
killAndErase();
}
}
@Override
public void place(int cell) {
if (parent != null) parent.bringToFront(this);
super.place(cell);
}
@Override
public void link(Char ch) {
super.link(ch);
@ -122,7 +148,7 @@ public class DM300Sprite extends MobSprite {
superchargeSparks.on = false;
if (ch instanceof NewDM300 && ((NewDM300) ch).isSupercharged()){
tint(1, 0, 0, 0.33f);
setAnimations(true);
superchargeSparks.on = true;
}
}
@ -133,8 +159,10 @@ public class DM300Sprite extends MobSprite {
if (superchargeSparks != null){
superchargeSparks.visible = visible;
if (ch instanceof NewDM300){
if (ch instanceof NewDM300
&& ((NewDM300) ch).isSupercharged() != superchargeSparks.on){
superchargeSparks.on = ((NewDM300) ch).isSupercharged();
setAnimations(((NewDM300) ch).isSupercharged());
}
}
}
@ -155,14 +183,6 @@ public class DM300Sprite extends MobSprite {
}
}
@Override
public void resetColor() {
super.resetColor();
if (ch instanceof NewDM300 && ((NewDM300) ch).isSupercharged()){
tint(1, 0, 0, 0.33f);
}
}
@Override
public int blood() {
return 0xFFFFFF88;

View File

@ -64,10 +64,15 @@ public class PylonSprite extends MobSprite {
if (ch instanceof Pylon && ch.alignment == Char.Alignment.ENEMY){
activate();
}
if (parent != null) parent.bringToFront(this);
renderShadow = false;
}
@Override
public void place(int cell) {
if (parent != null) parent.bringToFront(this);
super.place(cell);
}
public void activate(){
idle = activeIdle.clone();
idle();