Exemplo n.º 1
0
        public void PaintCell(Graphics g, bool sw)
        {
            Pen pen1;

            //if (this.status == false)
            //    pen1 = new Pen(Color.Red, 2);
            //else
            pen1 = new Pen(Color.Aqua, 2);
            g.DrawRectangle(pen1, this.x, this.y, 30, 30);
            if (sw == true && this.s != null)
            {
                s.SetX(this.x);
                s.SetY(this.y);
                s.PaintShip(g);
            }
            Point p = new Point(this.x + 3, this.y + 3);

            if (this.hit == 1)
            {
                this.pic = Image.FromFile("splash.png");
            }
            else if (this.hit == 2)
            {
                this.pic = Image.FromFile("boom.png");
            }
            g.DrawImage(pic, p);
        }
Exemplo n.º 2
0
 private void Game1_Paint(object sender, PaintEventArgs e)
 {
     g = e.Graphics;
     if (boardCreated == false)
     {
         s1.PaintShip(g);
         s2.PaintShip(g);
         s3.PaintShip(g);
         s4.PaintShip(g);
         s5.PaintShip(g);
         EnemyTurn.Hide();
         PlayerTurn.Hide();
         player.Hide();
         enemy.Hide();
         game1.PaintBoard(g);
     }
     else
     {
         game1.MoveBoard(150, 150);
         game2.PaintBoard2(g);
         player.Show();
         enemy.Show();
         battle.Hide();
         explain.Hide();
         if (t == 0)
         {
             EnemyTurn.Hide();
             PlayerTurn.Show();
         }
         else
         {
             PlayerTurn.Hide();
             EnemyTurn.Show();
         }
     }
     game1.PaintBoard(g);
 }