v3.3.5: added a new emoicon for investigating and improved emoicon code

This commit is contained in:
Evan Debenham
2026-01-25 11:31:04 -05:00
parent 6511b7cd4f
commit 5dcabd4e50
4 changed files with 84 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -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());
}
}
}

View File

@@ -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) {

View File

@@ -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 ) );