Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Tiro a segno - Form1.frm

Form1.frm

Caricato da: Ruggy94
Scarica il programma completo

  1. Dim sgnx As String
  2. Dim vel As Integer
  3. Dim score As Integer
  4. Dim allenamento As Boolean
  5.  
  6. Sub gohome()
  7. logo.Visible = True
  8. tim.Enabled = False
  9. timer.Enabled = False
  10. score = 0
  11. allenamento = False
  12. End Sub
  13.  
  14. Sub newgame()
  15. lblpausa.Visible = False
  16. logo.Visible = False
  17. tim.Enabled = True
  18. If allenamento = False Then
  19. timer.Enabled = True
  20. Else
  21. timer.Enabled = False
  22. End If
  23. score = 0
  24. End Sub
  25.  
  26. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  27. If logo.Visible = False Then
  28. If KeyCode = vbKeyP Then
  29. If tim.Enabled = True Then
  30. tim.Enabled = False
  31. timer.Enabled = False
  32. lblpausa.Visible = True
  33. Else
  34. If allenamento = False Then
  35. tim.Enabled = True
  36. timer.Enabled = True
  37. lblpausa.Visible = False
  38. Else
  39. tim.Enabled = True
  40. lblpausa.Visible = False
  41. timer.Enabled = False
  42. End If
  43. End If
  44. End If
  45. Else
  46. End If
  47. End Sub
  48.  
  49. Private Sub Form_Load()
  50. sgnx = "-"
  51. vel = 10
  52. allenamento = False
  53. End Sub
  54.  
  55. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  56. If Me.Point(X, Y) = &HC0FFFF Then
  57. score = score + 1
  58. MsgBox "Hai fatto 1 punto!", vbInformation, "Tiro a segno"
  59. If vel < 100 Then
  60. vel = vel + 10
  61. Else
  62. End If
  63. ElseIf Me.Point(X, Y) = &H80FFFF Then
  64. score = score + 2
  65. MsgBox "Hai fatto 2 punti", vbInformation, "Tiro a segno"
  66. If vel < 100 Then
  67. vel = vel + 10
  68. Else
  69. End If
  70. ElseIf Me.Point(X, Y) = &HFFFF& Then
  71. score = score + 3
  72. MsgBox "Hai fatto 3 punti", vbInformation, "Tiro a segno"
  73. If vel < 100 Then
  74. vel = vel + 10
  75. Else
  76. End If
  77. ElseIf Me.Point(X, Y) = &H80C0FF Then
  78. score = score + 4
  79. MsgBox "Hai fatto 4 punti", vbInformation, "Tiro a segno"
  80. If vel < 100 Then
  81. vel = vel + 10
  82. Else
  83. End If
  84. ElseIf Me.Point(X, Y) = &H80FF& Then
  85. score = score + 5
  86. MsgBox "Hai fatto 5 punti", vbInformation, "Tiro a segno"
  87. If vel < 100 Then
  88. vel = vel + 10
  89. Else
  90. End If
  91. ElseIf Me.Point(X, Y) = &HFF& Then
  92. score = score + 6
  93. MsgBox "Hai fatto 6 punti", vbInformation, "Tiro a segno"
  94. If vel < 100 Then
  95. vel = vel + 10
  96. Else
  97. End If
  98. Else
  99. MsgBox "Hai fatto 0 punti!", vbInformation, "Tiro a segno"
  100. If vel < 100 Then
  101. vel = vel + 10
  102. Else
  103. End If
  104. End If
  105. End Sub
  106.  
  107. Private Sub mnallenamento_Click()
  108. allenamento = True
  109. Call newgame
  110. End Sub
  111.  
  112. Private Sub mnhome_Click()
  113. Call gohome
  114. End Sub
  115.  
  116. Private Sub mninfo_Click()
  117. MsgBox "Creato da Ruggy94, membro di pierotofy.it", vbInformation, "Tiro a segno"
  118. End Sub
  119.  
  120. Private Sub mnnewgame_Click()
  121. Call newgame
  122. End Sub
  123.  
  124. Private Sub tim_Timer()
  125. If uno.Left <= 0 Then
  126. If sgnx = "-" Then
  127. sgnx = "+"
  128. Else
  129. sgnx = "-"
  130. End If
  131. End If
  132.  
  133. If uno.Left >= 6960 Then
  134. If sgnx = "-" Then
  135. sgnx = "+"
  136. Else
  137. sgnx = "-"
  138. End If
  139. End If
  140.  
  141. If sgnx = "+" Then
  142. uno.Left = uno.Left + vel
  143. due.Left = due.Left + vel
  144. tre.Left = tre.Left + vel
  145. quattro.Left = quattro.Left + vel
  146. cinque.Left = cinque.Left + vel
  147. sei.Left = sei.Left + vel
  148. Else
  149. uno.Left = uno.Left - vel
  150. due.Left = due.Left - vel
  151. tre.Left = tre.Left - vel
  152. quattro.Left = quattro.Left - vel
  153. cinque.Left = cinque.Left - vel
  154. sei.Left = sei.Left - vel
  155. End If
  156. End Sub
  157.  
  158. Private Sub tim1_Timer()
  159. lblscore.Caption = score
  160. lbl2.Caption = time
  161. End Sub
  162.  
  163. Private Sub timer_Timer()
  164. If CInt(lbltime.Caption) > 0 Then
  165. lbltime.Caption = CInt(lbltime.Caption) - 1
  166. Else
  167. MsgBox "Tempo scaduto! Hai totalizzato " & score & " punti!", vbInformation, "Tiro a segno - " & score & " punti"
  168. Call gohome
  169. End If
  170. End Sub