private void NgauNhien(int vitri, int landau)
 {
     int rongchim = Convert.ToInt32(trochoi.ngaunhien.Next(10, 30));
     int daichim = rongchim;
     int toadoxchim = Convert.ToInt32(trochoi.ngaunhien.Next(10, trochoi.ktmanhinh.X));
     if (landau == 0) toadoxchim = -rongchim;
     int toadoychim = Convert.ToInt32(trochoi.ngaunhien.Next(0, 250 - daichim));
     if (madchimbayxa[vitri] == null)
     {
         madchimbayxa[vitri] = new MChayAnhDong(1, hachimbayxa, null, new Vector2(toadoxchim, toadoychim), true, null, trochoi.ktmanhinh, trochoi.tile);
     }
     else
     {
         madchimbayxa[vitri].DiChuyen(new Vector2(toadoxchim, toadoychim));
     }
     madchimbayxa[vitri].DoiKichThuoc(rongchim, daichim);
     tocdochimbayxa[vitri] = Convert.ToInt32(trochoi.ngaunhien.Next(1, 2 + (int)(rongchim / 10)));
 }
 private void NgauNhien(int vitri)
 {
     int rongset = Convert.ToInt32(trochoi.ngaunhien.Next(100, 250));
     int daiset = rongset;
     int toadoxset = Convert.ToInt32(trochoi.ngaunhien.Next(0, trochoi.ktmanhinh.X)) - Convert.ToInt32(rongset / 2);
     int toadoyset = Convert.ToInt32(trochoi.ngaunhien.Next(0, 380 - Convert.ToInt32(daiset / 2))) - Convert.ToInt32(daiset / 2);
     if (madsamset[vitri] == null)
     {
         madsamset[vitri] = new MChayAnhDong(1, hasamset, null, new Vector2(toadoxset, toadoyset), false, null, trochoi.ktmanhinh, trochoi.tile);
     }
     else
     {
         madsamset[vitri].DiChuyen(new Vector2(toadoxset, toadoyset));
         madsamset[vitri].ChayMoi();
     }
     madsamset[vitri].DoiKichThuoc(rongset, daiset);
     madsamset[vitri].XoayAnh(Convert.ToInt32(trochoi.ngaunhien.Next(0, 360)), new Vector2(100, 100));
     tgchayset[vitri] = 0;
     xuathiensamset[vitri] = Convert.ToInt32(trochoi.ngaunhien.Next(300, 500));
     if (daiset < 150) mamsamset[vitri] = amsamset1;
     else if (daiset < 200) mamsamset[vitri] = amsamset2;
     else mamsamset[vitri] = amsamset3;
     mbaochayamsamset[vitri] = 0;
 }
 public void NapTaiNguyen()
 {
     Texture2D[] anhtentrochoi = new Texture2D[18];
     for (int i = 0; i < 18; i++) anhtentrochoi[i] = trochoi.Content.Load<Texture2D>("HinhAnh/TenTroChoi/" + (i + 1).ToString());
     Texture2D[] anhnvcchay = new Texture2D[14];
     for (int i = 0; i < 14; i++) anhnvcchay[i] = trochoi.Content.Load<Texture2D>("HinhAnh/NVCChay/" + (i + 1).ToString());
     Texture2D[] anhnvcnhay = new Texture2D[10];
     for (int i = 0; i < 10; i++) anhnvcnhay[i] = trochoi.Content.Load<Texture2D>("HinhAnh/NVCNhay/" + (i + 1).ToString());
     Texture2D[] anhbui = new Texture2D[7];
     for (int i = 0; i < 7; i++) anhbui[i] = trochoi.Content.Load<Texture2D>("HinhAnh/Bui/" + (i + 1).ToString());
     Texture2D anhnennoinho = trochoi.Content.Load<Texture2D>("HinhAnh/NenNoiNho");
     Texture2D anhnennoito = trochoi.Content.Load<Texture2D>("HinhAnh/NenNoiTo");
     Texture2D anhmattroi = trochoi.Content.Load<Texture2D>("HinhAnh/MatTroi");
     Texture2D anhmattrang = trochoi.Content.Load<Texture2D>("HinhAnh/MatTrang");
     amchay = trochoi.Content.Load<SoundEffect>("AmThanh/AmChay");
     amnhay = trochoi.Content.Load<SoundEffect>("AmThanh/AmNhay");
     amchet = trochoi.Content.Load<SoundEffect>("AmThanh/AmChet");
     adtentrochoi = new MChayAnhDong(1, anhtentrochoi, null, new Vector2(170, 0), true, null, trochoi.ktmanhinh, trochoi.tile);
     nvcchay = new MChayAnhDong(1, anhnvcchay, null, new Vector2(90, 198), true, null, trochoi.ktmanhinh, trochoi.tile);
     nvcnhay = new MChayAnhDong(1, anhnvcnhay, null, new Vector2(90, 198), false, null, trochoi.ktmanhinh, trochoi.tile);
     adbui = new MChayAnhDong(1, anhbui, null, new Vector2(120, 337), false, null, trochoi.ktmanhinh, trochoi.tile);
     adbui.DoiKichThuoc(26, 42);
     atbautroisao = new MChayAnhThuong(1, trochoi.Content.Load<Texture2D>("HinhAnh/BauTroiSao"), null, new Vector2(0, 0), null, trochoi.ktmanhinh, trochoi.tile);
     atbautroisao.DoiKichThuoc(trochoi.ktmanhinh.X, 300);
     atthanhtoi = new MChayAnhThuong(1, trochoi.Content.Load<Texture2D>("HinhAnh/ThanhToi"), null, new Vector2(0, 0), null, trochoi.ktmanhinh, trochoi.tile);
     atthanhtoi.DoiKichThuoc(trochoi.ktmanhinh.X, 200);
     atnoinho = new MChayAnhThuong(1, anhnennoinho, null, new Vector2(100, 188), null, trochoi.ktmanhinh, trochoi.tile);
     atnoito = new MChayAnhThuong(1, anhnennoito, null, new Vector2(20, 158), null, trochoi.ktmanhinh, trochoi.tile);
     atmattroi = new MChayAnhThuong(1, anhmattroi, null, new Vector2(480, 50), null, trochoi.ktmanhinh, trochoi.tile);
     atmattrang = new MChayAnhThuong(1, anhmattrang, null, new Vector2(640, 50), null, trochoi.ktmanhinh, trochoi.tile);
     trochoi.anhbokytu[3] = trochoi.bokytu[3].XuatAnhKyTu("0", 50, 32, 1, 1, 2, 2, new Rectangle(0, 0, 0, 0), Color.Transparent, Color.Black);
     boanhnoinho = new Rectangle(Convert.ToInt32(100 * trochoi.tile.X), Convert.ToInt32(188 * trochoi.tile.Y), Convert.ToInt32(50 * trochoi.tile.X), Convert.ToInt32(32 * trochoi.tile.Y));
     trochoi.anhbokytu[3] = trochoi.bokytu[3].XuatAnhKyTu("Hello Death!", 120, 75, 1, 1, 2, 2, new Rectangle(0, 0, 0, 0), Color.Transparent, Color.Black);
     boanhnoito = new Rectangle(Convert.ToInt32(35 * trochoi.tile.X), Convert.ToInt32(173 * trochoi.tile.Y), Convert.ToInt32(120 * trochoi.tile.X), Convert.ToInt32(75 * trochoi.tile.Y));
     //nap tai nguyen hieu ung
     Texture2D anhmaytroi = trochoi.Content.Load<Texture2D>("HinhAnh/MayTroi");
     Texture2D[] anhchimbayxa = new Texture2D[8];
     for (int i = 0; i < 8; i++) anhchimbayxa[i] = trochoi.Content.Load<Texture2D>("HinhAnh/ChimBayXa/" + (i + 1).ToString());
     Texture2D[] anhsamset = new Texture2D[8];
     for (int i = 0; i < 8; i++) anhsamset[i] = trochoi.Content.Load<Texture2D>("HinhAnh/SamSet/" + (i + 1).ToString());
     SoundEffect amsamset1 = trochoi.Content.Load<SoundEffect>("AmThanh/AmSamSet01");
     SoundEffect amsamset2 = trochoi.Content.Load<SoundEffect>("AmThanh/AmSamSet02");
     SoundEffect amsamset3 = trochoi.Content.Load<SoundEffect>("AmThanh/AmSamSet03");
     hieuungmaytroi = new HieuUng.HUMayTroi(trochoi, anhmaytroi);
     hieuungdanchim = new HieuUng.HUDanChim(trochoi, anhchimbayxa);
     hieuungsamset = new HieuUng.HUSamSet(trochoi, anhsamset, amsamset1, amsamset2, amsamset3);
     //anh thuc don
     for (int i = 0; i < 20; i++) mangchuthucdon[i] = trochoi.Content.Load<Texture2D>("HinhAnh/ThucDon/" + (i + 1).ToString());
     //cac ham nap khac
     NapAnhTuongGach();
     NapNgonNgu(trochoi.ngonngu);
     NapTNCaiDat();
     LamMoiThucDon();
     DamGachNgauNhien();
     CapNhatDiemChoi();
 }