diff --git a/core/src/main/assets/interfaces/icons.png b/core/src/main/assets/interfaces/icons.png index 1674bbe59..0a2776196 100644 Binary files a/core/src/main/assets/interfaces/icons.png and b/core/src/main/assets/interfaces/icons.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java index b7c55e1b1..ac2ed313b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/EmoIcon.java @@ -22,17 +22,19 @@ package com.shatteredpixel.shatteredpixeldungeon.effects; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.watabou.noosa.Game; import com.watabou.noosa.Image; +import com.watabou.utils.PointF; import com.watabou.utils.Random; public class EmoIcon extends Image { protected float maxSize = 2; protected float timeScale = 1; - + protected boolean growing = true; protected CharSprite owner; @@ -47,7 +49,7 @@ public class EmoIcon extends Image { @Override public void update() { super.update(); - + if (visible) { if (growing) { scale.set( Math.min(scale.x + Game.elapsed * timeScale, maxSize )); @@ -60,11 +62,18 @@ public class EmoIcon extends Image { growing = true; } } - - x = owner.x + owner.width() - width / 2; - y = owner.y - height; + + if (camera != null) { + PointF center = centerPoint(); + x = PixelScene.align(camera, owner.x + owner.width() - center.x); + y = PixelScene.align(camera, owner.y - center.y); + } } } + + protected PointF centerPoint(){ + return new PointF(width()/2f, height()/2f); + }; public static class Sleep extends EmoIcon { @@ -77,12 +86,17 @@ public class EmoIcon extends Image { maxSize = 1.2f; timeScale = 0.5f; - origin.set( width / 2, height / 2 ); scale.set( Random.Float( 1, maxSize ) ); x = owner.x + owner.width - width / 2; y = owner.y - height; } + + @Override + protected PointF centerPoint(){ + //centered and significantly up + return new PointF(width()/2f, 4f+ height()/2f); + } } public static class Alert extends EmoIcon { @@ -96,12 +110,41 @@ public class EmoIcon extends Image { maxSize = 1.3f; timeScale = 2; - origin.set( 2.5f, height - 2.5f ); scale.set( Random.Float( 1, maxSize ) ); x = owner.x + owner.width - width / 2; y = owner.y - height; } + + @Override + protected PointF centerPoint(){ + //up and left, and centers at the bottom-left + return new PointF(2.5f + 0.25f*width(), 2.5f + 0.75f*height()); + } + } + + public static class Investigate extends EmoIcon { + + public Investigate( CharSprite owner ) { + + super( owner ); + + copy( Icons.get( Icons.INVESTIGATE ) ); + + maxSize = 1.3f; + timeScale = 1.5f; + + scale.set( Random.Float( 1, maxSize ) ); + + x = owner.x + owner.width - width / 2; + y = owner.y - height; + } + + @Override + protected PointF centerPoint(){ + //up and left, and centers at the bottom-left + return new PointF(2.5f + 0.25f*width(), 2.5f + 0.75f*height()); + } } public static class Lost extends EmoIcon { @@ -114,13 +157,17 @@ public class EmoIcon extends Image { maxSize = 1.25f; timeScale = 1; - origin.set( 2.5f, height - 2.5f ); scale.set( Random.Float( 1, maxSize ) ); x = owner.x + owner.width - width / 2; y = owner.y - height; } - + + @Override + protected PointF centerPoint(){ + //up and left, and centers at the bottom-left + return new PointF(2.5f + 0.25f*width(), 2.5f + 0.75f*height()); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index 84cdaeeeb..faf5be42c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -694,6 +694,27 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip } } } + + public void showInvestigate() { + synchronized (EmoIcon.class) { + if (!(emo instanceof EmoIcon.Investigate)) { + if (emo != null) { + emo.killAndErase(); + } + emo = new EmoIcon.Investigate(this); + emo.visible = visible; + } + } + } + + public void hideInvestigate() { + synchronized (EmoIcon.class) { + if (emo instanceof EmoIcon.Investigate) { + emo.killAndErase(); + emo = null; + } + } + } public void showLost() { synchronized (EmoIcon.class) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java index 8d5b098d2..a14467f67 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java @@ -108,6 +108,7 @@ public enum Icons { SLEEP, ALERT, LOST, + INVESTIGATE, DEPTH, //depth icons have three variants, for regular, seeded, daily, and daily replay runs DEPTH_CHASM, DEPTH_WATER, @@ -341,13 +342,16 @@ public enum Icons { icon.frame( icon.texture.uvRectBySize( 0, 88, 7, 5 ) ); break; case SLEEP: - icon.frame( icon.texture.uvRectBySize( 16, 80, 9, 8 ) ); + icon.frame( icon.texture.uvRectBySize( 7, 88, 9, 8 ) ); break; case ALERT: - icon.frame( icon.texture.uvRectBySize( 16, 88, 8, 8 ) ); + icon.frame( icon.texture.uvRectBySize( 16, 80, 8, 8 ) ); break; case LOST: - icon.frame( icon.texture.uvRectBySize( 24, 88, 8, 8 ) ); + icon.frame( icon.texture.uvRectBySize( 24, 80, 8, 8 ) ); + break; + case INVESTIGATE: + icon.frame( icon.texture.uvRectBySize( 16, 88, 8, 8 ) ); break; case DEPTH: icon.frame( icon.texture.uvRectBySize( 32 + runTypeOfsX(), 80 + runTypeOfsY(), 6, 7 ) );