From dd3549e558c958210e3773dbed719bbe1dfaee70 Mon Sep 17 00:00:00 2001 From: galaxyoyo Date: Fri, 9 Jan 2015 19:45:27 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=C3=A9=20collision=20d'items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/galaxyoyo/unknown/api/editor/Case.java | 9 ++++++++- .../java/galaxyoyo/unknown/api/editor/EditorAPI.java | 2 +- src/main/java/galaxyoyo/unknown/api/editor/RawCase.java | 9 ++++++++- src/main/java/galaxyoyo/unknown/editor/Map.java | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/galaxyoyo/unknown/api/editor/Case.java b/src/main/java/galaxyoyo/unknown/api/editor/Case.java index 6aec52d..6182c3b 100644 --- a/src/main/java/galaxyoyo/unknown/api/editor/Case.java +++ b/src/main/java/galaxyoyo/unknown/api/editor/Case.java @@ -9,6 +9,7 @@ public class Case private Sprite couche1; private Sprite couche2; private Sprite couche3; + private Collision collision; public int getPosX() { @@ -35,7 +36,12 @@ public class Case return couche3; } - public static Case create(int posX, int posY, Sprite couche1, Sprite couche2, Sprite couche3) + public Collision getCollision() + { + return collision; + } + + public static Case create(int posX, int posY, Sprite couche1, Sprite couche2, Sprite couche3, Collision collision) { Case c = new Case(); c.x = posX; @@ -43,6 +49,7 @@ public class Case c.couche1 = couche1; c.couche2 = couche2; c.couche3 = couche3; + c.collision = collision; return c; } } diff --git a/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java b/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java index 9164da4..ead626b 100644 --- a/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java +++ b/src/main/java/galaxyoyo/unknown/api/editor/EditorAPI.java @@ -27,7 +27,7 @@ public class EditorAPI { for (int x = 1; x < width; x += 16) { - RawCase c = RawCase.create(x / 16, y / 16, RawSprite.BLANK, RawSprite.BLANK, RawSprite.BLANK); + RawCase c = RawCase.create(x / 16, y / 16, RawSprite.BLANK, RawSprite.BLANK, RawSprite.BLANK, Collision.ANY); cases.add(c); } } diff --git a/src/main/java/galaxyoyo/unknown/api/editor/RawCase.java b/src/main/java/galaxyoyo/unknown/api/editor/RawCase.java index 94caeeb..3611ce8 100644 --- a/src/main/java/galaxyoyo/unknown/api/editor/RawCase.java +++ b/src/main/java/galaxyoyo/unknown/api/editor/RawCase.java @@ -7,6 +7,7 @@ public class RawCase private RawSprite couche1; private RawSprite couche2; private RawSprite couche3; + private Collision collision; public int getPosX() { @@ -33,7 +34,12 @@ public class RawCase return couche3; } - public static RawCase create(int posX, int posY, RawSprite couche1, RawSprite couche2, RawSprite couche3) + public Collision getCollision() + { + return collision; + } + + public static RawCase create(int posX, int posY, RawSprite couche1, RawSprite couche2, RawSprite couche3, Collision collision) { RawCase c = new RawCase(); c.x = posX; @@ -41,6 +47,7 @@ public class RawCase c.couche1 = couche1; c.couche2 = couche2; c.couche3 = couche3; + c.collision = collision;; return c; } } diff --git a/src/main/java/galaxyoyo/unknown/editor/Map.java b/src/main/java/galaxyoyo/unknown/editor/Map.java index 3fff9ca..3747f28 100644 --- a/src/main/java/galaxyoyo/unknown/editor/Map.java +++ b/src/main/java/galaxyoyo/unknown/editor/Map.java @@ -25,7 +25,7 @@ public class Map for (RawCase rc : raw.getCases()) { - cases.add(Case.create(rc.getPosX(), rc.getPosY(), SpriteRegister.getCategory(rc.getCoucheOne().getPrimaryIndex()).getSprites().get(rc.getCoucheOne().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheTwo().getPrimaryIndex()).getSprites().get(rc.getCoucheTwo().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheThree().getPrimaryIndex()).getSprites().get(rc.getCoucheThree().getSecondaryIndex()))); + cases.add(Case.create(rc.getPosX(), rc.getPosY(), SpriteRegister.getCategory(rc.getCoucheOne().getPrimaryIndex()).getSprites().get(rc.getCoucheOne().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheTwo().getPrimaryIndex()).getSprites().get(rc.getCoucheTwo().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheThree().getPrimaryIndex()).getSprites().get(rc.getCoucheThree().getSecondaryIndex()), rc.getCollision())); } frame = new EditorFrame(this);