مسااااعدة عااااااجلة جدااا جداااا اخوانى الكرام اتمنى منكم عدم اغلاق الموضوع النى فعلا محتاج للمساعدة لسبب بسيط انه مطلوب منى كمشروع لمادة المشروع اللعبة فكرة المشروع: المشروع هو عبارة عن لعبة بسيطة تُظهر على الشاشة رمز السلم (#) ويستطيع المستخدم التحكم بهذه الإشارة عن طريق الأسهم في لوحة المفاتيح. متطلبات المشروع:
ConsoleKeyInfo ConsoleKey
مع شرح كل جملة مستخدمة وهاذا هو البرنامج: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.IO; namespace sharpp { class Program { static void Main(string[] args) { int x = 39; int y = 10; Console.SetCursorPosition(x, y); Console.Write("#"); ConsoleKeyInfo KeyIn; do { Console.BackgroundColor = Console.Read; KeyIn = Console.ReadKey(true); if (KeyIn.Key == ConsoleKey.RightArrow) { Console.Clear(); x++; Console.SetCursorPosition(x, y); Console.Write("#"); } if (KeyIn.Key == ConsoleKey.LeftArrow) { Console.Clear(); x--; Console.SetCursorPosition(x, y); Console.Write("#"); } if (KeyIn.Key == ConsoleKey.UpArrow) { Console.Clear(); y--; Console.SetCursorPosition(x, y); Console.Write("#"); } if (KeyIn.Key == ConsoleKey.DownArrow) { Console.Clear(); y++; Console.SetCursorPosition(x, y); Console.Write("#"); } } while (KeyIn.Key != ConsoleKey.Escape && x < 50 && y < 50); } } } |
الساعة الآن 11:38 AM |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By
Almuhajir