Merging 1.7.5 Source: sprites and assets changes

This commit is contained in:
Evan Debenham 2015-02-04 15:20:10 -05:00
parent 8b1ffd9a72
commit 47ccaceac4
15 changed files with 255 additions and 96 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
assets/bee.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
assets/mimic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
assets/shadow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

BIN
assets/snd_bee.mp3 Normal file

Binary file not shown.

BIN
assets/snd_degrade.mp3 Normal file

Binary file not shown.

BIN
assets/snd_mimic.mp3 Normal file

Binary file not shown.

View File

@ -0,0 +1,51 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.watabou.noosa.TextureFilm;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
public class BeeSprite extends MobSprite {
public BeeSprite() {
super();
texture( Assets.BEE );
TextureFilm frames = new TextureFilm( texture, 16, 16 );
idle = new Animation( 12, true );
idle.frames( frames, 0, 1, 1, 0, 2, 2 );
run = new Animation( 15, true );
run.frames( frames, 0, 1, 1, 0, 2, 2 );
attack = new Animation( 20, false );
attack.frames( frames, 3, 4, 5, 6 );
die = new Animation( 20, false );
die.frames( frames, 7, 8, 9, 10 );
play( idle );
}
@Override
public int blood() {
return 0xffd500;
}
}

View File

@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.noosa.MovieClip; import com.watabou.noosa.MovieClip;
import com.watabou.noosa.Visual;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.tweeners.PosTweener; import com.watabou.noosa.tweeners.PosTweener;
@ -76,14 +77,15 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
protected EmoIcon emo; protected EmoIcon emo;
private Tweener jumpTweener;
private Callback jumpCallback;
private float flashTime = 0; private float flashTime = 0;
protected boolean sleeping = false; protected boolean sleeping = false;
// Char owner
public Char ch; public Char ch;
// The sprite is currently in motion
public boolean isMoving = false; public boolean isMoving = false;
public CharSprite() { public CharSprite() {
@ -187,6 +189,17 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
} }
public void jump( int from, int to, Callback callback ) {
jumpCallback = callback;
int distance = Level.distance( from, to );
jumpTweener = new JumpTweener( this, worldToCamera( to ), distance * 4, distance * 0.1f );
jumpTweener.listener = this;
parent.add( jumpTweener );
turnTo( from, to );
}
public void die() { public void die() {
sleeping = false; sleeping = false;
play( die ); play( die );
@ -228,7 +241,6 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
} }
// Blood color
public int blood() { public int blood() {
return 0xFFBB0000; return 0xFFBB0000;
} }
@ -383,7 +395,16 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
@Override @Override
public void onComplete( Tweener tweener ) { public void onComplete( Tweener tweener ) {
if (tweener == motion) { if (tweener == jumpTweener) {
if (visible && Level.water[ch.pos] && !ch.flying) {
GameScene.ripple( ch.pos );
}
if (jumpCallback != null) {
jumpCallback.call();
}
} else if (tweener == motion) {
isMoving = false; isMoving = false;
@ -415,4 +436,29 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
} }
private static class JumpTweener extends Tweener {
public Visual visual;
public PointF start;
public PointF end;
public float height;
public JumpTweener( Visual visual, PointF pos, float height, float time ) {
super( visual, time );
this.visual = visual;
start = visual.point();
end = pos;
this.height = height;
}
@Override
protected void updateValues( float progress ) {
visual.point( PointF.inter( start, end, progress ).offset( 0, -height * 4 * progress * (1 - progress) ) );
}
}
} }

View File

