Ajouté collision d'items

This commit is contained in:
galaxyoyo 2015-01-09 19:45:27 +01:00
parent e5279e407d
commit dd3549e558
4 changed files with 18 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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);