Home > Software engineering >  For help! Using VB to write a simple flies games, but hit a number of problems
For help! Using VB to write a simple flies games, but hit a number of problems

Time:10-02

Writing is such, so hit three flies is respectively recorded the number of times, how to let it recorded a total of the number of times?

CodePudding user response:

 Option Explicit 
Private Cy (3) As an Integer
Private Sub Image1_Click (Index As an Integer)
Cy (Index)=Cy (Index) + 1 'single number
Print "you hit a fly & amp;" The Index & amp; "Total" & amp; Cy (Index) & amp; "Time!"
Cy (3)=Cy (3) the total number of + 1 'cumulative
Print "you hit the flies" & amp; Cy (3) & amp; "Time!"
End Sub


CodePudding user response:

reference 1st floor Topc008 response:
 Option Explicit 
Private Cy (3) As an Integer
Private Sub Image1_Click (Index As an Integer)
Cy (Index)=Cy (Index) + 1 'single number
Print "you hit a fly & amp;" The Index & amp; "Total" & amp; Cy (Index) & amp; "Time!"
Cy (3)=Cy (3) the total number of + 1 'cumulative
Print "you hit the flies" & amp; Cy (3) & amp; "Time!"
End Sub



Why is it said that statement with the same event or process description does not match,,,
What is need to change a place,,,

CodePudding user response:

Delete the original Image1_Click process, will image1 index attribute set to 0, and copy the 2 image1, then paste the code on...

CodePudding user response:

Upstairs method is relatively simple, of course, you can also set the I to global variables, not the first method is simple, of course

CodePudding user response:

reference Topc008 reply: 3/f
delete the original Image1_Click process, the index of image1 attribute set to 0, and two image1 copy, then paste the code on...


So the timer also may not be able to use... Don't know anything about vb... How does ability let the flies in the interface moving on...

CodePudding user response:

Use image flash flash

CodePudding user response:

Saying the static variable declarations into the same if you have any questions

CodePudding user response:

reference Topc008 reply: 3/f
delete the original Image1_Click process, the index of image1 attribute set to 0, and two image1 copy, then paste the code on...
is actually controls array, so that you can use this code:
 Private Sub Image1. Click (Index As an Integer) 

Event process,

reference 5 floor bangbongxi reply:
Quote: refer to the third floor Topc008 response:

Delete the original Image1_Click process, will image1 index attribute set to 0, and copy the 2 image1, then paste the code on...


So the timer also may not be able to use... Don't know anything about vb... How does ability let the flies in the interface moving on...

The timer and Image irrelevant!
  • Related