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
@@ -24,16 +24,11 @@ import com.watabou.gltextures.TextureCache;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Image;
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.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
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.PointF;
public class HeroSprite extends CharSprite {
@@ -46,9 +41,6 @@ public class HeroSprite extends CharSprite {
private Animation fly;
private Tweener jumpTweener;
private Callback jumpCallback;
public HeroSprite() {
super();
@@ -100,34 +92,12 @@ public class HeroSprite extends CharSprite {
Camera.main.target = this;
}
@Override
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 );
super.jump( from, to, callback );
play( fly );
}
@Override
public void onComplete( Tweener tweener ) {
if (tweener == jumpTweener) {
if (visible && Level.water[ch.pos] && !ch.flying) {
GameScene.ripple( ch.pos );
}
if (jumpCallback != null) {
jumpCallback.call();
}
} else {
super.onComplete( tweener );
}
}
@Override
public void update() {
sleeping = ((Hero)ch).restoreHealth;
@@ -142,7 +112,6 @@ public class HeroSprite extends CharSprite {
public static TextureFilm tiers() {
if (tiers == null) {
// Sprites for all classes are the same in size
SmartTexture texture = TextureCache.get( Assets.ROGUE );
tiers = new TextureFilm( texture, texture.width, FRAME_HEIGHT );
}
@@ -160,29 +129,4 @@ public class HeroSprite extends CharSprite {
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) ) );
}
}
}