Donatur utama

Kamis, 16 Oktober 2008

Program Bola Lambung

Module Module2
Sub main()
Dim x, y, ax, ay, a, x1, y1, ax1, ay1
x1 = 50
y1 = 2
ax1 = 1
ay1 = 1
x = 1
y = 1
ax = 1
ay = 1
Do
Console.CursorTop = y
Console.CursorLeft = x
Console.Write(a)
Console.CursorTop = y1
Console.CursorLeft = x1
Console.Write("*")
System.Threading.Thread.Sleep(100)
Console.CursorTop = y
Console.CursorLeft = x
Console.Write(" ")
Console.CursorTop = y1
Console.CursorLeft = x1
Console.Write(" ")

If x = 78 Then
ax = -1
a = Chr(Int(Rnd() * 26) + 65)
Console.ForegroundColor = Int(Rnd() * 14)
ElseIf x = 2 Then
ax = 1
a = Chr(Int(Rnd() * 26) + 65)
Console.ForegroundColor = Int(Rnd() * 14)
ElseIf y = 23 Then
ay = -1
a = Chr(Int(Rnd() * 26) + 65)
Console.ForegroundColor = Int(Rnd() * 14)
ElseIf y = 1 Then
ay = 1
a = Chr(Int(Rnd() * 26) + 65)
Console.ForegroundColor = Int(Rnd() * 14)
End If
If x1 = 78 Then
ax1 = -1
ElseIf x1 = 2 Then
ax1 = 1
ElseIf y1 = 23 Then
ay1 = -1
ElseIf y1 = 1 Then
ay1 = 1
End If
x = x + ax
y = y + ay
x1 = x1 + ax1
y1 = y1 + ay1

Loop While (Not Console.KeyAvailable)
End Sub
End Module

0 komentar:

 

Berlangganan

Enter your email address:

Delivered by FeedBurner

Belajar Tik


Pengikut

Komentar Terbaru

Belajar Tik
Tempatnya Belajar Teknologi Informasi dan Komunikasi

Administrator By : 3eta