protected bool notemty() { if (s[x, y] != ' ') { GIAOTHUC.gotoxy(m + 2, n / 2 + 16); GIAOTHUC.textcolor(ConsoleColor.Red); Console.WriteLine("Vi tri nay da thao tac"); GIAOTHUC.colordefault(); GIAOTHUC.gotoxy(x, y + 16); return(true); } return(false); }
public void xuat() { GIAOTHUC.textcolor(ConsoleColor.Red); Console.WriteLine("\n\t\t »»»»» CHE DO SURVIVOR «««««\n"); GIAOTHUC.colordefault(); for (int i = 0; i < ng.Length; i++) { Console.Write("\t\t\t {0}. ", i + 1); ng[i].xuat(); } }
public static void gioithieu() { GIAOTHUC.textcolor(ConsoleColor.Red); Console.WriteLine("\t\t\t ======================"); Console.WriteLine("\t\t\t | DO AN MON OOP NHOM 7 |"); Console.WriteLine("\t\t\t ======================"); GIAOTHUC.textcolor(ConsoleColor.Green); Console.WriteLine("\n\t\t\t»»»»»GAME TIM KHO BAU«««««"); GIAOTHUC.textcolor(ConsoleColor.Magenta); Console.WriteLine("THANH VIEN :"); GIAOTHUC.textcolor(ConsoleColor.Yellow); Console.WriteLine("\n NGUYEN MANH CUONG \n\n CAO TRAN MINH HIEN \n\n NGUYEN XUAN BINH \n\n PHAM QUACH HOANG GIANG"); GIAOTHUC.textcolor(ConsoleColor.White); Console.ReadKey(); }
protected void endgame(int x) { GIAOTHUC.gotoxy(m + 3, n / 2 + 10); //canh toa do xuat KQ if (x == 0) { GIAOTHUC.textcolor(ConsoleColor.Blue); GIAOTHUC.backgroundcolor(ConsoleColor.White); Console.WriteLine("RAT TIEC! TRO CHOI KET THUC T-T "); GIAOTHUC.colordefault(); Console.ReadKey(true); } if (x == 1) { GIAOTHUC.textcolor(ConsoleColor.Red); GIAOTHUC.backgroundcolor(ConsoleColor.Yellow); Console.Write("CHUC MUNG BAN DA DANH DAU DU SO KHO BAU"); GIAOTHUC.colordefault(); Console.ReadKey(true); } }
protected void luamau() { if (s[x, y] == c) { GIAOTHUC.textcolor(ConsoleColor.Red); } if (s[x, y] == '4' || s[x, y] == '8' || s[x, y] == '0') { GIAOTHUC.textcolor(ConsoleColor.Yellow); } if (s[x, y] == '2' || s[x, y] == '5') { GIAOTHUC.textcolor(ConsoleColor.Cyan); } if (s[x, y] == '3' || s[x, y] == '6') { GIAOTHUC.textcolor(ConsoleColor.Magenta); } if (s[x, y] == '1' || s[x, y] == '7') { GIAOTHUC.textcolor(ConsoleColor.Green); } }
virtual public void dichuyen() { GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(x, y + 16); do { a = GIAOTHUC.getch(); if (a == 32)//khoang trang { if (notemty()) { continue; } if (BANDO.kt(x, y) == -1) { endgame(0); win(); break; } //khi sai thao tac s[x, y] = (char)BANDO.kt(x, y); luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); GIAOTHUC.gotoxy(x, y + 16); } if (a == 13)//enter { if (notemty()) { continue; } if (BANDO.kt(x, y) != -1) { endgame(0); win(); break; } //khi sai thao tac s[x, y] = c; luamau(); Console.Write("{0}", s[x, y]); dem--; GIAOTHUC.textcolor(ConsoleColor.White); GIAOTHUC.gotoxy(x, y + 16); if (dem == 0) { endgame(1); win(); break; } } if (a == 'w' || a == 'W') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (x == 1) { x = m - 2; } else { x = x - 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } if (a == 'a' || a == 'A') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (y == 1) { y = n - 2; } else { y = y - 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } if (a == 's' || a == 'S') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (x == m - 2) { x = 1; } else { x = x + 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } if (a == 'd' || a == 'D') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (y == n - 2) { y = 1; } else { y = y + 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } } while (a != 27); }
public override void dichuyen() { GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m / 2, n + 20); /*toa do xuat ra DIEM*/ Console.Write("DIEM:{0} ", diem); GIAOTHUC.gotoxy(x, y + 16); //dua con tro console ve vi tri con tro * tren man hinh do { a = GIAOTHUC.getch(); if (a == 32) { if (notemty()) { continue; } if (BANDO.kt(x, y) == -1) { endgame(0); win(); break; } //khi sai thao tac s[x, y] = (char)BANDO.kt(x, y); luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); GIAOTHUC.gotoxy(x, y + 16); } if (a == 13)//enter { if (notemty()) { continue; } if (BANDO.kt(x, y) != -1) { endgame(0); win(); break; } //khi sai thao tac diem = diem + 100; s[x, y] = c; dem--; luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); GIAOTHUC.gotoxy(m / 2, n + 20); /*toa do xuat ra DIEM*/ Console.Write("DIEM:{0} ", diem); GIAOTHUC.gotoxy(x, y + 16); //dua con tro console ve vi tri con tro * tren man hinh if (dem == 0) { endgame(1); win(); break; } } if (a == 'w' || a == 'W') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (x == 1) { x = m - 2; } else { x = x - 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } if (a == 'a' || a == 'A') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (y == 1) { y = n - 2; } else { y = y - 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } if (a == 's' || a == 'S') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (x == m - 2) { x = 1; } else { x = x + 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } if (a == 'd' || a == 'D') { luamau(); Console.Write("{0}", s[x, y]); GIAOTHUC.textcolor(ConsoleColor.White); if (y == n - 2) { y = 1; } else { y = y + 2; } GIAOTHUC.gotoxy(x, y + 16); Console.Write("*"); GIAOTHUC.gotoxy(m + 2, n / 2 + 16); Console.WriteLine("\t\t "); GIAOTHUC.gotoxy(x, y + 16); } } while (a != 27); }