v2.2.0: substantially improved crystal wisp visuals
This commit is contained in:
@@ -68,7 +68,13 @@ public class Halo extends Image {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void radius( float value ) {
|
||||
@Override
|
||||
public void alpha( float value) {
|
||||
brightness = value;
|
||||
super.alpha(value);
|
||||
}
|
||||
|
||||
public void radius(float value ) {
|
||||
scale.set( (this.radius = value) / RADIUS );
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1016 B After Width: | Height: | Size: 872 B |
@@ -22,13 +22,21 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.sprites;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.CrystalWisp;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.TorchHalo;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
import com.watabou.noosa.tweeners.AlphaTweener;
|
||||
import com.watabou.utils.PointF;
|
||||
|
||||
public abstract class CrystalWispSprite extends MobSprite {
|
||||
|
||||
private TorchHalo light;
|
||||
|
||||
public CrystalWispSprite() {
|
||||
super();
|
||||
|
||||
@@ -38,19 +46,19 @@ public abstract class CrystalWispSprite extends MobSprite {
|
||||
|
||||
TextureFilm frames = new TextureFilm( texture, 12, 14 );
|
||||
|
||||
idle = new Animation( 4, true );
|
||||
idle.frames( frames, c+0, c+1, c+0, c+2 );
|
||||
idle = new Animation( 1, true );
|
||||
idle.frames( frames, c+0 );
|
||||
|
||||
run = new Animation( 12, true );
|
||||
run.frames( frames, c+0, c+1, c+0, c+3 );
|
||||
run.frames( frames, c+0, c+0, c+0, c+1 );
|
||||
|
||||
attack = new Animation( 15, false );
|
||||
attack.frames( frames, c+4, c+5, c+6 );
|
||||
attack = new Animation( 16, false );
|
||||
attack.frames( frames, c+2, c+3, c+4, c+5 );
|
||||
|
||||
zap = attack.clone();
|
||||
|
||||
die = new Animation( 15, false );
|
||||
die.frames( frames, c+7, c+8, c+9, c+10, c+11, c+12, c+13, c+12 );
|
||||
die.frames( frames, c+6, c+7, c+8, c+9, c+10, c+11, c+12, c+11 );
|
||||
|
||||
play( idle );
|
||||
}
|
||||
@@ -59,11 +67,55 @@ public abstract class CrystalWispSprite extends MobSprite {
|
||||
|
||||
super.zap( cell );
|
||||
|
||||
((CrystalWisp)ch).onZapComplete();
|
||||
parent.add( new Beam.LightRay(center(), DungeonTilemap.raisedTileCenterToWorld(cell)));
|
||||
parent.add(new AlphaTweener(light, 1f, 0.2f) {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
light.alpha(0.3f);
|
||||
((CrystalWisp)ch).onZapComplete();
|
||||
parent.add( new Beam.LightRay(center(), DungeonTilemap.raisedTileCenterToWorld(cell)));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void attack(int cell) {
|
||||
super.attack(cell);
|
||||
parent.add(new AlphaTweener(light, 1f, 0.2f) {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
light.alpha(0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void link(Char ch) {
|
||||
super.link(ch);
|
||||
light = new TorchHalo( this );
|
||||
light.hardlight(blood() & 0x00FFFFFF);
|
||||
light.alpha(0.3f);
|
||||
light.radius(10);
|
||||
|
||||
GameScene.effect(light);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
super.die();
|
||||
if (light != null){
|
||||
light.putOut();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
if (light != null){
|
||||
light.killAndErase();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete( Animation anim ) {
|
||||
if (anim == zap) {
|
||||
@@ -72,6 +124,48 @@ public abstract class CrystalWispSprite extends MobSprite {
|
||||
super.onComplete( anim );
|
||||
}
|
||||
|
||||
private float baseY = Float.NaN;
|
||||
|
||||
@Override
|
||||
public void place(int cell) {
|
||||
super.place(cell);
|
||||
baseY = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointF point(PointF p) {
|
||||
super.point(p);
|
||||
baseY = y;
|
||||
return p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(int from, int to) {
|
||||
super.move(from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (!paused && curAnim != die){
|
||||
if (Float.isNaN(baseY)) baseY = y;
|
||||
y = baseY + Math.abs((float)Math.sin(Game.timeTotal));
|
||||
shadowOffset = 0.25f - 0.8f*Math.abs((float)Math.sin(Game.timeTotal));
|
||||
}
|
||||
|
||||
if (light != null){
|
||||
light.visible = visible;
|
||||
light.point(center());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void turnTo(int from, int to) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected abstract int texOffset();
|
||||
|
||||
public static class Blue extends CrystalWispSprite {
|
||||
@@ -81,29 +175,29 @@ public abstract class CrystalWispSprite extends MobSprite {
|
||||
}
|
||||
@Override
|
||||
public int blood() {
|
||||
return 0xFF8EE3FF;
|
||||
return 0xFF66B3FF;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Green extends CrystalWispSprite {
|
||||
@Override
|
||||
protected int texOffset() {
|
||||
return 14;
|
||||
return 13;
|
||||
}
|
||||
@Override
|
||||
public int blood() {
|
||||
return 0xFF85FFC8;
|
||||
return 0xFF2EE62E;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Red extends CrystalWispSprite {
|
||||
@Override
|
||||
protected int texOffset() {
|
||||
return 28;
|
||||
return 26;
|
||||
}
|
||||
@Override
|
||||
public int blood() {
|
||||
return 0xFFFFBB33;
|
||||
return 0xFFFF7F00;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user