diff --git a/Bonhomme02/Bonhomme.cs b/Bonhomme02/Bonhomme.cs index ab9dbde..a4bba50 100644 --- a/Bonhomme02/Bonhomme.cs +++ b/Bonhomme02/Bonhomme.cs @@ -37,7 +37,9 @@ namespace Bonhomme02 { this.conteneur = hebergeur; Peau me = this; - jambe1 = new Jambe(hebergeur, ref me, lg, ep/4, Math.PI / 2);
 jambe2 = new Jambe(hebergeur, ref me, lg, ep / 4, Math.PI / 2);
 tete = new Tete(hebergeur, ref me, (int)(ep*3.5/4)); + jambe1 = new Jambe(hebergeur, ref me, lg, ep/4, Math.PI / 2); + jambe2 = new Jambe(hebergeur, ref me, lg, ep / 4, Math.PI / 2); + tete = new Tete(hebergeur, ref me, (int)(ep*3.5/4)); bras = new Bras(hebergeur, ref me, lg, ep/4, Math.PI / 2); } public Bonhomme(ref PictureBox hebergeur, ref Peau parent, double lg, double ep, double angle) : base( hebergeur, ref parent, lg, ep, angle) diff --git a/Bonhomme02/Bonhomme02.csproj b/Bonhomme02/Bonhomme02.csproj index 72df1ea..16cb894 100644 --- a/Bonhomme02/Bonhomme02.csproj +++ b/Bonhomme02/Bonhomme02.csproj @@ -77,6 +77,7 @@ Resources.resx True + SettingsSingleFileGenerator Settings.Designer.cs @@ -105,5 +106,8 @@ + + + \ No newline at end of file diff --git a/Bonhomme02/Form1.Designer.cs b/Bonhomme02/Form1.Designer.cs index e746409..ae42d5f 100644 --- a/Bonhomme02/Form1.Designer.cs +++ b/Bonhomme02/Form1.Designer.cs @@ -34,10 +34,12 @@ namespace Bonhomme02 this.components = new System.ComponentModel.Container(); this.timerImage = new System.Windows.Forms.Timer(this.components); this.btnCreationCarrosse = new System.Windows.Forms.Button(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.NyanCatGif = new System.Windows.Forms.PictureBox(); this.Obstacle = new System.Windows.Forms.PictureBox(); this.Sol = new System.Windows.Forms.PictureBox(); this.TV = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NyanCatGif)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.Obstacle)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.Sol)).BeginInit(); @@ -59,6 +61,19 @@ namespace Bonhomme02 this.btnCreationCarrosse.UseVisualStyleBackColor = true; this.btnCreationCarrosse.Click += new System.EventHandler(this.btnCreationCarrosse_Click); // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.Gray; + this.pictureBox1.BackgroundImage = global::Bonhomme02.Properties.Resources.erupting_volcano_icon_icons_com_70746; + this.pictureBox1.Image = global::Bonhomme02.Properties.Resources.erupting_volcano_icon_icons_com_70746; + this.pictureBox1.Location = new System.Drawing.Point(13, 206); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(137, 214); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); + // // NyanCatGif // this.NyanCatGif.BackColor = System.Drawing.Color.Gray; @@ -107,12 +122,14 @@ namespace Bonhomme02 this.Controls.Add(this.Obstacle); this.Controls.Add(this.Sol); this.Controls.Add(this.btnCreationCarrosse); + this.Controls.Add(this.pictureBox1); this.Controls.Add(this.TV); this.DoubleBuffered = true; this.Name = "Form1"; this.Text = "Dessins Animés"; this.Load += new System.EventHandler(this.Form1_Load); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NyanCatGif)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.Obstacle)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.Sol)).EndInit(); @@ -127,9 +144,11 @@ namespace Bonhomme02 private System.Windows.Forms.PictureBox TV; private System.Windows.Forms.Timer timerImage; private System.Windows.Forms.Button btnCreationCarrosse; + private PictureBox pictureBox1; private System.Windows.Forms.PictureBox Sol; private System.Windows.Forms.PictureBox Obstacle; private System.Windows.Forms.PictureBox NyanCatGif; + } } diff --git a/Bonhomme02/Form1.cs b/Bonhomme02/Form1.cs index 867f699..53bad6a 100644 --- a/Bonhomme02/Form1.cs +++ b/Bonhomme02/Form1.cs @@ -16,7 +16,9 @@ namespace Bonhomme02 public partial class Form1 : Form { private Bonhomme bonhomme; + private Bonhomme bonhomme2; private Marcher marche; + private Marcher marche2; private BufferedGraphics bufferG = null; private Graphics g; SoundPlayer player = new SoundPlayer(); @@ -65,12 +67,18 @@ namespace Bonhomme02 if (tasks.Count == 0) { - bonhomme = new Bonhomme(ref this.TV, 80, 80, 50, 20, Math.PI / 2); + bonhomme = new Bonhomme(ref this.TV, 200, 80, 50, 20, Math.PI / 2); + bonhomme2 = new Bonhomme(ref this.TV, this.Width - 2 * 80, 80, 50, 20, Math.PI / 2); bonhomme.jambe1.Bas.Fond = bonhomme.jambe1.Millieux.Fond = bonhomme.jambe1.Haut.Fond = Color.Pink; bonhomme.jambe2.Bas.Fond = bonhomme.jambe2.Millieux.Fond = bonhomme.jambe2.Haut.Fond = Color.DeepPink; bonhomme.tete.Fond = Color.Pink; - bonhomme.Afficher(g); + bonhomme2.jambe1.Bas.Fond = bonhomme2.jambe1.Millieux.Fond = bonhomme2.jambe1.Haut.Fond = Color.Beige; + bonhomme2.jambe2.Bas.Fond = bonhomme2.jambe2.Millieux.Fond = bonhomme2.jambe2.Haut.Fond = Color.Bisque; + bonhomme2.tete.Fond = Color.Brown; marche = new Marcher(ref bonhomme, bufferG, this.Sol.Location.Y - this.TV.Location.Y); + marche2 = new Marcher(ref bonhomme2, bufferG, this.Sol.Location.Y - this.TV.Location.Y); + bonhomme2.Cacher(g); + bufferG.Render(); Thread.Sleep(1000); str = global::Bonhomme02.Properties.Resources.NyanCatoriginal; @@ -88,6 +96,9 @@ namespace Bonhomme02 player.Stop(); str = str = global::Bonhomme02.Properties.Resources.Super_Mario_Bros_Win_Stage_Sound_Effect; player.Stream = str; + + marche2.SautY(80,5); + bufferG.Render(); player.Play(); this.NyanCatGif.Image = null; } @@ -108,5 +119,10 @@ namespace Bonhomme02 MousePosition.Offset(this.Location); Console.WriteLine(MousePosition); } + + private void pictureBox1_Click(object sender, EventArgs e) + { + + } } } diff --git a/Bonhomme02/Marcher.cs b/Bonhomme02/Marcher.cs index 12fe08a..ee65a2b 100644 --- a/Bonhomme02/Marcher.cs +++ b/Bonhomme02/Marcher.cs @@ -362,7 +362,52 @@ namespace Bonhomme02 } Avancer(vitesse, bonhomme.conteneur.Location.X + bonhomme.conteneur.Width, 3); } - public void Rend() + public void SautY(int dy, int vitesse) + { + for(int i = 0; i<=dy; i+=resolution )//Monter + { + if (handle == null) + { + bonhomme.Cacher(gr); + } + else + bonhomme.Cacher(handle.Value); + bonhomme.Y -= resolution; + + if (handle == null) + { + bonhomme.Afficher(gr); + + } + else + bonhomme.Afficher(handle.Value); + if (handle == null) + Rend(); + Thread.Sleep(vitesse); + } + for (int i = 0; i <= dy; i += resolution)//Descendre + { + if (handle == null) + { + bonhomme.Cacher(gr); + } + else + bonhomme.Cacher(handle.Value); + bonhomme.Y += resolution; + + if (handle == null) + { + bonhomme.Afficher(gr); + + } + else + bonhomme.Afficher(handle.Value); + if (handle == null) + Rend(); + Thread.Sleep(vitesse); + } + } + public void Rend() { if (handle == null) { diff --git a/Bonhomme02/Properties/Resources.Designer.cs b/Bonhomme02/Properties/Resources.Designer.cs index 9d3a715..6b7e975 100644 --- a/Bonhomme02/Properties/Resources.Designer.cs +++ b/Bonhomme02/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ namespace Bonhomme02.Properties { } } + /// + /// Recherche une ressource localisée de type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap erupting_volcano_icon_icons_com_70746 { + get { + object obj = ResourceManager.GetObject("erupting-volcano_icon-icons.com_70746", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Recherche une ressource localisée de type System.Drawing.Bitmap. /// diff --git a/Bonhomme02/Properties/Resources.resx b/Bonhomme02/Properties/Resources.resx index 6793b0a..149e42d 100644 --- a/Bonhomme02/Properties/Resources.resx +++ b/Bonhomme02/Properties/Resources.resx @@ -118,16 +118,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\moon.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\NyanCatoriginal.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\Resources\Super Mario Bros Win Stage Sound Effect.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Resources\tumblr_opsismTLqh1vghf22o1_400.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\NyanCatoriginal.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\moon.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\erupting-volcano_icon-icons.com_70746.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Bonhomme02/Resources/erupting-volcano_icon-icons.com_70746.png b/Bonhomme02/Resources/erupting-volcano_icon-icons.com_70746.png new file mode 100644 index 0000000..7926a64 Binary files /dev/null and b/Bonhomme02/Resources/erupting-volcano_icon-icons.com_70746.png differ diff --git a/Bonhomme02/Tete.cs b/Bonhomme02/Tete.cs index 64e12d6..455d115 100644 --- a/Bonhomme02/Tete.cs +++ b/Bonhomme02/Tete.cs @@ -47,6 +47,7 @@ namespace Bonhomme02 if (base.Remplir) { gr.FillEllipse(new SolidBrush(base.Fond), posi.X, posi.Y, rayon * 2, rayon * 2); + gr.FillEllipse(new SolidBrush(Color.Aqua), posi.X, posi.Y, rayon * 2, rayon/4); } gr.DrawEllipse(new Pen(Brushes.Black), posi.X, posi.Y, rayon * 2, rayon * 2); } @@ -59,6 +60,7 @@ namespace Bonhomme02 if (base.Remplir) { gr.FillEllipse(new SolidBrush(base.Hebergeur.BackColor), posi.X, posi.Y, rayon * 2, rayon * 2); + gr.FillEllipse(new SolidBrush(base.Hebergeur.BackColor), posi.X + rayon / 2, posi.Y - rayon / 2, rayon * 2, rayon / 2); } gr.DrawEllipse(new Pen(base.Hebergeur.BackColor), posi.X, posi.Y, rayon * 2, rayon * 2); } @@ -73,6 +75,7 @@ namespace Bonhomme02 if (base.Remplir) { gr.FillEllipse(new SolidBrush(base.Fond), posi.X, posi.Y, rayon * 2, rayon * 2); + gr.FillEllipse(new SolidBrush(Color.Chocolate), posi.X+ rayon / 2, posi.Y-rayon / 2, rayon * 2, rayon / 2); } gr.DrawEllipse(new Pen(Brushes.Black), posi.X, posi.Y, rayon * 2, rayon * 2); }