Commit 766d66d6 authored by Zéfling's avatar Zéfling 🎨
Browse files

Et les zones d'arrivés avec la caisse qui change de couleur.

16/03/2008
parent 936ee29a
......@@ -17,9 +17,9 @@ namespace Sokoban_Jeu
{0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,0,1,1,1,1,1,1,2,1,1,1,0},
{0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,0},
{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
......@@ -101,18 +101,23 @@ namespace Sokoban_Jeu
{
for (int j = 0; j < nombreCaseX; j++)
{
if (niveau[i,j] == 1 )
if (niveau[i,j] >= 1 )
{
sol[i,j] = new System.Windows.Forms.PictureBox();
sol[i,j].Size = new System.Drawing.Size(25, 25);
sol[i,j].ImageLocation = (appPath + @"\..\..\Images\sol.png");
if (niveau[i, j] == 1)
{
sol[i, j].ImageLocation = (appPath + @"\..\..\Images\sol.png");
}
else
{
sol[i, j].ImageLocation = (appPath + @"\..\..\Images\zone.png");
}
sol[i,j].Location = new System.Drawing.Point(j*_ypas,i*_xpas);
Controls.Add(sol[i,j]);
}
}
}
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
......@@ -151,8 +156,16 @@ namespace Sokoban_Jeu
if (testCaisse(x, y))
{
int id = niveauElements[_ypos + y, _xpos + x];
System.Console.WriteLine(id);
caisses[id].Location = new System.Drawing.Point((x*2 + _xpos) * _xpas, (y*2 + _ypos) * _ypas);
if (testCaissePlacee(x*2, y*2))
{
caisses[id].ImageLocation = (appPath + @"\..\..\Images\caisse_placee.png");
}
else
{
caisses[id].ImageLocation = (appPath + @"\..\..\Images\caisse.png");
}
niveauElements[_ypos + 2 * y, _xpos + 2 * x] = niveauElements[_ypos + y, _xpos + x];
niveauElements[_ypos + y, _xpos + x] = 0;
}
......@@ -164,8 +177,7 @@ namespace Sokoban_Jeu
mouvements++;
}
System.Console.WriteLine(_xpos + " " + _ypos);
System.Console.WriteLine(niveauElements);
personnage.Location = new System.Drawing.Point(_x, _y);
}
......@@ -174,7 +186,7 @@ namespace Sokoban_Jeu
{
/* 0 = mur
* 1 = sol
* 2 = support
* 2 = arrives
*/
if (niveau[ _ypos + y, _xpos + x] >= 1)
......@@ -195,6 +207,7 @@ namespace Sokoban_Jeu
return false;
}
}
public bool testCaisse(int x, int y)
{
/* 0 = mur
......@@ -203,7 +216,6 @@ namespace Sokoban_Jeu
if (niveauElements[_ypos + y, _xpos + x] >= 1)
{
System.Console.WriteLine("*");
return true;
}
else
......@@ -211,5 +223,17 @@ namespace Sokoban_Jeu
return false;
}
}
public bool testCaissePlacee(int x, int y)
{
if (niveau[_ypos + y, _xpos + x] == 2)
{
return true;
}
else
{
return false;
}
}
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment