Browse code

Stone is ready

Pierre Marijon authored on 18/05/2015 19:17:34
Showing 3 changed files
... ...
@@ -25,7 +25,7 @@
25 25
 55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,
26 26
 55,55,55,0,141,0,0,55,55,0,0,55,0,1,55,
27 27
 55,55,26,0,0,0,26,55,0,0,0,55,0,0,55,
28
-55,0,0,0,0,0,0,55,4,0,4,0,4,0,55,
28
+55,13,0,0,0,0,0,55,4,0,4,0,4,0,55,
29 29
 55,0,0,0,0,0,0,55,0,4,55,55,0,0,55,
30 30
 55,0,0,0,55,55,55,55,0,4,0,55,0,55,55,
31 31
 55,0,0,0,0,55,0,0,0,0,0,0,0,55,55,
... ...
@@ -35,8 +35,10 @@ import im.bci.tmxloader.TmxTileInstance;
35 35
 import im.bci.tmxloader.TmxTileInstanceEffect;
36 36
 import java.util.ArrayList;
37 37
 import java.util.EnumSet;
38
+import java.util.HashSet;
38 39
 import java.util.List;
39 40
 import java.util.Random;
41
+import java.util.Set;
40 42
 import org.geekygoblin.nedetlesmaki.core.components.LevelBackground;
41 43
 import org.geekygoblin.nedetlesmaki.core.components.gamesystems.Plate;
42 44
 import org.geekygoblin.nedetlesmaki.core.backend.Position;
... ...
@@ -212,9 +214,21 @@ public abstract class AbstractStartGameTrigger implements IStartGameTrigger {
212 214
         if ("dark_stairs_close_left".equals(type)) {
213 215
             return createStairs(tile, game, x, y, l, layer, Position.getLeft());
214 216
         }
217
+        if ("dark_stairs_close_right".equals(type)) {
218
+            return createStairs(tile, game, x, y, l, layer, Position.getRight());
219
+        }
215 220
         if ("low_stairs".equals(type)) {
216 221
             return createLowStairs(tile, game, x, y, l, layer);
217 222
         }
223
+        if ("green_stele_out".equals(type)) {
224
+            return createStone(tile, game, x, y, l, layer, ColorType.green, true);
225
+        }
226
+        if ("orange_stele_out".equals(type)) {
227
+            return createStone(tile, game, x, y, l, layer, ColorType.orange, true);
228
+        }
229
+        if ("blue_stele_out".equals(type)) {
230
+            return createStone(tile, game, x, y, l, layer, ColorType.blue, true);
231
+        }
218 232
         return createDecoration(tile, game, x, y, l, layer);
219 233
     }
220 234
 
... ...
@@ -402,6 +416,17 @@ public abstract class AbstractStartGameTrigger implements IStartGameTrigger {
402 416
         return this.createWall(tile, game, x, y, l, layer);
403 417
     }
404 418
 
419
+    protected Entity createStone(TmxTileInstance tile, NedGame game, int x, int y, int l, TmxLayer layer, ColorType c, boolean pushed) {
420
+        Entity stone = game.createEntity();
421
+        Stone obj = new Stone(new PositionIndexed(x, y, index), stone, index, assets);
422
+        obj.setColorType(c);
423
+        stone.addComponent(obj);
424
+        createSprite(x, y, l, tile, ApparitionEffect.FROM_ABOVE, stone);
425
+        game.addEntity(stone);
426
+        index.addStone(obj, new Position(x, y));
427
+        return stone;
428
+    }
429
+
405 430
     protected abstract void createProjector(NedGame game);
406 431
 
407 432
     @Override
... ...
@@ -46,7 +46,7 @@ public class Stone extends GameObject {
46 46
     public Stone(PositionIndexed pos, Entity entity, LevelIndex index, IAssets assets) {
47 47
         super(pos, entity, index);
48 48
 
49
-        this.animation = assets.getAnimations("animation/stones/steles.json");
49
+        this.animation = assets.getAnimations("animation/steles/steles.json");
50 50
         this.pushed = false;
51 51
     }
52 52
 
... ...
@@ -110,5 +110,8 @@ public class Stone extends GameObject {
110 110
                 updatable.startAnimation(this.animation.getAnimationByName("stele_blue_pushed"), PlayMode.ONCE);
111 111
             }
112 112
         }
113
+
114
+        this.entity.addComponent(updatable);
115
+        this.entity.changedInWorld();
113 116
     }
114 117
 }