Bu mantık Vb ve C++ da oyunların 360 derecelik elipslerinde kullanılabilir.
Öncelikle formunuza iki tane shape cizin. Bunların shape özelliğini circle yapın.
Bir timer oluşturun ve interval özelliğini 1 degerine getirin.
Bir modül oluşturun ve içine şu aşagıdaki veriyi girin.
'---------------------------
Global xx, yy, gw, r, aci
'---------------------------
Formunuzun kodunuda şöyle aşagıdaki gibi değiştirin.
'---------------------------
PHP Kodu:
Private Sub Form_Load()
Form1.WindowState = 2
'fulscreen olmasını sağladık
Shape2.Height = 855
Shape2.Width = 855
Shape2.Left = 6500
Shape2.Top = 4900
'güneşi ayarladık
Shape1.Height = 495
Shape1.Width = 495
Shape1.Left = 9520
Shape1.Top = 5880
'dunyayı ayarladık
r = 3.14 / 180
aci = 90
xx = 0
yy = 0
End Sub
'Bydigi.net
Private Sub Timer1_Timer()
aci = aci + 10
If aci = 360 Then aci = 0
If aci >= 180 And aci <= 360 Then
Shape1.Width = Shape1.Width - 20
Shape1.Height = Shape1.Height - 20
Else
Shape1.Width = Shape1.Width + 20
Shape1.Height = Shape1.Height + 20
End If
xx = 600 * Cos(aci * r)
yy = 300 * Sin(aci * r)
Shape1.Left = Shape1.Left + xx
Shape1.Top = Shape1.Top + yy