Skip to content

Commit bf7c56a

Browse files
committed
fix: bug in latest commit when not playing sound when reverse mode.
1 parent 90c1379 commit bf7c56a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

blade-engine/src/com/bladecoder/engine/model/CharacterActor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,34 +104,34 @@ public void lookat(Vector2 p) {
104104
posTween = null;
105105
renderer.startAnimation(standAnim, Tween.Type.SPRITE_DEFINED, -1, null, new Vector2(bbox.getX(), bbox.getY()),
106106
p);
107-
outAnim();
107+
outAnim(Tween.Type.SPRITE_DEFINED);
108108
}
109109

110110
public void lookat(String direction) {
111111
inAnim();
112112
posTween = null;
113113
renderer.startAnimation(standAnim, Tween.Type.SPRITE_DEFINED, -1, null, direction);
114-
outAnim();
114+
outAnim(Tween.Type.SPRITE_DEFINED);
115115
}
116116

117117
public void stand() {
118118
inAnim();
119119
posTween = null;
120120
renderer.startAnimation(standAnim, Tween.Type.SPRITE_DEFINED, -1, null, null);
121-
outAnim();
121+
outAnim(Tween.Type.SPRITE_DEFINED);
122122
}
123123

124124
public void talk() {
125125
inAnim();
126126
posTween = null;
127127
renderer.startAnimation(talkAnim, Tween.Type.SPRITE_DEFINED, -1, null, null);
128-
outAnim();
128+
outAnim(Tween.Type.SPRITE_DEFINED);
129129
}
130130

131131
public void startWalkAnim(Vector2 p0, Vector2 pf) {
132132
inAnim();
133133
renderer.startAnimation(walkAnim, Tween.Type.SPRITE_DEFINED, -1, null, p0, pf);
134-
outAnim();
134+
outAnim(Tween.Type.SPRITE_DEFINED);
135135
}
136136

137137
/**

blade-engine/src/com/bladecoder/engine/model/SpriteActor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.bladecoder.engine.anim.SpritePosTween;
2525
import com.bladecoder.engine.anim.SpriteScaleTween;
2626
import com.bladecoder.engine.anim.Tween;
27+
import com.bladecoder.engine.anim.Tween.Type;
2728
import com.bladecoder.engine.anim.WalkTween;
2829
import com.bladecoder.engine.assets.EngineAssetManager;
2930
import com.bladecoder.engine.util.EngineLogger;
@@ -154,7 +155,7 @@ public void startAnimation(String id, Tween.Type repeatType, int count, ActionCa
154155
EngineLogger.debug("ANIMATION: " + this.id + "." + id);
155156
renderer.startAnimation(id, repeatType, count, cb);
156157

157-
outAnim();
158+
outAnim(repeatType);
158159
}
159160

160161
/**
@@ -181,13 +182,14 @@ protected void inAnim() {
181182
/**
182183
* Actions to do when setting an animation: - play animation sound - add
183184
* 'in' distance
185+
* @param repeatType
184186
*/
185-
protected void outAnim() {
187+
protected void outAnim(Type repeatType) {
186188
AnimationDesc fa = renderer.getCurrentAnimation();
187189

188190
if (fa != null) {
189191

190-
if (fa.sound != null && fa.animationType != Tween.Type.REVERSE) {
192+
if (fa.sound != null && repeatType != Tween.Type.REVERSE) {
191193
playSound(fa.sound);
192194
}
193195

0 commit comments

Comments
 (0)