Mode bourin add Bonhome qui Saute+casquette+volcan

This commit is contained in:
adri 2018-01-11 14:33:44 +01:00
parent e2036ae945
commit c530c68fc1
9 changed files with 112 additions and 10 deletions

View File

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

View File

@ -77,6 +77,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="ClassDiagram5.cd" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -105,5 +106,8 @@
<ItemGroup>
<None Include="Resources\Super Mario Bros Win Stage Sound Effect.wav" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\erupting-volcano_icon-icons.com_70746.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

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

View File

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

View File

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

View File

@ -60,6 +60,16 @@ namespace Bonhomme02.Properties {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
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));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>

View File

@ -118,16 +118,19 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="moon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\moon.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NyanCatoriginal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NyanCatoriginal.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Super_Mario_Bros_Win_Stage_Sound_Effect" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Super Mario Bros Win Stage Sound Effect.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="tumblr_opsismTLqh1vghf22o1_400" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tumblr_opsismTLqh1vghf22o1_400.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NyanCatoriginal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NyanCatoriginal.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="moon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\moon.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="erupting-volcano_icon-icons.com_70746" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\erupting-volcano_icon-icons.com_70746.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

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