diff --git a/assets/banners.png b/assets/banners.png index 6041dbad8..1b0923d16 100644 Binary files a/assets/banners.png and b/assets/banners.png differ diff --git a/assets/bee.png b/assets/bee.png new file mode 100644 index 000000000..51f7081fe Binary files /dev/null and b/assets/bee.png differ diff --git a/assets/mimic.png b/assets/mimic.png new file mode 100644 index 000000000..e7fcd83ad Binary files /dev/null and b/assets/mimic.png differ diff --git a/assets/shadow.png b/assets/shadow.png new file mode 100644 index 000000000..827ed7138 Binary files /dev/null and b/assets/shadow.png differ diff --git a/assets/snd_bee.mp3 b/assets/snd_bee.mp3 new file mode 100644 index 000000000..e26a0a407 Binary files /dev/null and b/assets/snd_bee.mp3 differ diff --git a/assets/snd_degrade.mp3 b/assets/snd_degrade.mp3 new file mode 100644 index 000000000..a2685a448 Binary files /dev/null and b/assets/snd_degrade.mp3 differ diff --git a/assets/snd_mimic.mp3 b/assets/snd_mimic.mp3 new file mode 100644 index 000000000..4c95bfe27 Binary files /dev/null and b/assets/snd_mimic.mp3 differ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/BeeSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/BeeSprite.java new file mode 100644 index 000000000..547a5952f --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/BeeSprite.java @@ -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 + */ +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; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index 5be57d6e2..df3988cdd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import com.watabou.noosa.Game; import com.watabou.noosa.MovieClip; +import com.watabou.noosa.Visual; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.tweeners.PosTweener; @@ -75,15 +76,16 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip protected TorchHalo halo; protected EmoIcon emo; - + + private Tweener jumpTweener; + private Callback jumpCallback; + private float flashTime = 0; protected boolean sleeping = false; - - // Char owner + public Char ch; - // The sprite is currently in motion public boolean isMoving = false; public CharSprite() { @@ -186,7 +188,18 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip flipHorizontal = true; } } - + + 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() { sleeping = false; play( die ); @@ -227,8 +240,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip Splash.at( c, PointF.angle( from, c ), 3.1415926f / 2, blood(), n ); } } - - // Blood color + public int blood() { return 0xFFBB0000; } @@ -383,9 +395,18 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip @Override public void onComplete( Tweener tweener ) { - if (tweener == motion) { + if (tweener == jumpTweener) { - isMoving = false; + if (visible && Level.water[ch.pos] && !ch.flying) { + GameScene.ripple( ch.pos ); + } + if (jumpCallback != null) { + jumpCallback.call(); + } + + } else if (tweener == motion) { + + isMoving = false; motion.killAndErase(); motion = null; @@ -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) ) ); + } + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java index 7a19cd54e..b9413338d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/GooSprite.java @@ -18,13 +18,22 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; 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; public class GooSprite extends MobSprite { private Animation pump; private Animation pumpAttack; - + private Animation jump; + + private Emitter spray; + public GooSprite() { super(); @@ -43,7 +52,10 @@ public class GooSprite extends MobSprite { pumpAttack = new Animation ( 20, false ); pumpAttack.frames( frames, 4, 3, 2, 1, 0, 7); - + + jump = new Animation( 1, true ); + jump.frames( frames, 6 ); + attack = new Animation( 10, false ); attack.frames( frames, 8, 9, 10 ); @@ -58,13 +70,64 @@ public class GooSprite extends MobSprite { } 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 public int blood() { return 0xFF000000; } - @Override + 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 public void onComplete( Animation anim ) { super.onComplete(anim); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java index 8b8d3c62f..85ccc49ae 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java @@ -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) ) ); - } - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java index 4845d77fc..1b1f27b87 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSprite.java @@ -18,7 +18,6 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import android.graphics.Bitmap; -import android.util.Log; import com.watabou.gltextures.TextureCache; 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.Item; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.watabou.utils.PointF; import com.watabou.utils.Random; @@ -140,9 +140,6 @@ public class ItemSprite extends MovieClip { place( from ); 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() { super.update(); - // Visibility - visible = heap == null || Dungeon.visible[heap.pos]; - - // Dropping + visible = (heap == null || Dungeon.visible[heap.pos]); + if (dropInterval > 0 && (dropInterval -= Game.elapsed) <= 0) { speed.set( 0 ); acc.set( 0 ); place( heap.pos ); - - if (Level.water[heap.pos]) { - GameScene.ripple( heap.pos ); + + if (visible) { + 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 (glowUp && (phase += Game.elapsed) > glowing.period) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index 5b1b05080..8667f24e2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -57,10 +57,10 @@ public class ItemSpriteSheet { public static final int SMTH = ROW1+13; //Row Two: Miscellaneous single use items - public static final int GOLD = ROW2+0; - public static final int TORCH = ROW2+1; - public static final int STYLUS = ROW2+2; - public static final int ANKH = ROW2+3; + public static final int GOLD = ROW2+0; + public static final int TORCH = ROW2+1; + public static final int STYLUS = ROW2+2; + public static final int ANKH = ROW2+3; // Keys public static final int IRON_KEY = ROW2+4; public static final int GOLDEN_KEY = ROW2+5; @@ -71,6 +71,8 @@ public class ItemSpriteSheet { public static final int KIT = ROW2+9; public static final int AMULET = ROW2+10; 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 public static final int KNUCKLEDUSTER = ROW3+0; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MimicSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MimicSprite.java new file mode 100644 index 000000000..6d9c3f9f5 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/MimicSprite.java @@ -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 + */ +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; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/PlantSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/PlantSprite.java index 9e524d5c2..84e1cbf65 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/PlantSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/PlantSprite.java @@ -23,8 +23,8 @@ import com.watabou.noosa.TextureFilm; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; -import com.watabou.utils.PointF; public class PlantSprite extends Image { @@ -44,11 +44,9 @@ public class PlantSprite extends Image { super( Assets.PLANTS ); if (frames == null) { - // Hardcoded size frames = new TextureFilm( texture, 16, 16 ); } - - // Hardcoded origin + origin.set( 8, 12 ); } @@ -65,10 +63,9 @@ public class PlantSprite extends Image { alpha( 1f ); pos = plant.pos; - PointF p = DungeonTilemap.tileToWorld( plant.pos ); - x = p.x; - y = p.y; - + x = (pos % Level.WIDTH) * DungeonTilemap.SIZE; + y = (pos / Level.WIDTH) * DungeonTilemap.SIZE; + state = State.GROWING; time = DELAY; }