v3.3.5: added a new emoicon for investigating and improved emoicon code
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -22,17 +22,19 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.effects;
|
package com.shatteredpixel.shatteredpixeldungeon.effects;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
|
import com.watabou.utils.PointF;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class EmoIcon extends Image {
|
public class EmoIcon extends Image {
|
||||||
|
|
||||||
protected float maxSize = 2;
|
protected float maxSize = 2;
|
||||||
protected float timeScale = 1;
|
protected float timeScale = 1;
|
||||||
|
|
||||||
protected boolean growing = true;
|
protected boolean growing = true;
|
||||||
|
|
||||||
protected CharSprite owner;
|
protected CharSprite owner;
|
||||||
@@ -47,7 +49,7 @@ public class EmoIcon extends Image {
|
|||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (growing) {
|
if (growing) {
|
||||||
scale.set( Math.min(scale.x + Game.elapsed * timeScale, maxSize ));
|
scale.set( Math.min(scale.x + Game.elapsed * timeScale, maxSize ));
|
||||||
@@ -60,11 +62,18 @@ public class EmoIcon extends Image {
|
|||||||
growing = true;
|
growing = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x = owner.x + owner.width() - width / 2;
|
if (camera != null) {
|
||||||
y = owner.y - height;
|
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 {
|
public static class Sleep extends EmoIcon {
|
||||||
|
|
||||||
@@ -77,12 +86,17 @@ public class EmoIcon extends Image {
|
|||||||
maxSize = 1.2f;
|
maxSize = 1.2f;
|
||||||
timeScale = 0.5f;
|
timeScale = 0.5f;
|
||||||
|
|
||||||
origin.set( width / 2, height / 2 );
|
|
||||||
scale.set( Random.Float( 1, maxSize ) );
|
scale.set( Random.Float( 1, maxSize ) );
|
||||||
|
|
||||||
x = owner.x + owner.width - width / 2;
|
x = owner.x + owner.width - width / 2;
|
||||||
y = owner.y - height;
|
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 {
|
public static class Alert extends EmoIcon {
|
||||||
@@ -96,12 +110,41 @@ public class EmoIcon extends Image {
|
|||||||
maxSize = 1.3f;
|
maxSize = 1.3f;
|
||||||
timeScale = 2;
|
timeScale = 2;
|
||||||
|
|
||||||
origin.set( 2.5f, height - 2.5f );
|
|
||||||
scale.set( Random.Float( 1, maxSize ) );
|
scale.set( Random.Float( 1, maxSize ) );
|
||||||
|
|
||||||
x = owner.x + owner.width - width / 2;
|
x = owner.x + owner.width - width / 2;
|
||||||
y = owner.y - height;
|
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 {
|
public static class Lost extends EmoIcon {
|
||||||
@@ -114,13 +157,17 @@ public class EmoIcon extends Image {
|
|||||||
maxSize = 1.25f;
|
maxSize = 1.25f;
|
||||||
timeScale = 1;
|
timeScale = 1;
|
||||||
|
|
||||||
origin.set( 2.5f, height - 2.5f );
|
|
||||||
scale.set( Random.Float( 1, maxSize ) );
|
scale.set( Random.Float( 1, maxSize ) );
|
||||||
|
|
||||||
x = owner.x + owner.width - width / 2;
|
x = owner.x + owner.width - width / 2;
|
||||||
y = owner.y - height;
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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() {
|
public void showLost() {
|
||||||
synchronized (EmoIcon.class) {
|
synchronized (EmoIcon.class) {
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ public enum Icons {
|
|||||||
SLEEP,
|
SLEEP,
|
||||||
ALERT,
|
ALERT,
|
||||||
LOST,
|
LOST,
|
||||||
|
INVESTIGATE,
|
||||||
DEPTH, //depth icons have three variants, for regular, seeded, daily, and daily replay runs
|
DEPTH, //depth icons have three variants, for regular, seeded, daily, and daily replay runs
|
||||||
DEPTH_CHASM,
|
DEPTH_CHASM,
|
||||||
DEPTH_WATER,
|
DEPTH_WATER,
|
||||||
@@ -341,13 +342,16 @@ public enum Icons {
|
|||||||
icon.frame( icon.texture.uvRectBySize( 0, 88, 7, 5 ) );
|
icon.frame( icon.texture.uvRectBySize( 0, 88, 7, 5 ) );
|
||||||
break;
|
break;
|
||||||
case SLEEP:
|
case SLEEP:
|
||||||
icon.frame( icon.texture.uvRectBySize( 16, 80, 9, 8 ) );
|
icon.frame( icon.texture.uvRectBySize( 7, 88, 9, 8 ) );
|
||||||
break;
|
break;
|
||||||
case ALERT:
|
case ALERT:
|
||||||
icon.frame( icon.texture.uvRectBySize( 16, 88, 8, 8 ) );
|
icon.frame( icon.texture.uvRectBySize( 16, 80, 8, 8 ) );
|
||||||
break;
|
break;
|
||||||
case LOST:
|
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;
|
break;
|
||||||
case DEPTH:
|
case DEPTH:
|
||||||
icon.frame( icon.texture.uvRectBySize( 32 + runTypeOfsX(), 80 + runTypeOfsY(), 6, 7 ) );
|
icon.frame( icon.texture.uvRectBySize( 32 + runTypeOfsX(), 80 + runTypeOfsY(), 6, 7 ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user