@ -18,12 +18,21 @@
package com.shatteredpixel.shatteredpixeldungeon.sprites; package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.noosa.particles.Emitter.Factory;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
public class GooSprite extends MobSprite { public class GooSprite extends MobSprite {
private Animation pump; private Animation pump;
private Animation pumpAttack; private Animation pumpAttack;
private Animation jump;
private Emitter spray;
public GooSprite() { public GooSprite() {
super(); super();
@ -44,6 +53,9 @@ public class GooSprite extends MobSprite {
pumpAttack = new Animation ( 20, false ); pumpAttack = new Animation ( 20, false );
pumpAttack.frames( frames, 4, 3, 2, 1, 0, 7); pumpAttack.frames( frames, 4, 3, 2, 1, 0, 7);
jump = new Animation( 1, true );
jump.frames( frames, 6 );
attack = new Animation( 10, false ); attack = new Animation( 10, false );
attack.frames( frames, 8, 9, 10 ); attack.frames( frames, 8, 9, 10 );
@ -59,11 +71,62 @@ public class GooSprite extends MobSprite {
public void pumpAttack() { play( pumpAttack ); } public void pumpAttack() { play( pumpAttack ); }
@Override
public void play( Animation anim, boolean force ) {
super.play( anim, force );
if (anim == pump) {
spray = centerEmitter();
spray.pour( GooParticle.FACTORY, 0.04f );
} else if (spray != null) {
spray.on = false;
spray = null;
}
}
@Override @Override
public int blood() { public int blood() {
return 0xFF000000; return 0xFF000000;
} }
public static class GooParticle extends PixelParticle.Shrinking {
public static final Emitter.Factory FACTORY = new Factory() {
@Override
public void emit( Emitter emitter, int index, float x, float y ) {
((GooParticle)emitter.recycle( GooParticle.class )).reset( x, y );
}
};
public GooParticle() {
super();
color( 0x000000 );
lifespan = 0.3f;
acc.set( 0, +50 );
}
public void reset( float x, float y ) {
revive();
this.x = x;
this.y = y;
left = lifespan;
size = 4;
speed.polar( -Random.Float( PointF.PI ), Random.Float( 32, 48 ) );
}
@Override
public void update() {
super.update();
float p = left / lifespan;
am = p > 0.5f ? (1 - p) * 2f : 1;
}
}
@Override @Override
public void onComplete( Animation anim ) { public void onComplete( Animation anim ) {
super.onComplete(anim); super.onComplete(anim);

View File

@ -24,16 +24,11 @@ import com.watabou.gltextures.TextureCache;
import com.watabou.noosa.Camera; import com.watabou.noosa.Camera;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.Visual;
import com.watabou.noosa.tweeners.Tweener;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
import com.watabou.utils.PointF;
public class HeroSprite extends CharSprite { public class HeroSprite extends CharSprite {
@ -46,9 +41,6 @@ public class HeroSprite extends CharSprite {
private Animation fly; private Animation fly;
private Tweener jumpTweener;
private Callback jumpCallback;
public HeroSprite() { public HeroSprite() {
super(); super();
@ -100,32 +92,10 @@ public class HeroSprite extends CharSprite {
Camera.main.target = this; Camera.main.target = this;
} }
public void jump( int from, int to, Callback callback ) {
jumpCallback = callback;
int distance = Level.distance( from, to );
jumpTweener = new JumpTweener( this, worldToCamera( to ), distance * 4, distance * 0.1f );
jumpTweener.listener = this;
parent.add( jumpTweener );
turnTo( from, to );
play( fly );
}
@Override @Override
public void onComplete( Tweener tweener ) { public void jump( int from, int to, Callback callback ) {
if (tweener == jumpTweener) { super.jump( from, to, callback );
play( fly );
if (visible && Level.water[ch.pos] && !ch.flying) {
GameScene.ripple( ch.pos );
}
if (jumpCallback != null) {
jumpCallback.call();
}
} else {
super.onComplete( tweener );
}
} }
@Override @Override
@ -142,7 +112,6 @@ public class HeroSprite extends CharSprite {
public static TextureFilm tiers() { public static TextureFilm tiers() {
if (tiers == null) { if (tiers == null) {
// Sprites for all classes are the same in size
SmartTexture texture = TextureCache.get( Assets.ROGUE ); SmartTexture texture = TextureCache.get( Assets.ROGUE );
tiers = new TextureFilm( texture, texture.width, FRAME_HEIGHT ); tiers = new TextureFilm( texture, texture.width, FRAME_HEIGHT );
} }
@ -160,29 +129,4 @@ public class HeroSprite extends CharSprite {
return avatar; return avatar;
} }
private static class JumpTweener extends Tweener {
public Visual visual;
public PointF start;
public PointF end;
public float height;
public JumpTweener( Visual visual, PointF pos, float height, float time ) {
super( visual, time );
this.visual = visual;
start = visual.point();
end = pos;
this.height = height;
}
@Override
protected void updateValues( float progress ) {
visual.point( PointF.inter( start, end, progress ).offset( 0, -height * 4 * progress * (1 - progress) ) );
}
}
} }

View File

@ -18,7 +18,6 @@
package com.shatteredpixel.shatteredpixeldungeon.sprites; package com.shatteredpixel.shatteredpixeldungeon.sprites;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.util.Log;
import com.watabou.gltextures.TextureCache; import com.watabou.gltextures.TextureCache;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
@ -34,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.utils.PointF; import com.watabou.utils.PointF;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -140,9 +140,6 @@ public class ItemSprite extends MovieClip {
place( from ); place( from );
speed.offset( (px-x) / DROP_INTERVAL, (py-y) / DROP_INTERVAL ); speed.offset( (px-x) / DROP_INTERVAL, (py-y) / DROP_INTERVAL );
Log.d( "GAME", toString() );
Log.d( "GAME", String.format( "drop aside: %.1f %.1f", speed.x, speed.y ) );
} }
} }
@ -158,22 +155,30 @@ public class ItemSprite extends MovieClip {
public void update() { public void update() {
super.update(); super.update();
// Visibility visible = (heap == null || Dungeon.visible[heap.pos]);
visible = heap == null || Dungeon.visible[heap.pos];
// Dropping
if (dropInterval > 0 && (dropInterval -= Game.elapsed) <= 0) { if (dropInterval > 0 && (dropInterval -= Game.elapsed) <= 0) {
speed.set( 0 ); speed.set( 0 );
acc.set( 0 ); acc.set( 0 );
place( heap.pos ); place( heap.pos );
if (Level.water[heap.pos]) { if (visible) {
GameScene.ripple( heap.pos ); boolean water = Level.water[heap.pos];
if (water) {
GameScene.ripple(heap.pos);
} else {
int cell = Dungeon.level.map[heap.pos];
water = (cell == Terrain.WELL || cell == Terrain.ALCHEMY);
}
if (!(heap.peek() instanceof Gold)) {
Sample.INSTANCE.play(water ? Assets.SND_WATER : Assets.SND_STEP, 0.8f, 0.8f, 1.2f);
}
} }
} }
// Glowing
if (visible && glowing != null) { if (visible && glowing != null) {
if (glowUp && (phase += Game.elapsed) > glowing.period) { if (glowUp && (phase += Game.elapsed) > glowing.period) {

View File

@ -71,6 +71,8 @@ public class ItemSpriteSheet {
public static final int KIT = ROW2+9; public static final int KIT = ROW2+9;
public static final int AMULET = ROW2+10; public static final int AMULET = ROW2+10;
public static final int WEIGHT = ROW2+11; public static final int WEIGHT = ROW2+11;
public static final int BOMB = ROW2+12;
public static final int HONEYPOT= ROW2+14;
//Row Three: Melee weapons //Row Three: Melee weapons
public static final int KNUCKLEDUSTER = ROW3+0; public static final int KNUCKLEDUSTER = ROW3+0;

View File

@ -0,0 +1,51 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.watabou.noosa.TextureFilm;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
public class MimicSprite extends MobSprite {
public MimicSprite() {
super();
texture( Assets.MIMIC );
TextureFilm frames = new TextureFilm( texture, 16, 16 );
idle = new Animation( 5, true );
idle.frames( frames, 0, 0, 0, 1, 1 );
run = new Animation( 10, true );
run.frames( frames, 0, 1, 2, 3, 3, 2, 1 );
attack = new Animation( 10, false );
attack.frames( frames, 0, 4, 5, 6 );
die = new Animation( 5, false );
die.frames( frames, 7, 8, 9 );
play( idle );
}
@Override
public int blood() {
return 0xFFcb9700;
}
}

View File

@ -23,8 +23,8 @@ import com.watabou.noosa.TextureFilm;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.watabou.utils.PointF;
public class PlantSprite extends Image { public class PlantSprite extends Image {
@ -44,11 +44,9 @@ public class PlantSprite extends Image {
super( Assets.PLANTS ); super( Assets.PLANTS );
if (frames == null) { if (frames == null) {
// Hardcoded size
frames = new TextureFilm( texture, 16, 16 ); frames = new TextureFilm( texture, 16, 16 );
} }
// Hardcoded origin
origin.set( 8, 12 ); origin.set( 8, 12 );
} }
@ -65,9 +63,8 @@ public class PlantSprite extends Image {
alpha( 1f ); alpha( 1f );
pos = plant.pos; pos = plant.pos;
PointF p = DungeonTilemap.tileToWorld( plant.pos ); x = (pos % Level.WIDTH) * DungeonTilemap.SIZE;
x = p.x; y = (pos / Level.WIDTH) * DungeonTilemap.SIZE;
y = p.y;
state = State.GROWING; state = State.GROWING;
time = DELAY; time = DELAY;