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
Gara - Form1.frm

Form1.frm

Caricato da: Netarrow
Scarica il programma completo

  1. Private Sub game()
  2. Command1.Enabled = False
  3. Option1.Enabled = False
  4. Option2.Enabled = False
  5. Text1.Enabled = False
  6. Frame2.Visible = True
  7. For i = 0 To 2
  8. Label6(i).Visible = True
  9. Next i
  10. time.Enabled = True
  11. End Sub
  12.  
  13. Private Sub Error()
  14. MsgBox "La tua scommessa non è valida", vbCritical, "ATTENZIONE"
  15. Text1.Enabled = True
  16. Option1.Enabled = True
  17. Option2.Enabled = True
  18. Command1.Enabled = True
  19. End Sub
  20.  
  21. Private Sub b_Click()
  22. If lepre.Enabled = True And tartle.Enabled = True Then
  23. MsgBox "Non puoi resettare mentre la gara è in corso!", vbInformation, "Gara"
  24. Else
  25. Text2.Text = 100
  26. Call Form_Load
  27. End If
  28. End Sub
  29.  
  30. Private Sub Command1_Click()
  31. On Error GoTo errori
  32. Call game
  33. Exit Sub
  34. errori:
  35. MsgBox "E' avvenuto un errore: scommessa non valida", vbCritical, "ERRORE"
  36. End Sub
  37.  
  38. Private Sub e_Click()
  39. Form2.Show
  40. End Sub
  41.  
  42. Private Sub f_Click()
  43. Unload Me
  44. End Sub
  45.  
  46. Private Sub Form_Load()
  47. Frame2.Visible = False
  48. Text1.Text = ""
  49. Label11.Caption = ""
  50. Label12.Caption = ""
  51. scommessa = Text1.Text
  52. soldi = Text2.Text
  53. Option1.Value = False
  54. Option2.Value = False
  55. Command1.Enabled = False
  56. Option1.Enabled = True
  57. Option2.Enabled = True
  58. Text1.Enabled = True
  59. Label4.Left = 120
  60. Label5.Left = 120
  61. End Sub
  62.  
  63. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  64. If MsgBox("Sei sicuro di voler ucire?", vbYesNo, "Gara") = vbNo Then
  65. Cancel = True
  66. Else
  67. End
  68. End If
  69. End Sub
  70.  
  71. Private Sub h_Click()
  72. MsgBox "Gara: Lepre vs Tartaruga copyright © by Matteo Tomasulo 2003", vbInformation, "About"
  73. End Sub
  74.  
  75. Private Sub lepre_Timer()
  76. On Error GoTo errori
  77. Dim scommessa As Double
  78. Dim soldi As Double
  79. scommessa = Text1.Text
  80. soldi = Text2.Text
  81. If scommessa > soldi Then
  82. GoTo errori
  83. End If
  84. If scommessa = 0 Then
  85. GoTo errori
  86. End If
  87. If Label4.Left > 10080 Then
  88. lepre.Enabled = False
  89. tartle.Enabled = False
  90. MsgBox "Ha vinto la LEPRE!", vbExclamation, "Gara finita"
  91. If Option1.Value = True Then
  92. MsgBox "Hai vinto la scommessa", vbExclamation, "Vittoria"
  93. Text2.Text = soldi + scommessa
  94. Call Form_Load
  95. Else
  96. MsgBox "Hai perso la scommessa.", vbCritical, "Hai perso i soldi"
  97. Text2.Text = soldi - scommessa
  98. If Text2.Text < 0 Or Text2.Text = 0 Then
  99. MsgBox "Hai perso tutti i soldi!!", vbCritical, "BANCAROTTA"
  100. MsgBox "Game Over", , "Game Over"
  101. If MsgBox("Hai perso tutto! vuoi rigiocare?", vbYesNo, "Hai perso") = vbNo Then
  102. End
  103. Else
  104. Text2.Text = 100
  105. Call Form_Load
  106. End If
  107. Else
  108. Call Form_Load
  109. End If
  110. End If
  111. Else
  112. Dim a As Integer
  113. a = 10 * Rnd(1)
  114. If a = 1 Then
  115. Label4.Left = Label4.Left
  116. Label11.Caption = "si riposa"
  117. ElseIf a = 2 Then
  118. Label4.Left = Label4.Left
  119. Label11.Caption = "si riposa"
  120. ElseIf a = 3 Then
  121. Label4.Left = Label4.Left + 1296
  122. Label11.Caption = "fa il salto lungo"
  123. ElseIf a = 4 Then
  124. Label4.Left = Label4.Left + 1296
  125. Label11.Caption = "fa il salto lungo"
  126. ElseIf a = 5 Then
  127. Label4.Left = Label4.Left - 1728
  128. If Label4.Left < 480 Then
  129. Label4.Left = 480
  130. End If
  131. Label11.Caption = "fa la scivolata lunga"
  132. ElseIf a = 6 Then
  133. Label4.Left = Label4.Left + 144
  134. Label11.Caption = "fa il salto piccolo"
  135. ElseIf a = 7 Then
  136. Label4.Left = Label4.Left + 144
  137. Label11.Caption = "fa il salto piccolo"
  138. ElseIf a = 8 Then
  139. Label4.Left = Label4.Left + 144
  140. Label11.Caption = "fa il salto piccolo"
  141. ElseIf a = 9 Then
  142. Label4.Left = Label4.Left - 288
  143. Label11.Caption = "fa la scivolata piccola"
  144. If Label4.Left < 480 Then
  145. Label4.Left = 480
  146. ElseIf a = 10 Then
  147. Label4.Left = Label4.Left - 288
  148. If Label4 < 480 Then
  149. Label4 = 480
  150. End If
  151. Label4.Caption = "fa la scivolata piccola"
  152. End If
  153. End If
  154. End If
  155. Exit Sub
  156. errori:
  157. tartle.Enabled = False
  158. MsgBox "E' avvenuto un errore: scommessa non valida", vbCritical, "ERRORE"
  159. lepre.Enabled = False
  160. tartle.Enabled = False
  161. Call Form_Load
  162. End Sub
  163.  
  164. Private Sub Option1_Click()
  165. Command1.Enabled = True
  166. End Sub
  167.  
  168. Private Sub Option2_Click()
  169. Command1.Enabled = True
  170. End Sub
  171.  
  172. Private Sub tartle_Timer()
  173. On Error GoTo valis
  174. Dim sol As Double
  175. sol = Text2.Text
  176. Dim scom As Double
  177. scom = Text1.Text
  178. If Label5.Left > 10080 Then
  179. lepre.Enabled = False
  180. tartle.Enabled = False
  181. MsgBox "Ha vinto la TARTARUGA!", vbExclamation, "Gara finita"
  182. If Option2.Value = True Then
  183. MsgBox "Hai vinto la scommessa", vbExclamation, "Vittoria"
  184. Text2.Text = sol + scom
  185. Call Form_Load
  186. Else
  187. MsgBox "Hai perso la scommessa.", vbCritical, "Hai perso i soldi"
  188. Text2.Text = sol - scom
  189. If Text2.Text < 0 Or Text2.Text = 0 Then
  190. MsgBox "Hai perso tutti i soldi!!", vbCritical, "BANCAROTTA"
  191. MsgBox "Game Over", , "Game Over"
  192. If MsgBox("Hai perso tutto! vuoi rigiocare?", vbYesNo, "Hai perso") = vbNo Then
  193. End
  194. Else
  195. Text2.Text = 100
  196. Call Form_Load
  197. End If
  198. Else
  199. Call Form_Load
  200. End If
  201. End If
  202. Else
  203. Dim W As Integer
  204. W = 10 * Rnd(1)
  205. If W = 1 Then
  206. Label5.Left = Label5.Left + 432
  207. Label12.Caption = "fa il passo veloce"
  208. ElseIf W = 2 Then
  209. Label5.Left = Label5.Left + 432
  210. Label12.Caption = "fa il passo veloce"
  211. ElseIf W = 3 Then
  212. Label5.Left = Label5.Left + 432
  213. Label12.Caption = "fa il passo veloce"
  214. ElseIf W = 4 Then
  215. Label5.Left = Label5.Left + 432
  216. Label12.Caption = "fa il passo veloce"
  217. ElseIf W = 5 Then
  218. Label5.Left = Label5.Left + 432
  219. Label12.Caption = "fa il passo veloce"
  220. ElseIf W = 6 Then
  221. Label5.Left = Label5.Left - 864
  222. If Label5.Left < 480 Then
  223. Label5.Left = 480
  224. End If
  225. Label12.Caption = "fa la scivolata"
  226. ElseIf W = 7 Then
  227. Label5.Left = Label5.Left - 864
  228. If Label5.Left < 480 Then
  229. Label5.Left = 480
  230. End If
  231. Label12.Caption = "fa la scivolata"
  232. ElseIf W = 8 Then
  233. Label5.Left = Label4.Left + 144
  234. Label12.Caption = "fa il passo lento"
  235. ElseIf W = 9 Then
  236. Label5.Left = Label5.Left + 144
  237. Label11.Caption = "fa il passo lento"
  238. ElseIf W = 10 Then
  239. Label5.Left = Label5.Left + 144
  240. Label12.Caption = "fa il passo lento"
  241. End If
  242. End If
  243. Exit Sub
  244. valis:
  245. tartle.Enabled = False
  246. Call Form_Load
  247. End Sub
  248.  
  249. Private Sub time_Timer()
  250. Label6(2).Visible = False
  251. time2.Enabled = True
  252. time.Enabled = False
  253. End Sub
  254.  
  255. Private Sub time2_Timer()
  256. Label6(1).Visible = False
  257. time3.Enabled = True
  258. time2.Enabled = False
  259. End Sub
  260.  
  261. Private Sub time3_Timer()
  262. Label6(0).Visible = True
  263. Label6(0).Visible = False
  264. Timer1.Enabled = True
  265. time3.Enabled = False
  266. End Sub
  267.  
  268. Private Sub Timer1_Timer()
  269. lepre.Enabled = True
  270. tartle.Enabled = True
  271. Timer1.Enabled = False
  272. End Sub