Browse code

Ned didn't make unnecessary step

Pierre Marijon authored on 04/05/2015 19:34:12
Showing 1 changed files
... ...
@@ -130,42 +130,54 @@ public class Ned extends GameObject {
130 130
         if (type == MoveType.WALK) { // Walk animation
131 131
             if (diff.equals(Position.getUp())) {
132 132
                 updatable.startAnimation(this.animation.getAnimationByName("walk_up"), PlayMode.ONCE)
133
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
133
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
134
+                        .stopAnimation();
134 135
             } else if (diff.equals(Position.getDown())) {
135 136
                 updatable.startAnimation(this.animation.getAnimationByName("walk_down"), PlayMode.ONCE)
136
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
137
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
138
+                        .stopAnimation();
137 139
             } else if (diff.equals(Position.getRight())) {
138 140
                 updatable.startAnimation(this.animation.getAnimationByName("walk_right"), PlayMode.ONCE)
139
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
141
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
142
+                        .stopAnimation();
140 143
             } else if (diff.equals(Position.getLeft())) {
141 144
                 updatable.startAnimation(this.animation.getAnimationByName("walk_left"), PlayMode.ONCE)
142
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
145
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
146
+                        .stopAnimation();
143 147
             }
144 148
         } else if (type == MoveType.PUSH) { // Push animation
145 149
             if (diff.equals(Position.getUp()) && undo) {
146 150
                 updatable.startAnimation(this.animation.getAnimationByName("push_down"), PlayMode.ONCE)
147
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
151
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
152
+                        .stopAnimation();
148 153
             } else if (diff.equals(Position.getDown()) && undo) {
149 154
                 updatable.startAnimation(this.animation.getAnimationByName("push_up"), PlayMode.ONCE)
150
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
155
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
156
+                        .stopAnimation();
151 157
             } else if (diff.equals(Position.getRight()) && undo) {
152 158
                 updatable.startAnimation(this.animation.getAnimationByName("push_left"), PlayMode.ONCE)
153
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
159
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
160
+                        .stopAnimation();
154 161
             } else if (diff.equals(Position.getLeft()) && undo) {
155 162
                 updatable.startAnimation(this.animation.getAnimationByName("push_right"), PlayMode.ONCE)
156
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
163
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
164
+                        .stopAnimation();
157 165
             } else if (diff.equals(Position.getUp())) {
158 166
                 updatable.startAnimation(this.animation.getAnimationByName("push_up"), PlayMode.ONCE)
159
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
167
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
168
+                        .stopAnimation();
160 169
             } else if (diff.equals(Position.getDown())) {
161 170
                 updatable.startAnimation(this.animation.getAnimationByName("push_down"), PlayMode.ONCE)
162
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
171
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
172
+                        .stopAnimation();
163 173
             } else if (diff.equals(Position.getRight())) {
164 174
                 updatable.startAnimation(this.animation.getAnimationByName("push_right"), PlayMode.ONCE)
165
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
175
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
176
+                        .stopAnimation();
166 177
             } else if (diff.equals(Position.getLeft())) {
167 178
                 updatable.startAnimation(this.animation.getAnimationByName("push_left"), PlayMode.ONCE)
168
-                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base);
179
+                        .moveToRelative(new Vector3(diff.getY(), diff.getX(), 0), AnimationTime.base)
180
+                        .stopAnimation();
169 181
             }
170 182
         } else if (type == MoveType.WAIT) { // Wait animation
171 183
             if (diff.equals(Position.getUp())) {