Visual basic To make a random image

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wisten
    New Member
    • Jan 2008
    • 4

    Visual basic To make a random image

    Is there any one who can help me to make a game .This game have to create with visual basic 2005 and it is like there are three images and one by one is appeared and disappeared. Our objective is to try to click fast these images as much as we can. Moreover if we click one image we will get score. this game have to start when we click Start button and stop by pressing stop button


    Plz somebody help me i don't know how to make the image to go around the
    box appear and disappear.....
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    #2
    Originally posted by wisten
    Is there any one who can help me to make a game .This game have to create with visual basic 2005 and it is like there are three images and one by one is appeared and disappeared. Our objective is to try to click fast these images as much as we can. Moreover if we click one image we will get score. this game have to start when we click Start button and stop by pressing stop button


    Plz somebody help me i don't know how to make the image to go around the group
    box appear and disappear.....
    This is the code for generating random nos.

    Code:
    Randomize
        Label1.caption= Int((6 - 1 + 1) * Rnd + 1)
    This code will generate random nos between 1-6 if you replace 6 with 3 numbers are generated between 1-3.
    Now assign a number to every pic like pic is to 1, pic2 is to 2 and so on.
    Now write this code in label1 Change event.

    Code:
    Select case label1.caption
    
    case 1
    pic.picture=loadimage(Path of image)
    
    case 2
    pic.picture=loadimage(Path of image)
    
    case 3
    pic.picture=loadimage(Path of image)
    
    end select
    Now pics you need to show are randomly appeared.

    Regards
    >> ALI <<

    Comment

    • wisten
      New Member
      • Jan 2008
      • 4

      #3
      can u show me ur form bcoz i don't get it well??
      should i declare label1_caption as random or integer?
      what should i put inside "pic.pictur e" ?

      Comment

      • Ali Rizwan
        Banned
        Contributor
        • Aug 2007
        • 931

        #4
        I ll make a demo for you.
        OK
        For further helps you can contact me by mails or by Yahoo! messenger.
        You ll find my address from my profile (by clicking on my name or avatar).

        REGARDS
        >> ALI <<

        Comment

        • wisten
          New Member
          • Jan 2008
          • 4

          #5
          okay and thanks a lot

          Comment

          • larystoy
            New Member
            • Nov 2007
            • 9

            #6
            You can use the following:

            I use it to rotate 6 different pictures in a program I am writeing.

            Place a timer called "RotatePic" set to time to rotate pictures.
            Load one of the pictures in a picture box called "picRotate"
            Load the other pictures in image boxs indexed 0 thru 7

            Public Sub RotatePic_Timer ()

            Static thispic As Integer

            If thispic = 7 Then thispic = -1
            thispic = thispic + 1

            If (picRotate.Left ) > ScaleWidth Then picRotate.Left = -100
            picRotate.Pictu re = imgChrist(thisp ic).Picture

            End Sub

            Comment

            • Ali Rizwan
              Banned
              Contributor
              • Aug 2007
              • 931

              #7
              Originally posted by wisten
              can u show me ur form bcoz i don't get it well??
              should i declare label1_caption as random or integer?
              what should i put inside "pic.pictur e" ?
              label1 is the label control and in pic is the picture control names.
              load some pic in picture box.

              Regards
              >> ALI <<

              Comment

              Working...