Пример #1
0
 public FormGame(Parametres parametres)
 {
     if (parametres.difficulte == Parametres.Difficulte.Facile)
     {
         this.joueur = new Joueur(15);
         this.enemy  = new Ennemie(4);
     }
     else if (parametres.difficulte == Parametres.Difficulte.Intermediaire)
     {
         this.joueur = new Joueur(17);
         this.enemy  = new Ennemie(4);
     }
     else
     {
         this.joueur = new Joueur(18);
         this.enemy  = new Ennemie(5);
     }
     this.parametres = parametres;
     InitializeComponent();
 }
Пример #2
0
 private void Draw()
 {
     gameImage = new Bitmap(graphic.GetWidth(), graphic.GetHeight());
     graphic.GetGameImage().Dispose();
     using (Graphics graphics = Graphics.FromImage(gameImage))
     {
         graphics.DrawImage(graphic.GetBackgroundImage(), 0, 0);
         graphics.DrawImage(joueur.GetPlayerImage(), joueur.GetPositionJoueurX(), joueur.GetPositionJoueurY());
         for (int i = 0; i < projectiles.Count; i++)
         {
             graphics.DrawImage(projectiles[i].GetProjectileImage(), projectiles[i].GetPositionProjectileX(), projectiles[i].GetPositionProjectileY());
         }
         if (enemy.GetPositionEnemyY() == 0 || enemy.GetPositionEnemyY() > graphic.GetHeight())
         {
             if (parametres.difficulte == Parametres.Difficulte.Facile)
             {
                 this.enemy = new Ennemie(4);
             }
             else if (parametres.difficulte == Parametres.Difficulte.Intermediaire)
             {
                 this.enemy = new Ennemie(4);
             }
             else
             {
                 this.enemy = new Ennemie(5);
             }
             if (tick % DeuxsecondesEnTick == 0 || tick == 0)
             {
                 graphics.DrawImage(enemy.GetEnemyImage(), enemy.GetPositionEnemyX(), enemy.GetPositionEnemyY());
             }
         }
         else
         {
             graphics.DrawImage(enemy.GetEnemyImage(), enemy.GetPositionEnemyX(), enemy.GetPositionEnemyY());
         }
     }
     this.BackgroundImage = gameImage;
 }