Dim sgnx As String
Dim vel As Integer
Dim score As Integer
Dim allenamento As Boolean
Sub gohome()
logo.Visible = True
tim.Enabled = False
timer.Enabled = False
score = 0
allenamento = False
End Sub
Sub newgame()
lblpausa.Visible = False
logo.Visible = False
tim.Enabled = True
If allenamento = False Then
timer.Enabled = True
Else
timer.Enabled = False
End If
score = 0
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If logo.Visible = False Then
If KeyCode = vbKeyP Then
If tim.Enabled = True Then
tim.Enabled = False
timer.Enabled = False
lblpausa.Visible = True
Else
If allenamento = False Then
tim.Enabled = True
timer.Enabled = True
lblpausa.Visible = False
Else
tim.Enabled = True
lblpausa.Visible = False
timer.Enabled = False
End If
End If
End If
Else
End If
End Sub
Private Sub Form_Load()
sgnx = "-"
vel = 10
allenamento = False
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Me.Point(X, Y) = &HC0FFFF Then
score = score + 1
MsgBox "Hai fatto 1 punto!", vbInformation, "Tiro a segno"
If vel < 100 Then
vel = vel + 10
Else
End If
ElseIf Me.Point(X, Y) = &H80FFFF Then
score = score + 2
MsgBox "Hai fatto 2 punti", vbInformation, "Tiro a segno"
If vel < 100 Then
vel = vel + 10
Else
End If
ElseIf Me.Point(X, Y) = &HFFFF& Then
score = score + 3
MsgBox "Hai fatto 3 punti", vbInformation, "Tiro a segno"
If vel < 100 Then
vel = vel + 10
Else
End If
ElseIf Me.Point(X, Y) = &H80C0FF Then
score = score + 4
MsgBox "Hai fatto 4 punti", vbInformation, "Tiro a segno"
If vel < 100 Then
vel = vel + 10
Else
End If
ElseIf Me.Point(X, Y) = &H80FF& Then
score = score + 5
MsgBox "Hai fatto 5 punti", vbInformation, "Tiro a segno"
If vel < 100 Then
vel = vel + 10
Else
End If
ElseIf Me.Point(X, Y) = &HFF& Then
score = score + 6
MsgBox "Hai fatto 6 punti", vbInformation, "Tiro a segno"
If vel < 100 Then
vel = vel + 10
Else
End If
Else
MsgBox "Hai fatto 0 punti!", vbInformation, "Tiro a segno"
If vel < 100 Then
vel = vel + 10
Else
End If
End If
End Sub
Private Sub mnallenamento_Click()
allenamento = True
Call newgame
End Sub
Private Sub mnhome_Click()
Call gohome
End Sub
Private Sub mninfo_Click()
MsgBox "Creato da Ruggy94, membro di pierotofy.it", vbInformation, "Tiro a segno"
End Sub
Private Sub mnnewgame_Click()
Call newgame
End Sub
Private Sub tim_Timer()
If uno.Left <= 0 Then
If sgnx = "-" Then
sgnx = "+"
Else
sgnx = "-"
End If
End If
If uno.Left >= 6960 Then
If sgnx = "-" Then
sgnx = "+"
Else
sgnx = "-"
End If
End If
If sgnx = "+" Then
uno.Left = uno.Left + vel
due.Left = due.Left + vel
tre.Left = tre.Left + vel
quattro.Left = quattro.Left + vel
cinque.Left = cinque.Left + vel
sei.Left = sei.Left + vel
Else
uno.Left = uno.Left - vel
due.Left = due.Left - vel
tre.Left = tre.Left - vel
quattro.Left = quattro.Left - vel
cinque.Left = cinque.Left - vel
sei.Left = sei.Left - vel
End If
End Sub
Private Sub tim1_Timer()
lblscore.Caption = score
lbl2.Caption = time
End Sub
Private Sub timer_Timer()
If CInt(lbltime.Caption) > 0 Then
lbltime.Caption = CInt(lbltime.Caption) - 1
Else
MsgBox "Tempo scaduto! Hai totalizzato " & score & " punti!", vbInformation, "Tiro a segno - " & score & " punti"
Call gohome
End If
End Sub