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

Form1.frm

Caricato da: Ruggy94
Scarica il programma completo

  1. Dim sgnx As String
  2. Dim sgny As String
  3. Dim posx As Single
  4. Dim posy As Single
  5. Dim velox As Single
  6. Dim mx As Long
  7. Dim my As Long
  8. Dim score As Integer
  9. Dim allenamento As Boolean
  10.  
  11. Sub espandiform()
  12. If espandi.Caption = "+" Then
  13. If tim.Enabled = True Then
  14. Call pausa
  15. If Me.Height = 7320 Then
  16. velocita.Visible = True
  17. Me.Height = 8130
  18. espandi.Caption = "-"
  19. Else
  20. velocita.Visible = False
  21. Me.Height = 7320
  22. espandi.Caption = "+"
  23. End If
  24. Else
  25. If Me.Height = 7320 Then
  26. Me.Height = 8130
  27. velocita.Visible = True
  28. espandi.Caption = "-"
  29. Else
  30. velocita.Visible = False
  31. Me.Height = 7320
  32. espandi.Caption = "+"
  33. End If
  34. End If
  35. Else
  36. Call pausa
  37. If Me.Height = 7320 Then
  38. velocita.Visible = True
  39. Me.Height = 8130
  40. espandi.Caption = "-"
  41. Else
  42. velocita.Visible = False
  43. Me.Height = 7320
  44. espandi.Caption = "+"
  45. End If
  46. End If
  47. End Sub
  48.  
  49. Sub training()
  50. velocita.Visible = False
  51. Me.Cls
  52. velocita.Value = 10
  53. velox = 10
  54. velocita.Visible = True
  55. ball.Left = 5880
  56. ball.Top = 3000
  57. lblpausa.Visible = False
  58. allenamento = True
  59. logo.Visible = False
  60. tim.Enabled = True
  61. Timx.Enabled = False
  62. Me.Height = 7320
  63. score = 0
  64. End Sub
  65.  
  66. Sub gohome()
  67. Me.Cls
  68. velocita.Value = 10
  69. velox = 10
  70. velocita.Visible = False
  71. tim.Enabled = False
  72. Timx.Enabled = False
  73. logo.Visible = True
  74. lblpausa.Visible = True
  75. ball.Left = 5880
  76. ball.Top = 3000
  77. Me.Height = 7320
  78. score = 0
  79. End Sub
  80.  
  81. Sub newgame()
  82. Me.Cls
  83. velocita.Value = 10
  84. velox = 10
  85. ball.Left = 5880
  86. ball.Top = 3000
  87. tim.Enabled = True
  88. lblpausa.Visible = False
  89. logo.Visible = False
  90. allenamento = False
  91. Timx.Enabled = True
  92. Me.Height = 7320
  93. score = 0
  94. End Sub
  95.  
  96. Sub fine()
  97. Timx.Enabled = False
  98. tim.Enabled = False
  99. MsgBox "Hai perso! - Punteggio finale: " & score, vbOKOnly, score & " punti"
  100. Call gohome
  101. End Sub
  102.  
  103. Sub pausa()
  104. If tim.Enabled = True Then
  105. Timx.Enabled = False
  106. tim.Enabled = False
  107. lblpausa.Visible = True
  108. Else
  109. If allenamento = False Then
  110. Timx.Enabled = True
  111. Else
  112. End If
  113. tim.Enabled = True
  114. lblpausa.Visible = False
  115. End If
  116. End Sub
  117.  
  118. Private Sub espandi_Click()
  119. Call espandiform
  120. End Sub
  121.  
  122. Private Sub Form_Load()
  123. sgnx = "-"
  124. sgny = "-"
  125. tim.Enabled = False
  126. lblpausa.Visible = True
  127. allenamento = False
  128. Timx.Enabled = False
  129. velox = 10
  130. Me.Height = 7320
  131. score = 0
  132. velocita.Value = 10
  133. End Sub
  134.  
  135. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  136. Dim Bs As Boolean
  137. If Button Mod 2 = 1 Then Bs = True
  138. If Bs = True Then
  139. If tim.Enabled = True Then
  140. Me.Line (mx, my)-(X, Y)
  141. Else
  142. End If
  143. End If
  144. mx = X
  145. my = Y
  146. End Sub
  147.  
  148. Private Sub mnallenamento_Click()
  149. Call training
  150. End Sub
  151.  
  152. Private Sub mnhome_Click()
  153. Call gohome
  154. End Sub
  155.  
  156. Private Sub mninfo_Click()
  157. MsgBox "Creato da Ruggy94, membro di pierotofy.it", vbInformation, "PictureBall"
  158. End Sub
  159.  
  160. Private Sub mnnewgame_Click()
  161. Call newgame
  162. End Sub
  163.  
  164. Private Sub mnpicturecls_Click()
  165. Me.Cls
  166. End Sub
  167.  
  168. Private Sub tim_Timer()
  169. posx = ball.Left
  170. posy = ball.Top
  171.  
  172. If posy <= 0 Then
  173. If allenamento = True Then
  174. If sgny = "-" Then
  175. sgny = "+"
  176. Else
  177. sgny = "-"
  178. End If
  179. Else
  180. Call fine
  181. End If
  182. End If
  183.  
  184. If posy >= 6360 Then
  185. If allenamento = True Then
  186. If sgny = "-" Then
  187. sgny = "+"
  188. Else
  189. sgny = "-"
  190. End If
  191. Else
  192. Call fine
  193. End If
  194. End If
  195.  
  196. If posx <= 0 Then
  197. If allenamento = True Then
  198. If sgnx = "-" Then
  199. sgnx = "+"
  200. Else
  201. sgnx = "-"
  202. End If
  203. Else
  204. Call fine
  205. End If
  206. End If
  207.  
  208. If posx >= 8880 Then
  209. If allenamento = True Then
  210. If sgnx = "-" Then
  211. sgnx = "+"
  212. Else
  213. sgnx = "-"
  214. End If
  215. Else
  216. Call fine
  217. End If
  218. End If
  219.  
  220. If Me.Point(posx, posy) = &H80FF& And Me.Point(posx + 180, posy) <> &H80FF& And Me.Point(posx, posy + 180) <> &H80FF& Then
  221. If sgnx = "-" Then
  222. sgnx = "+"
  223. Else
  224. sgnx = "-"
  225. End If
  226. If sgny = "-" Then
  227. sgny = "+"
  228. Else
  229. sgny = "-"
  230. End If
  231. Form1.Cls
  232. ElseIf Me.Point(posx + 360, posy) = &H80FF& And Me.Point(posx + 360, posy + 180) <> &H80FF& And Me.Point(posx + 180, posy) <> &H80FF& Then
  233. If sgnx = "-" Then
  234. sgnx = "+"
  235. Else
  236. sgnx = "-"
  237. End If
  238. If sgny = "-" Then
  239. sgny = "+"
  240. Else
  241. sgny = "-"
  242. End If
  243. Form1.Cls
  244. ElseIf Me.Point(posx + 360, posy + 360) = &H80FF& And Me.Point(posx + 180, posy + 360) <> &H80FF& And Me.Point(posx + 360, posy + 180) <> &H80FF& Then
  245. If sgnx = "-" Then
  246. sgnx = "+"
  247. Else
  248. sgnx = "-"
  249. End If
  250. If sgny = "-" Then
  251. sgny = "+"
  252. Else
  253. sgny = "-"
  254. End If
  255. Form1.Cls
  256. ElseIf Me.Point(posx, posy + 360) = &H80FF& And Me.Point(posx, posy + 180) <> &H80FF& And Me.Point(posx + 180, posy + 360) <> &H80FF& Then
  257. If sgnx = "-" Then
  258. sgnx = "+"
  259. Else
  260. sgnx = "-"
  261. End If
  262. If sgny = "-" Then
  263. sgny = "+"
  264. Else
  265. sgny = "-"
  266. End If
  267. Form1.Cls
  268. ElseIf Me.Point(posx + 180, posy) = &H80FF& Then
  269. If sgny = "-" Then
  270. sgny = "+"
  271. Else
  272. sgny = "-"
  273. End If
  274. Form1.Cls
  275. ElseIf Me.Point(posx + 360, posy + 180) = &H80FF& Then
  276. If sgnx = "-" Then
  277. sgnx = "+"
  278. Else
  279. sgnx = "-"
  280. End If
  281. Form1.Cls
  282. ElseIf Me.Point(posx + 180, posy + 360) = &H80FF& Then
  283. If sgny = "-" Then
  284. sgny = "+"
  285. Else
  286. sgny = "-"
  287. End If
  288. Form1.Cls
  289. ElseIf Me.Point(posx, posy + 180) = &H80FF& Then
  290. If sgnx = "-" Then
  291. sgnx = "+"
  292. Else
  293. sgnx = "-"
  294. End If
  295. Form1.Cls
  296. End If
  297.  
  298.  
  299. If sgnx = "-" Then
  300. ball.Left = ball.Left - velox
  301. ElseIf sgnx = "+" Then
  302. ball.Left = ball.Left + velox
  303. End If
  304.  
  305. If sgny = "-" Then
  306. ball.Top = ball.Top - velox
  307. ElseIf sgny = "+" Then
  308. ball.Top = ball.Top + velox
  309. End If
  310.  
  311.  
  312. End Sub
  313.  
  314. Private Sub tim2_Timer()
  315. orario.Caption = Time
  316. If allenamento = True Then
  317. velox = velocita.Value
  318. Else
  319. End If
  320. End Sub
  321.  
  322. Private Sub Timx_Timer()
  323. score = score + 1
  324. velox = velox + 1
  325. lblpunti.Caption = score
  326. End Sub