Possibilité de placer un sprite d'une couche sans nécessité qu'une

couche précédente existe
This commit is contained in:
galaxyoyo 2015-01-13 15:42:32 +01:00
parent 1c2d673bec
commit c47939957d
2 changed files with 14 additions and 17 deletions

View File

@ -41,33 +41,33 @@ public class MapPanel extends JPanel
g.drawImage(getMap().getFont(), x, y, width, height, null);
for (Case c : getMap().getAllCases())
{
if (isEmpty(c.getCoucheOne().getImage()))
continue;
{
// BufferedImage image;
g.drawImage(c.getCoucheOne().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
if (!isEmpty(c.getCoucheOne().getImage()))
{
g.drawImage(c.getCoucheOne().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
}
/* if (frame.getSelectedLayerIndex() != 0)
{
image = recalculateAplha(c.getCoucheOne().getImage(), 0);
g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
}*/
if (isEmpty(c.getCoucheTwo().getImage()) || (frame.getSelectedLayerIndex() != 1 && frame.getSelectedLayerIndex() != 2))
continue;
g.drawImage(c.getCoucheTwo().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
if (!isEmpty(c.getCoucheTwo().getImage()) || (frame.getSelectedLayerIndex() != 1 && frame.getSelectedLayerIndex() != 2))
{
g.drawImage(c.getCoucheTwo().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
}
/* if (frame.getSelectedLayerIndex() != 1)
{
image = recalculateAplha(c.getCoucheTwo().getImage(), 1);
g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
}*/
if (isEmpty(c.getCoucheThree().getImage()) || frame.getSelectedLayerIndex() != 2)
continue;
g.drawImage(c.getCoucheThree().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
if (!isEmpty(c.getCoucheThree().getImage()) || frame.getSelectedLayerIndex() != 2)
{
g.drawImage(c.getCoucheThree().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
}
/* if (frame.getSelectedLayerIndex() != 2)
{
image = recalculateAplha(c.getCoucheThree().getImage(), 2);

View File

@ -38,10 +38,7 @@ public class MapMouseListener extends MouseAdapter
if ((c = map.getCase((event.getX() - x + 2) / 34, (event.getY() - y + 2) / 34)) != null && event.getX() - x >= 2 && event.getY() - y >= 2)
{
if (getFrame().getSelectedSprite() != null)
{
if (getFrame().getSelectedSprite().getCouche() - 1 > getFrame().getSelectedLayerIndex())
return;
{
Case n;
switch (getFrame().getSelectedSprite().getCouche())