Commit 18357e49 authored by Zéfling's avatar Zéfling 🎨
Browse files

nouveau décor

24/03/2008
parent 744f11d8

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sokoban", "WindowsApplication1\Sokoban.csproj", "{65B7010D-5D30-4535-B221-797D1E8D4FCF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sokoban", "Sokoban\Sokoban.csproj", "{65B7010D-5D30-4535-B221-797D1E8D4FCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
No preview for this file type
......@@ -26,7 +26,7 @@ namespace Sokoban.Jeu.Action
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void act_Niveau(ecran_Niveau niveau, KeyPressEventArgs e)
/*public static void act_Niveau(ecran_Niveau niveau, KeyPressEventArgs e)
{
if (e.KeyChar.Equals(Keys.Right))
{
......@@ -44,6 +44,6 @@ namespace Sokoban.Jeu.Action
{
niveau.deplacement(1, 0);
}
}
}*/
}
}
......@@ -12,32 +12,37 @@ namespace Sokoban.Jeu.Affichage
public partial class ecran_Jeu : UserControl
{
public static int MUR = 0;
public static int SOL = 1;
public static int ARRIVEE = 2;
public const int MUR = 0;
public const int SOL = 1;
public const int ARRIVEE = 2;
public static int RIEN = 0;
public static int CAISSE = 1;
public const int RIEN = 0;
public const int CAISSE = 1;
public int[,] niveau ;
public int[,] niveauElements ;
public int _xpas = 25;
public int _ypas = 25;
public int _x = 25;
public int _y = 25;
public int _xpos = 1;
public int _ypos = 1;
public int mouvements = 0;
public int nombreCaisse = 0;
public int[] etatCaisse;
public bool fin;
public String appPath = Application.StartupPath;
public System.Windows.Forms.PictureBox[] caisses;
private int[,] niveau;
private int[,] niveauElements;
private int _xpas = 20;
private int _ypas = 20;
private int _x = 0;
private int _y = 0;
private int _xpos = 1;
private int _ypos = 1;
private int mouvements = 0;
private int nombreCaisse = 0;
private int[] etatCaisse;
private bool fin;
private String appPath = Application.StartupPath;
private System.Windows.Forms.PictureBox[] caisses;
public ecran_Jeu()
private ecran_Niveau eNiv;
public ecran_Jeu(ecran_Niveau eNiv, int nivLevel, int nivId)
{
this.eNiv = eNiv;
this.Focus();
InitializeComponent();
Fichier niveauCharger = new Fichier("defaut", 1, 1);
Fichier niveauCharger = new Fichier("defaut", nivLevel, nivId);
niveau = niveauCharger.getNiveau();
niveauElements = niveauCharger.getNiveauElements();
int[] joueur = niveauCharger.getJoueur();
......@@ -46,7 +51,7 @@ namespace Sokoban.Jeu.Affichage
_x = _xpos * _xpas;
_y = _ypos * _ypas;
personnage.ImageLocation = (appPath + @"\Images\perso_gauche.png");
personnage.ImageLocation = (@"Images\perso_gauche.gif");
personnage.Location = new System.Drawing.Point(_x, _y);
personnage.BackColor = Color.FromArgb(0, 0, 0, 0);
personnage.Size = new System.Drawing.Size(_xpas, _ypas);
......@@ -78,15 +83,15 @@ namespace Sokoban.Jeu.Affichage
if (niveauElements[i, j] > RIEN)
{
caisses[k] = new System.Windows.Forms.PictureBox();
caisses[k].Size = new System.Drawing.Size(25, 25);
caisses[k].Size = new System.Drawing.Size(_xpas, _ypas);
if (niveau[i, j] == ARRIVEE)
{
caisses[k].ImageLocation = (appPath + @"\Images\caisse_placee.png");
caisses[k].ImageLocation = (@"Images\caisse_placee.png");
etatCaisse[k - 1] = 1;
}
else
{
caisses[k].ImageLocation = (appPath + @"\Images\caisse.png");
caisses[k].ImageLocation = (@"Images\caisse.png");
}
caisses[k].Location = new System.Drawing.Point(j * _ypas, i * _xpas);
Controls.Add(caisses[k]);
......@@ -105,29 +110,30 @@ namespace Sokoban.Jeu.Affichage
{
for (int j = 0; j < nombreCaseX; j++)
{
if (niveau[i,j] > MUR )
{
sol[i,j] = new System.Windows.Forms.PictureBox();
sol[i,j].Size = new System.Drawing.Size(25, 25);
if (niveau[i, j] == SOL)
{
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]);
sol[i,j] = new System.Windows.Forms.PictureBox();
sol[i,j].Size = new System.Drawing.Size(_xpas, _ypas);
switch (niveau[i, j]) {
case SOL :
sol[i, j].ImageLocation = (@"Images\sol.png");
break;
case MUR:
sol[i, j].ImageLocation = (@"Images\mur.png");
break;
case ARRIVEE :
sol[i, j].ImageLocation = (@"Images\zone.png");
break;
}
sol[i,j].Location = new System.Drawing.Point(j*_ypas,i*_xpas);
Controls.Add(sol[i,j]);
}
}
}
private Fichier Fichier(char p,int p_2,int p_3)
{
throw new Exception("The method or operation is not implemented.");
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
......@@ -135,19 +141,19 @@ namespace Sokoban.Jeu.Affichage
{
case Keys.Right:
deplacement(1, 0);
personnage.ImageLocation = (appPath + @"\Images\perso_droite.png");
personnage.ImageLocation = (@"Images\perso_droite.gif");
return true;
case Keys.Left:
deplacement(-1, 0);
personnage.ImageLocation = (appPath + @"\Images\perso_gauche.png");
personnage.ImageLocation = (@"Images\perso_gauche.gif");
return true;
case Keys.Up:
deplacement(0, -1);
personnage.ImageLocation = (appPath + @"\Images\perso_haut.png");
personnage.ImageLocation = (@"Images\perso_haut.gif");
return true;
case Keys.Down:
deplacement(0, 1);
personnage.ImageLocation = (appPath + @"\Images\perso_bas.png");
personnage.ImageLocation = (@"Images\perso_bas.gif");
return true;
default: return base.ProcessCmdKey(ref msg, keyData);
}
......@@ -168,14 +174,14 @@ namespace Sokoban.Jeu.Affichage
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");
caisses[id].ImageLocation = (@"Images\caisse_placee.png");
etatCaisse[id-1] = 1;
testFin();
}
else
{
caisses[id].ImageLocation = (appPath + @"\Images\caisse.png");
caisses[id].ImageLocation = (@"Images\caisse.png");
etatCaisse[id-1] = 0;
}
......@@ -183,17 +189,16 @@ namespace Sokoban.Jeu.Affichage
niveauElements[_ypos + y, _xpos + x] = 0;
}
undoAdd(_xpos, _ypos);
_xpos += x;
_ypos += y;
_x += x * _xpas;
_y += y * _ypas;
mouvements++;
}
personnage.Location = new System.Drawing.Point(_x, _y);
eNiv.mouvementChange(mouvements);
personnage.Location = new System.Drawing.Point(_x, _y);
}
if (fin)
{
......@@ -202,6 +207,11 @@ namespace Sokoban.Jeu.Affichage
}
private void undoAdd(int x, int y)
{
}
public void testFin()
{
int compteur = 0;
......
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