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

بازی تنیس

ahmadfononi

معاونت انجمن
Dim n As Single
Dim X As Integer
Dim t As Integer
Dim e As Integer
Dim Y As Integer
Dim r As Integer
Dim J As Long
Dim q As Integer
Private Sub Command1_Click()
t = Val(Text1.Text)
q = Val(Text2.Text)
Timer1.Enabled = True
Frame1.Visible = False
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 37
S2.Left = S2.Left - q
Case 39
S2.Left = S2.Left + q
End Select
End Sub

Private Sub Form_Load()
J = Timer
r = 1
e = 1
n = Rnd() * Rnd()
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Timer - J
X = X + t * r
Y = Y + n * t * e
S.Move X, Y
If Abs(S.Top + S.Height - S2.Top) < 8 And S.Left + S.Width > S2.Left And S.Left < S2.Left + S2.Width Then
e = -1
End If
If Abs(S.Left + S.Width - Form1.Width) < 8 Then
r = -1
End If
If S.Top < 10 Then
e = 1
End If
If S.Left < 10 Then
r = 1
End If
If S.Top - 100 > Form1.Height Then
u = MsgBox("game over")
End
End If

End Sub
 
بالا