From 88a187778468edd660f58137ea203698ffff1fea Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 6 Mar 2020 15:41:18 -0500 Subject: [PATCH] v0.8.0: adjusted sprites for yog's fists in prep for larger changes --- core/src/main/assets/burning_fist.png | Bin 860 -> 0 bytes core/src/main/assets/rotting_fist.png | Bin 671 -> 0 bytes core/src/main/assets/yog_fists.png | Bin 0 -> 1458 bytes .../shatteredpixeldungeon/Assets.java | 3 +- .../actors/mobs/Yog.java | 75 ++++--- .../sprites/BurningFistSprite.java | 84 -------- .../sprites/CharSprite.java | 8 +- .../sprites/FistSprite.java | 195 ++++++++++++++++++ .../sprites/RottingFistSprite.java | 73 ------- 9 files changed, 245 insertions(+), 193 deletions(-) delete mode 100644 core/src/main/assets/burning_fist.png delete mode 100644 core/src/main/assets/rotting_fist.png create mode 100644 core/src/main/assets/yog_fists.png delete mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/BurningFistSprite.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/FistSprite.java delete mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/RottingFistSprite.java diff --git a/core/src/main/assets/burning_fist.png b/core/src/main/assets/burning_fist.png deleted file mode 100644 index 5962f9c3ccdcd576a2412a2477a380df9f0c9d66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 860 zcmV-i1Ec(jP)P)t-s|NsC0 zzzfe&0{`7K=8zY;F#zbG0oiZ>^U4mRBL|=r0MB>;%wH*v4gktZ0Oqd%zB>ei1OT*6 z0Jk6j){Fpj0RXHL09XJ3mH+^~2%>KQ0004WQchC}fCa7&KJ_!b&;s5uymd|1B6l%Y=r9aDi@8>tsIL2j(4sp@ z;yZ31Y5}Zih4R;bAMfxM(%=gKufE?7Ao5^k-qbfnZ2)l2mEyd9?f?O>96)d^I7aEe zu2eqPQveicuuL9*tJ4lJ*K@pLL+e`{bOd}6Zht6p0)YLGV_9(A_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S)k4NZ|?Syhb=xLxe~hdaNi>$U1?Vz27m`EeYpnK^ji(>fppmZQ)6mLh-g zLl2hK=m6;D!+pEF$5qN`z|tunEeb#iF@lFiY@gHtr&eNPFVX={4K{W)^jJ}km^&aY zxW4mX2XJ8TK6QrNql&fdoj_{ZQ`b2i)ISp;}7cmuPawXYiRYj9I;fZyKy)(t=QEkLn)1hv8s zG3Snip~pwRXAcep00000fc#$@K~+^%Rk*bS&AEXf4B+2hsBllPOTuLpS*q{<80WYm zbm=jDg(_+4#Kk9OT-y8JI=3JOJKqcz^7~*Q0q-Cvf6TsqjwhuS;BP`?mB+(@%XAtz z06!j_pM;1|c_l=CK6?RvhlPUt5zeQUf%YauMqD18AHW319p<*v5(${(xj#m{Aw;|- zL|PIe&Fadoi*ft>nh^1&g@`wVh_{4DYYLGVyQ>h{wgRsU5noz}_>~aJ6oiCG=J{EO z3^YFpk?*TkJsi$l@FYa2vDbu1E-6HUC_;qFttmtz3z3dDkmffd;S5`d1Tlq3kS8wy zsK@%({2%HQ=R<|-V%)@Kz)gFMzpoL2=AuXdV9)dK0AM#(=<#hWMCxj++=RI?2@#-% zn<&%E3z29Ek;Foze|aI2bs>`P36c1y5XrU>$t8tI5LJi-F@(rq2$AIxNE?Mn5L1W* zd0`>a+z}#aB}Do+6(aF%ghW16M&=$k!1s_5Rp(`h#aVt>HDCUKZDNz0En6pIUyNB - */ - -package com.shatteredpixel.shatteredpixeldungeon.sprites; - -import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; -import com.watabou.noosa.TextureFilm; -import com.watabou.noosa.audio.Sample; -import com.watabou.utils.Callback; - -public class BurningFistSprite extends MobSprite { - - public BurningFistSprite() { - super(); - - texture( Assets.BURNING ); - - TextureFilm frames = new TextureFilm( texture, 24, 17 ); - - idle = new Animation( 2, true ); - idle.frames( frames, 0, 0, 1 ); - - run = new Animation( 3, true ); - run.frames( frames, 0, 1 ); - - attack = new Animation( 8, false ); - attack.frames( frames, 0, 5, 6 ); - - die = new Animation( 10, false ); - die.frames( frames, 0, 2, 3, 4 ); - - play( idle ); - } - - private int posToShoot; - - @Override - public void attack( int cell ) { - posToShoot = cell; - super.attack( cell ); - } - - @Override - public void onComplete( Animation anim ) { - if (anim == attack) { - - Sample.INSTANCE.play( Assets.SND_ZAP ); - MagicMissile.boltFromChar( parent, - MagicMissile.SHADOW, - this, - posToShoot, - new Callback() { - @Override - public void call() { - ch.onAttackComplete(); - } - } ); - - idle(); - - } else { - super.onComplete( anim ); - } - } -} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index 31d0aca9d..b4e44065a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -273,10 +273,14 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip } public void jump( int from, int to, Callback callback ) { + float distance = Dungeon.level.trueDistance( from, to ); + jump( from, to, callback, distance * 2, distance * 0.1f ); + } + + public void jump( int from, int to, Callback callback, float height, float duration ) { jumpCallback = callback; - float distance = Dungeon.level.trueDistance( from, to ); - jumpTweener = new JumpTweener( this, worldToCamera( to ), distance * 2, distance * 0.1f ); + jumpTweener = new JumpTweener( this, worldToCamera( to ), height, duration ); jumpTweener.listener = this; parent.add( jumpTweener ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/FistSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/FistSprite.java new file mode 100644 index 000000000..cc7bb07f2 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/FistSprite.java @@ -0,0 +1,195 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2020 Evan Debenham + * + * 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.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog; +import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle; +import com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel; +import com.watabou.noosa.Camera; +import com.watabou.noosa.TextureFilm; +import com.watabou.noosa.audio.Sample; +import com.watabou.noosa.particles.Emitter; +import com.watabou.utils.Callback; + +public abstract class FistSprite extends MobSprite { + + private static final float SLAM_TIME = 0.33f; + + protected int boltType; + + protected abstract int texOffset(); + + private Emitter particles; + protected abstract Emitter createEmitter(); + + public FistSprite() { + super(); + + int c = texOffset(); + + texture( Assets.FISTS ); + + TextureFilm frames = new TextureFilm( texture, 24, 17 ); + + idle = new Animation( 2, true ); + idle.frames( frames, c+0, c+0, c+1 ); + + run = new Animation( 3, true ); + run.frames( frames, c+0, c+1 ); + + attack = new Animation( Math.round(1 / SLAM_TIME), false ); + attack.frames( frames, c+0 ); + + zap = new Animation( 8, false ); + zap.frames( frames, c+0, c+5, c+6 ); + + die = new Animation( 10, false ); + die.frames( frames, c+0, c+2, c+3, c+4 ); + + play( idle ); + } + + @Override + public void link( Char ch ) { + super.link( ch ); + + if (particles == null) { + particles = createEmitter(); + } + } + + @Override + public void update() { + super.update(); + + if (particles != null){ + particles.visible = visible; + } + } + + @Override + public void die() { + super.die(); + if (particles != null){ + particles.on = false; + } + } + + @Override + public void kill() { + super.kill(); + if (particles != null){ + particles.killAndErase(); + } + } + + @Override + public void attack( int cell ) { + super.attack( cell ); + + jump(ch.pos, ch.pos, null, 9, SLAM_TIME ); + } + + public void zap( int cell ) { + + turnTo( ch.pos , cell ); + play( zap ); + + MagicMissile.boltFromChar( parent, + boltType, + this, + cell, + new Callback() { + @Override + public void call() { + ((Yog.BurningFist)ch).onZapComplete(); + } + } ); + Sample.INSTANCE.play( Assets.SND_ZAP ); + } + + @Override + public void onComplete( Animation anim ) { + super.onComplete( anim ); + if (anim == attack) { + Camera.main.shake( 4, 0.2f ); + } else if (anim == zap) { + idle(); + } + } + + public static class Burning extends FistSprite { + + { + boltType = MagicMissile.FIRE; + } + + @Override + protected int texOffset() { + return 0; + } + + @Override + protected Emitter createEmitter() { + Emitter emitter = emitter(); + emitter.pour( FlameParticle.FACTORY, 0.06f ); + return emitter; + } + + @Override + public int blood() { + return 0xFFFFBB33; + } + + } + + /// + + public static class Rotting extends FistSprite { + + { + boltType = MagicMissile.TOXIC_VENT; + } + + @Override + protected int texOffset() { + return 20; + } + + @Override + protected Emitter createEmitter() { + Emitter emitter = emitter(); + //emitter.pour( SewerLevel.WaterParticle.FACTORY, 0.06f ); + return emitter; + } + + @Override + public int blood() { + return 0xFFFFBB33; + } + + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/RottingFistSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/RottingFistSprite.java deleted file mode 100644 index 6a206e5da..000000000 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/RottingFistSprite.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2015 Oleg Dolya - * - * Shattered Pixel Dungeon - * Copyright (C) 2014-2019 Evan Debenham - * - * 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.shatteredpixel.shatteredpixeldungeon.Assets; -import com.watabou.noosa.Camera; -import com.watabou.noosa.TextureFilm; - -public class RottingFistSprite extends MobSprite { - - private static final float FALL_SPEED = 64; - - public RottingFistSprite() { - super(); - - texture( Assets.ROTTING ); - - TextureFilm frames = new TextureFilm( texture, 24, 17 ); - - idle = new Animation( 2, true ); - idle.frames( frames, 0, 0, 1 ); - - run = new Animation( 3, true ); - run.frames( frames, 0, 1 ); - - attack = new Animation( 2, false ); - attack.frames( frames, 0 ); - - die = new Animation( 10, false ); - die.frames( frames, 0, 2, 3, 4 ); - - play( idle ); - } - - @Override - public void attack( int cell ) { - super.attack( cell ); - - speed.set( 0, -FALL_SPEED ); - acc.set( 0, FALL_SPEED * 4 ); - } - - @Override - public void onComplete( Animation anim ) { - super.onComplete( anim ); - if (anim == attack) { - speed.set( 0 ); - acc.set( 0 ); - place( ch.pos ); - - Camera.main.shake( 4, 0.2f ); - } - } -}