v1.4.0: improved chains vfx, especially for guards

This commit is contained in:
Evan Debenham
2022-08-01 17:24:21 -04:00
parent 4333e3273a
commit 9d6fbea2ba
5 changed files with 24 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 365 B

View File

@@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.effects.Chains;
import com.shatteredpixel.shatteredpixeldungeon.effects.Effects;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
@@ -95,7 +96,10 @@ public class Guard extends Mob {
yell(Messages.get(this, "scorpion"));
new Item().throwSound();
Sample.INSTANCE.play(Assets.Sounds.CHAINS);
sprite.parent.add(new Chains(sprite.center(), enemy.sprite.destinationCenter(), new Callback() {
sprite.parent.add(new Chains(sprite.center(),
enemy.sprite.destinationCenter(),
Effects.Type.CHAIN,
new Callback() {
public void call() {
Actor.addDelayed(new Pushing(enemy, enemy.pos, newPosFinal, new Callback() {
public void call() {

View File

@@ -44,13 +44,14 @@ public class Chains extends Group {
private PointF from, to;
public Chains(int from, int to, Callback callback){
public Chains(int from, int to, Effects.Type type, Callback callback){
this(DungeonTilemap.tileCenterToWorld(from),
DungeonTilemap.tileCenterToWorld(to),
type,
callback);
}
public Chains(PointF from, PointF to, Callback callback){
public Chains(PointF from, PointF to, Effects.Type type, Callback callback){
super();
this.callback = callback;
@@ -62,8 +63,8 @@ public class Chains extends Group {
float dy = to.y - from.y;
distance = (float)Math.hypot(dx, dy);
duration = distance/300f + 0.1f;
//base of 200ms, plus 50ms per tile travelled
duration = distance/320f + 0.2f;
rotation = (float)(Math.atan2( dy, dx ) * A) + 90f;
@@ -71,7 +72,7 @@ public class Chains extends Group {
chains = new Image[numChains];
for (int i = 0; i < chains.length; i++){
chains[i] = new Image(Effects.get(Effects.Type.CHAIN));
chains[i] = new Image(Effects.get(type));
chains[i].angle = rotation;
chains[i].origin.set( chains[i].width()/ 2, chains[i].height() );
add(chains[i]);

View File

@@ -32,6 +32,7 @@ public class Effects {
WOUND,
EXCLAMATION,
CHAIN,
ETHEREAL_CHAIN,
DEATH_RAY,
LIGHT_RAY,
HEALTH_RAY
@@ -55,6 +56,9 @@ public class Effects {
case CHAIN:
icon.frame(icon.texture.uvRect(6, 16, 11, 22));
break;
case ETHEREAL_CHAIN:
icon.frame(icon.texture.uvRect(11, 16, 16, 22));
break;
case DEATH_RAY:
icon.frame(icon.texture.uvRect(16, 16, 32, 24));
break;

View File

@@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.Chains;
import com.shatteredpixel.shatteredpixeldungeon.effects.Effects;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
@@ -176,7 +177,10 @@ public class EtherealChains extends Artifact {
hero.busy();
throwSound();
Sample.INSTANCE.play( Assets.Sounds.CHAINS );
hero.sprite.parent.add(new Chains(hero.sprite.center(), enemy.sprite.center(), new Callback() {
hero.sprite.parent.add(new Chains(hero.sprite.center(),
enemy.sprite.center(),
Effects.Type.ETHEREAL_CHAIN,
new Callback() {
public void call() {
Actor.add(new Pushing(enemy, enemy.pos, pulledPos, new Callback() {
public void call() {
@@ -236,7 +240,10 @@ public class EtherealChains extends Artifact {
hero.busy();
throwSound();
Sample.INSTANCE.play( Assets.Sounds.CHAINS );
hero.sprite.parent.add(new Chains(hero.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(newHeroPos), new Callback() {
hero.sprite.parent.add(new Chains(hero.sprite.center(),
DungeonTilemap.raisedTileCenterToWorld(newHeroPos),
Effects.Type.ETHEREAL_CHAIN,
new Callback() {
public void call() {
Actor.add(new Pushing(hero, hero.pos, newHeroPos, new Callback() {
public void call() {