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.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
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.artifacts.DriedRose;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
|
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.quest.GooBlob;
|
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.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GooSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.GooSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.watabou.noosa.Camera;
|
import com.watabou.noosa.Camera;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
@ -71,11 +66,6 @@ public class Goo extends Mob {
|
||||||
int max = (HP*2 <= HT) ? 12 : 8;
|
int max = (HP*2 <= HT) ? 12 : 8;
|
||||||
if (pumpedUp > 0) {
|
if (pumpedUp > 0) {
|
||||||
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 );
|
Sample.INSTANCE.play( Assets.Sounds.BURNING );
|
||||||
return Random.NormalIntRange( min*3, max*3 );
|
return Random.NormalIntRange( min*3, max*3 );
|
||||||
} else {
|
} else {
|
||||||
|
@ -103,11 +93,6 @@ public class Goo extends Mob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean act() {
|
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) {
|
if (Dungeon.level.water[pos] && HP < HT) {
|
||||||
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||||
|
@ -121,9 +106,6 @@ public class Goo extends Mob {
|
||||||
if (state != SLEEPING){
|
if (state != SLEEPING){
|
||||||
Dungeon.level.seal();
|
Dungeon.level.seal();
|
||||||
}
|
}
|
||||||
|
|
||||||
//prevents goo pump animation from persisting when it shouldn't
|
|
||||||
sprite.idle();
|
|
||||||
|
|
||||||
return super.act();
|
return super.act();
|
||||||
}
|
}
|
||||||
|
@ -148,15 +130,19 @@ public class Goo extends Mob {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSpriteState() {
|
||||||
|
super.updateSpriteState();
|
||||||
|
|
||||||
|
if (pumpedUp > 0){
|
||||||
|
((GooSprite)sprite).pumpUp( pumpedUp );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doAttack( Char enemy ) {
|
protected boolean doAttack( Char enemy ) {
|
||||||
if (pumpedUp == 1) {
|
if (pumpedUp == 1) {
|
||||||
((GooSprite)sprite).pumpUp();
|
((GooSprite)sprite).pumpUp( 2 );
|
||||||
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));
|
|
||||||
}
|
|
||||||
pumpedUp++;
|
pumpedUp++;
|
||||||
Sample.INSTANCE.play( Assets.Sounds.CHARGEUP );
|
Sample.INSTANCE.play( Assets.Sounds.CHARGEUP );
|
||||||
|
|
||||||
|
@ -170,9 +156,9 @@ public class Goo extends Mob {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (pumpedUp >= 2) {
|
if (pumpedUp >= 2) {
|
||||||
((GooSprite) sprite).pumpAttack();
|
((GooSprite) sprite).pumpAttack();
|
||||||
|
} else {
|
||||||
|
sprite.attack(enemy.pos);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
sprite.attack( enemy.pos );
|
|
||||||
} else {
|
} else {
|
||||||
attack( enemy );
|
attack( enemy );
|
||||||
}
|
}
|
||||||
|
@ -185,14 +171,7 @@ public class Goo extends Mob {
|
||||||
|
|
||||||
pumpedUp++;
|
pumpedUp++;
|
||||||
|
|
||||||
((GooSprite)sprite).pumpUp();
|
((GooSprite)sprite).pumpUp( 1 );
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Dungeon.level.heroFOV[pos]) {
|
if (Dungeon.level.heroFOV[pos]) {
|
||||||
sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "!!!") );
|
sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "!!!") );
|
||||||
|
@ -216,6 +195,7 @@ public class Goo extends Mob {
|
||||||
@Override
|
@Override
|
||||||
protected boolean getCloser( int target ) {
|
protected boolean getCloser( int target ) {
|
||||||
pumpedUp = 0;
|
pumpedUp = 0;
|
||||||
|
sprite.idle();
|
||||||
return super.getCloser( target );
|
return super.getCloser( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,20 +22,28 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.sprites;
|
package com.shatteredpixel.shatteredpixeldungeon.sprites;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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.TextureFilm;
|
||||||
import com.watabou.noosa.particles.Emitter;
|
import com.watabou.noosa.particles.Emitter;
|
||||||
import com.watabou.noosa.particles.Emitter.Factory;
|
import com.watabou.noosa.particles.Emitter.Factory;
|
||||||
import com.watabou.noosa.particles.PixelParticle;
|
import com.watabou.noosa.particles.PixelParticle;
|
||||||
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.PointF;
|
import com.watabou.utils.PointF;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class GooSprite extends MobSprite {
|
public class GooSprite extends MobSprite {
|
||||||
|
|
||||||
private Animation pump;
|
private Animation pump;
|
||||||
private Animation pumpAttack;
|
private Animation pumpAttack;
|
||||||
|
|
||||||
private Emitter spray;
|
private Emitter spray;
|
||||||
|
private ArrayList<Emitter> pumpUpEmitters = new ArrayList<>();
|
||||||
|
|
||||||
public GooSprite() {
|
public GooSprite() {
|
||||||
super();
|
super();
|
||||||
|
@ -77,12 +85,38 @@ public class GooSprite extends MobSprite {
|
||||||
spray(true);
|
spray(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pumpUp() {
|
public void pumpUp( int warnDist ) {
|
||||||
play( pump );
|
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); }
|
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
|
@Override
|
||||||
public int blood() {
|
public int blood() {
|
||||||
return 0xFF000000;
|
return 0xFF000000;
|
||||||
|
@ -143,6 +177,11 @@ public class GooSprite extends MobSprite {
|
||||||
|
|
||||||
if (anim == pumpAttack) {
|
if (anim == pumpAttack) {
|
||||||
|
|
||||||
|
for (Emitter e : pumpUpEmitters){
|
||||||
|
e.burst(ElmoParticle.FACTORY, 10);
|
||||||
|
}
|
||||||
|
pumpUpEmitters.clear();
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
ch.onAttackComplete();
|
ch.onAttackComplete();
|
||||||
} else if (anim == die) {
|
} else if (anim == die) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user