• 0
  • مالي خلق
  • أتهاوش
  • متضايق
  • مريض
  • مستانس
  • مستغرب
  • مشتط
  • أسولف
  • مغرم
  • معصب
  • منحرج
  • آكل
  • ابكي
  • ارقص
  • اصلي
  • استهبل
  • اضحك
  • اضحك  2
  • تعجبني
  • بضبطلك
  • رايق
  • زعلان
  • عبقري
  • نايم
  • طبيعي
  • كشخة
  • النتائج 1 إلى 2 من 2

    الموضوع: مساعدة في لعبتي ... لغة الفيجوال بيسك

    1. #1
      التسجيل
      30-04-2007
      المشاركات
      7
      المواضيع
      1
      شكر / اعجاب مشاركة

      مساعدة في لعبتي ... لغة الفيجوال بيسك

      السلام عليكم و رحمة الله و بركاته ..

      سويت لعبة عبارة عن تركيبة .. تسحب الصورة و تضعها في مكانها الصحيح .. أنا سويت البرنامج كاملا .. لكن للأسف الدكتورة قالت لازم تختصرونه .. و أنا ما عندي وقت خاصة انكم تعرفون أنه آخر الترم و إلى الان ننمتحن الميد تيرمز ..
      حطيت بعض الميثودات اللي تحتاج تقصير في النوت باد .. لأنه الدكتورة ما اعجبها فتبغى طريقة ثانية . عشان كذا
      و بخصوص عداد الوقت هل في طريقة بحيث اخليه على حسب صعوبة اللعبة .. يعني 3 دقائق للايزي و 5 للميديم و 8 للهارد .. و جزاكم الله خير ..

      http://www.mediafire.com/?9htquuzhzzk

      أتمنى أنكم تساعدوني بأقرب وقت قبل يوم الأحد .. و ما راح أنسى لكم المساعدة أبدا ..

    2. #2
      التسجيل
      15-02-2006
      الدولة
      كوكب الارض
      المشاركات
      769
      المواضيع
      33
      شكر / اعجاب مشاركة

      رد: مساعدة في لعبتي ... لغة الفيجوال بيسك

      بحث لك في النت وهذا الي حصلتة

      هذا شخص وجد كودك جدا رائع و كتب طريقه لإختصاره

      Re: a game project for in VB.Net

      Actually your code looks very neat, well done.

      First criticism, you do not have;
      كود:
      Option Strict On
      The obvious areas is the one mentioned where you have long expressions excluding various components;
      كود:
      If Not target.Equals(Pic1) AndAlso Not target.Equals(Pic2) AndAlso Not target.Equals(Pic3) AndAlso Not target.Equals(Pic4) AndAlso Not target.Equals(Pic5) AndAlso Not target.Equals(Pic6) AndAlso Not target.Equals(Pic7) AndAlso Not target.Equals(Pic8) AndAlso Not target.Equals(Pic9) AndAlso Not target.Equals(Pic10) AndAlso Not target.Equals(Pic11) AndAlso Not target.Equals(Pic12) AndAlso Not target.Equals(Pic13) AndAlso Not target.Equals(Pic14) AndAlso Not target.Equals(Pic15) AndAlso Not target.Equals(Pic16) AndAlso Not target.Equals(Pic17) AndAlso Not target.Equals(Pic18) AndAlso Not target.Equals(Pic19) AndAlso Not target.Equals(Pic20) Then
      Since you have Pic1 to Pic20 and you want to exclude all of them you could do something like;

      كود:
      If target.Name.Length <= 3 OR _ (target.Name.Length > 3 AndAlso target.Name.Substring(0,3) <> "Pic") Then
      I also notice you do this
      كود:
      If target.Name = "Pic1" OR ..... Then s = True Else s = False End If
      If s Then pic.Visible = False End If
      where you could just do this;

      كود:
              s = target.Name = "Pic1" OR ..... 
       
              pic.Visible = NOT s
      Call me anal but I always like to see variables initialized;

      كود:
      Dim j As Integer = 0 Dim k As String = String.Empty
      and to be even more anal, I also like to see variable names that are meaningful, even though it's more typing;


      كود:
         Dim NumberOfPictures As Integer = 0
      You can also tidy some code by doing;

      كود:
      'In situations like this Pic10.Visible = True Pic10.AllowDrop = True Pic10.Enabled = True
      'Doing this instead With Pic10 .Visible = True .AllowDrop = True .Enabled = True End With
      You can get rid of the event code by creating the PictureBoxes programatically, so for example;

      كود:
      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load Dim Pic(10) As PictureBox For i As Integer = 0 To Pic.GetUpperBound(0) Pic(i) = New PictureBox 'Add the box to the form Me.Controls.Add(Pic(i)) 'Position each box to the right of the previous If i > 0 Then Pic(i).Left = Pic(i - 1).Right + 10 With Pic(i) 'Set the borderstyle .BorderStyle = BorderStyle.FixedSingle 'Give the instance a name .Name = "Pic" & i.ToString 'Add a handler to invoke on the relevant event End With AddHandler Pic(i).Click, AddressOf PictureBoxHandler Next End Sub Private Sub PictureBoxHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Will handle all Pic boxes MessageBox.Show(CType(sender, PictureBox).Name.ToString) End Sub
      Hope these comments help, as I mentioned at the beginning, your code is pretty good.
      _____________________________

      http://www.vbforums.com/showthread.php?t=468342

    ضوابط المشاركة

    • لا تستطيع إضافة مواضيع جديدة
    • لا تستطيع الرد على المواضيع
    • لا تستطيع إرفاق ملفات
    • لا تستطيع تعديل مشاركاتك
    •