v0.8.2c: refactored goo's particle effects
This commit is contained in:
parent
7400defb60
commit
eb65e2b356
|
@ -26,14 +26,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.GooWarn;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.quest.GooBlob;
|
||||
|
@ -42,7 +38,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GooSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
@ -71,11 +66,6 @@ public class Goo extends Mob {
|
|||
int max = (HP*2 <= HT) ? 12 : 8;
|
||||
if (pumpedUp > 0) {
|
||||
pumpedUp = 0;
|
||||
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
|
||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||
if (PathFinder.distance[i] < Integer.MAX_VALUE)
|
||||
CellEmitter.get(i).burst(ElmoParticle.FACTORY, 10);
|
||||
}
|
||||
Sample.INSTANCE.play( Assets.Sounds.BURNING );
|
||||
return Random.NormalIntRange( min*3, max*3 );
|
||||
} else {
|
||||
|
@ -104,11 +94,6 @@ public class Goo extends Mob {
|
|||
@Override
|
||||
public boolean act() {
|
||||
|
||||
//ensures goo warning blob acts at the correct times
|
||||
//as normally blobs act one extra time when initialized if they normally act before
|
||||
//whatever spawned them
|
||||
GameScene.add(Blob.seed(pos, 0, GooWarn.class));
|
||||
|
||||
if (Dungeon.level.water[pos] && HP < HT) {
|
||||
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
if (HP*2 == HT) {
|
||||
|
@ -122,9 +107,6 @@ public class Goo extends Mob {
|
|||
Dungeon.level.seal();
|
||||
}
|
||||
|
||||
//prevents goo pump animation from persisting when it shouldn't
|
||||
sprite.idle();
|
||||
|
||||
return super.act();
|
||||
}
|
||||
|
||||
|
@ -148,15 +130,19 @@ public class Goo extends Mob {
|
|||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSpriteState() {
|
||||
super.updateSpriteState();
|
||||
|
||||
if (pumpedUp > 0){
|
||||
((GooSprite)sprite).pumpUp( pumpedUp );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean doAttack( Char enemy ) {
|
||||
if (pumpedUp == 1) {
|
||||
((GooSprite)sprite).pumpUp();
|
||||
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
|
||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||
if (PathFinder.distance[i] < Integer.MAX_VALUE)
|
||||
GameScene.add(Blob.seed(i, 1, GooWarn.class));
|
||||
}
|
||||
((GooSprite)sprite).pumpUp( 2 );
|
||||
pumpedUp++;
|
||||
Sample.INSTANCE.play( Assets.Sounds.CHARGEUP );
|
||||
|
||||
|
@ -170,9 +156,9 @@ public class Goo extends Mob {
|
|||
if (visible) {
|
||||
if (pumpedUp >= 2) {
|
||||
((GooSprite) sprite).pumpAttack();
|
||||
}
|
||||
else
|
||||
} else {
|
||||
sprite.attack(enemy.pos);
|
||||
}
|
||||
} else {
|
||||
attack( enemy );
|
||||
}
|
||||
|
@ -185,14 +171,7 @@ public class Goo extends Mob {
|
|||
|
||||
pumpedUp++;
|
||||
|
||||
((GooSprite)sprite).pumpUp();
|
||||
|
||||
for (int i=0; i < PathFinder.NEIGHBOURS9.length; i++) {
|
||||
int j = pos + PathFinder.NEIGHBOURS9[i];
|
||||
if (!Dungeon.level.solid[j]) {
|
||||
GameScene.add(Blob.seed(j, 1, GooWarn.class));
|
||||
}
|
||||
}
|
||||
((GooSprite)sprite).pumpUp( 1 );
|
||||
|
||||
if (Dungeon.level.heroFOV[pos]) {
|
||||
sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "!!!") );
|
||||
|
@ -216,6 +195,7 @@ public class Goo extends Mob {
|
|||
@Override
|
||||
protected boolean getCloser( int target ) {
|
||||
pumpedUp = 0;
|
||||
sprite.idle();
|
||||
return super.getCloser( target );
|
||||
}
|
||||
|
||||
|
|
|
@ -22,20 +22,28 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.sprites;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
import com.watabou.noosa.particles.Emitter;
|
||||
import com.watabou.noosa.particles.Emitter.Factory;
|
||||
import com.watabou.noosa.particles.PixelParticle;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GooSprite extends MobSprite {
|
||||
|
||||
private Animation pump;
|
||||
private Animation pumpAttack;
|
||||
|
||||
private Emitter spray;
|
||||
private ArrayList<Emitter> pumpUpEmitters = new ArrayList<>();
|
||||
|
||||
public GooSprite() {
|
||||
super();
|
||||
|
@ -77,12 +85,38 @@ public class GooSprite extends MobSprite {
|
|||
spray(true);
|
||||
}
|
||||
|
||||
public void pumpUp() {
|
||||
public void pumpUp( int warnDist ) {
|
||||
if (warnDist == 0){
|
||||
for (Emitter e : pumpUpEmitters){
|
||||
e.on = false;
|
||||
}
|
||||
pumpUpEmitters.clear();
|
||||
} else {
|
||||
play(pump);
|
||||
PathFinder.buildDistanceMap(ch.pos, BArray.not(Dungeon.level.solid, null), 2);
|
||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||
if (PathFinder.distance[i] <= warnDist) {
|
||||
Emitter e = CellEmitter.get(i);
|
||||
e.pour(GooParticle.FACTORY, 0.04f);
|
||||
pumpUpEmitters.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void pumpAttack() { play(pumpAttack); }
|
||||
|
||||
@Override
|
||||
public void play(Animation anim) {
|
||||
if (anim != pump && anim != pumpAttack){
|
||||
for (Emitter e : pumpUpEmitters){
|
||||
e.on = false;
|
||||
}
|
||||
pumpUpEmitters.clear();
|
||||
}
|
||||
super.play(anim);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int blood() {
|
||||
return 0xFF000000;
|
||||
|
@ -143,6 +177,11 @@ public class GooSprite extends MobSprite {
|
|||
|
||||
if (anim == pumpAttack) {
|
||||
|
||||
for (Emitter e : pumpUpEmitters){
|
||||
e.burst(ElmoParticle.FACTORY, 10);
|
||||
}
|
||||
pumpUpEmitters.clear();
|
||||
|
||||
idle();
|
||||
ch.onAttackComplete();
|
||||
} else if (anim == die) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user