v3.0.0: overhauled Shattered's title graphic

This commit is contained in:
Evan Debenham
2025-01-27 11:45:49 -05:00
parent 31665de46a
commit 8643815e84
8 changed files with 76 additions and 168 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -27,30 +27,38 @@ import com.watabou.noosa.Image;
public class BannerSprites {
public enum Type {
PIXEL_DUNGEON,
TITLE_PORT,
TITLE_GLOW_PORT,
TITLE_LAND,
TITLE_GLOW_LAND,
BOSS_SLAIN,
GAME_OVER,
SELECT_YOUR_HERO,
PIXEL_DUNGEON_SIGNS
SELECT_YOUR_HERO
}
public static Image get( Type type ) {
Image icon = new Image( Assets.Interfaces.BANNERS );
switch (type) {
case PIXEL_DUNGEON:
icon.frame( icon.texture.uvRect( 0, 0, 132, 90 ) );
case TITLE_PORT:
icon.frame( icon.texture.uvRect( 0, 0, 139, 100 ) );
break;
case TITLE_GLOW_PORT:
icon.frame( icon.texture.uvRect( 139, 0, 278, 100 ) );
break;
case TITLE_LAND:
icon.frame( icon.texture.uvRect( 0, 100, 240, 157) );
break;
case TITLE_GLOW_LAND:
icon.frame( icon.texture.uvRect( 240, 100, 480, 157 ) );
break;
case BOSS_SLAIN:
icon.frame( icon.texture.uvRect( 0, 90, 128, 125 ) );
icon.frame( icon.texture.uvRect( 0, 157, 128, 192 ) );
break;
case GAME_OVER:
icon.frame( icon.texture.uvRect( 0, 125, 128, 160 ) );
icon.frame( icon.texture.uvRect( 0, 192, 128, 227 ) );
break;
case SELECT_YOUR_HERO:
icon.frame( icon.texture.uvRect( 0, 160, 128, 181 ) );
break;
case PIXEL_DUNGEON_SIGNS:
icon.frame( icon.texture.uvRect( 132, 0, 256, 90 ) );
icon.frame( icon.texture.uvRect( 0, 227, 128, 248 ) );
break;
}
return icon;

View File

@@ -21,157 +21,41 @@
package com.shatteredpixel.shatteredpixeldungeon.effects;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.watabou.glwrap.Blending;
import com.watabou.glwrap.Texture;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.Image;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.ui.Component;
import com.watabou.utils.ColorMath;
import com.watabou.utils.Random;
import com.watabou.utils.RectF;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.watabou.noosa.MovieClip;
import com.watabou.noosa.TextureFilm;
public class Fireball extends Component {
public class Fireball extends MovieClip {
private static final RectF BLIGHT = new RectF( 0, 0, 0.25f, 1 );
private static final RectF FLIGHT = new RectF( 0.25f, 0, 0.5f, 1 );
private static final RectF FLAME1 = new RectF( 0.50f, 0, 0.75f, 1 );
private static final RectF FLAME2 = new RectF( 0.75f, 0, 1.00f, 1 );
private static final int COLOR = 0xFF66FF;
private Image bLight;
private Image fLight;
private Emitter emitter;
private Group sparks;
@Override
protected void createChildren() {
sparks = new Group();
add( sparks );
bLight = new Image( Assets.Effects.FIREBALL );
bLight.frame( BLIGHT );
bLight.origin.set( bLight.width / 2 );
bLight.angularSpeed = -90;
add( bLight );
emitter = new Emitter();
emitter.pour( new Emitter.Factory() {
@Override
public void emit(Emitter emitter, int index, float x, float y) {
Flame p = (Flame)emitter.recycle( Flame.class );
p.reset();
p.heightLimit(Fireball.this.y - 30);
p.x = x - p.width / 2;
p.y = y - p.height / 2;
}
}, 0.1f );
add( emitter );
fLight = new Image( Assets.Effects.FIREBALL );
fLight.frame( FLIGHT );
fLight.origin.set( fLight.width / 2 );
fLight.angularSpeed = 360;
add( fLight );
bLight.texture.filter( Texture.LINEAR, Texture.LINEAR );
private static boolean second = false;
public Fireball() {
this(second);
second = !second;
}
@Override
protected void layout() {
bLight.x = x - bLight.width / 2;
bLight.y = y - bLight.height / 2;
emitter.pos(
x - bLight.width / 4,
y - bLight.height / 4,
bLight.width / 2,
bLight.height / 2 );
fLight.x = x - fLight.width / 2;
fLight.y = y - fLight.height / 2;
}
@Override
public void update() {
super.update();
if (Random.Float() < Game.elapsed) {
PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
spark.speed.set(
Random.Float( -40, +40 ),
Random.Float( -60, +20 ) );
spark.acc.set( 0, +80 );
sparks.add( spark );
}
}
@Override
public void draw() {
Blending.setLightMode();
super.draw();
Blending.setNormalMode();
}
public static class Flame extends Image {
private static float LIFESPAN = 1f;
private static float SPEED = -40f;
private static float ACC = -20f;
private float timeLeft;
private float heightLimit;
public Flame() {
super( Assets.Effects.FIREBALL );
frame( Random.Int( 2 ) == 0 ? FLAME1 : FLAME2 );
origin.set( width / 2, height / 2 );
acc.set( 0, ACC );
}
public void reset() {
revive();
timeLeft = LIFESPAN;
speed.set( 0, SPEED );
public Fireball(boolean second) {
if (PixelScene.landscape()){
texture( "effects/fireball-tall.png" );
TextureFilm frames = new TextureFilm( texture, 61, 61 );
MovieClip.Animation anim = new MovieClip.Animation( 24, true );
anim.frames( frames, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 );
play( anim );
} else {
texture( "effects/fireball-short.png" );
TextureFilm frames = new TextureFilm( texture, 47, 47 );
MovieClip.Animation anim = new MovieClip.Animation( 24, true );
anim.frames( frames, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 );
play( anim );
}
public void heightLimit(float limit){
heightLimit = limit;
//second fireball is flipped and has its animation offset
if (second){
flipHorizontal = true;
curFrame = 12;
frame( curAnim.frames[curFrame] );
}
@Override
public void update() {
super.update();
if (y < heightLimit){
y = heightLimit;
speed.set(Random.Float(-20, 20), 0);
acc.set(0, 0);
}
if ((timeLeft -= Game.elapsed) <= 0) {
kill();
} else {
float p = timeLeft / LIFESPAN;
scale.set( p );
alpha( p > 0.8f ? (1 - p) * 5f : p * 1.25f );
}
}
}
}

View File

@@ -75,8 +75,8 @@ public class TitleScene extends PixelScene {
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
Image title = BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON );
Image title = BannerSprites.get( landscape() ? BannerSprites.Type.TITLE_LAND : BannerSprites.Type.TITLE_PORT);
add( title );
float topRegion = Math.max(title.height - 6, h*0.45f);
@@ -86,10 +86,15 @@ public class TitleScene extends PixelScene {
align(title);
placeTorch(title.x + 22, title.y + 46);
placeTorch(title.x + title.width - 22, title.y + 46);
if (landscape()){
placeTorch(title.x + 30, title.y + 35);
placeTorch(title.x + title.width - 30, title.y + 35);
} else {
placeTorch(title.x + 16, title.y + 70);
placeTorch(title.x + title.width - 16, title.y + 70);
}
Image signs = new Image( BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON_SIGNS ) ) {
Image signs = new Image(BannerSprites.get( landscape() ? BannerSprites.Type.TITLE_GLOW_LAND : BannerSprites.Type.TITLE_GLOW_PORT)){
private float time = 0;
@Override
public void update() {
@@ -185,7 +190,7 @@ public class TitleScene extends PixelScene {
GAP = Math.max(GAP, 2);
if (landscape()) {
btnPlay.setRect(title.x-50, topRegion+GAP, ((title.width()+100)/2)-1, BTN_HEIGHT);
btnPlay.setRect(title.x, topRegion+GAP, ((title.width())/2)-1, BTN_HEIGHT);
align(btnPlay);
btnSupport.setRect(btnPlay.right()+2, btnPlay.top(), btnPlay.width(), BTN_HEIGHT);
btnRankings.setRect(btnPlay.left(), btnPlay.bottom()+ GAP, (btnPlay.width()*.67f)-1, BTN_HEIGHT);
@@ -230,7 +235,10 @@ public class TitleScene extends PixelScene {
private void placeTorch( float x, float y ) {
Fireball fb = new Fireball();
fb.setPos( x, y );
fb.x = x - fb.width()/2f;
fb.y = y - fb.height();
align(fb);
add( fb );
}

View File

@@ -102,7 +102,7 @@ public class WelcomeScene extends PixelScene {
//darkens the arches
add(new ColorBlock(w, h, 0x88000000));
Image title = BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON );
Image title = BannerSprites.get( landscape() ? BannerSprites.Type.TITLE_LAND : BannerSprites.Type.TITLE_PORT);
add( title );
float topRegion = Math.max(title.height - 6, h*0.45f);
@@ -112,10 +112,15 @@ public class WelcomeScene extends PixelScene {
align(title);
placeTorch(title.x + 22, title.y + 46);
placeTorch(title.x + title.width - 22, title.y + 46);
if (landscape()){
placeTorch(title.x + 30, title.y + 35);
placeTorch(title.x + title.width - 30, title.y + 35);
} else {
placeTorch(title.x + 16, title.y + 70);
placeTorch(title.x + title.width - 16, title.y + 70);
}
Image signs = new Image( BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON_SIGNS ) ) {
Image signs = new Image(BannerSprites.get( landscape() ? BannerSprites.Type.TITLE_GLOW_LAND : BannerSprites.Type.TITLE_GLOW_PORT)){
private float time = 0;
@Override
public void update() {
@@ -231,7 +236,10 @@ public class WelcomeScene extends PixelScene {
private void placeTorch( float x, float y ) {
Fireball fb = new Fireball();
fb.setPos( x, y );
fb.x = x - fb.width()/2f;
fb.y = y - fb.height();
align(fb);
add( fb );
}