• توجه: در صورتی که از کاربران قدیمی ایران انجمن هستید و امکان ورود به سایت را ندارید، میتوانید با آیدی altin_admin@ در تلگرام تماس حاصل نمایید.

بازی توپ متحرک

ahmadfononi

معاونت انجمن
Dim x1, y1 As Single
Dim emtiyaz As Double
Dim tupNum As Byte
Dim harekateOFOGHI As Integer
Dim harekateAMUDI As Integer
Private Sub Form_Activate()
BARG.Top = Me.Height - 500
x1 = 1
y1 = 1
harekateOFOGHI = 40
harekateAMUDI = 40
tupNum = 3
lblTUP.Caption = tupNum & " tup"
KADR.Width = Me.Width
lblexit.Left = Me.Width - lblexit.Width
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
End
End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If lblNEW.ForeColor = vbRed Then lblNEW.ForeColor = vbYellow
If lblexit.ForeColor = vbRed Then lblexit.ForeColor = vbYellow

If X > Me.Width - BARG.Width Then X = Me.Width - BARG.Width
BARG.Left = X

End Sub​
 

ahmadfononi

معاونت انجمن
Private Sub lblexit_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
lblexit.ForeColor = vbBlue
End Sub

Private Sub lblexit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lblexit.ForeColor = vbRed
End Sub

Private Sub lblexit_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
End
End Sub



Private Sub lblNEW_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
lblNEW.ForeColor = vbBlue
End Sub

Private Sub lblNEW_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lblNEW.ForeColor = vbRed
End Sub

Private Sub lblNEW_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

x1 = 1
y1 = 1
tupNum = 3
lblGameOver.Visible = False
lblTUP.Caption = tupNum & " tup"
tup.Left = Me.Width / 2
tup.Top = 500
emtiyaz = 0
lblEMTIYAZ.Caption = "0"
tup.Visible = True
Timer1.Interval = 1
End Sub​
 

ahmadfononi

معاونت انجمن
Private Sub Timer1_Timer()
tup.Left = tup.Left + harekateOFOGHI * x1
If tup.Left + tup.Width > Me.Width Or tup.Left <0> (Me.Height - 500) Then
If tup.Left + tup.Width > BARG.Left And tup.Left < (BARG.Left + BARG.Width) Then ' agar top samt rast pedal bod
If tup.Left <BARG> BARG.Left Then
x1 = 1
End If
y1 = y1 * -1
Beep
emtiyaz = emtiyaz + 200
lblEMTIYAZ.Caption = emtiyaz
Else
tup.Visible = False
tupNum = tupNum - 1
lblTUP.Caption = tupNum & " tup"
If tupNum = 0 Then
lblGameOver.Visible = True
Timer1.Interval = 0
Exit Sub
End If
tup.Left = Me.Width / 2
tup.Top = 500
tup.Visible = True
Timer1.Interval = 1
Exit Sub
End If
End If


If tup.Top <KADR>= 4000 Then
MsgBox "YOU WON!!!"
End
End If

End Sub​
 
بالا