Donatur utama

Selasa, 28 Oktober 2008

Game Tembak

Keterangan Bermain :
tekan spasi untuk menembak
tekan esc untuk keluar
Mau Main Klik TIK dulu

ini nih kodenya :
Module Module1

Sub Main()
Console.Clear()
Console.BackgroundColor = 9
Dim i, x, y As Integer

For x = 30 To 45
Console.CursorLeft = x
Console.CursorTop = 11
Console.Write(" ")
System.Threading.Thread.Sleep(100)
Next
Console.BackgroundColor = 0
Console.Clear()
Dim tombol As Integer
Do
Console.Clear()
Console.CursorTop = 12
Console.CursorLeft = 30
Console.Write("tekan enter")
tombol = Console.ReadKey.Key
Loop While (tombol <> 13)

Console.BackgroundColor = ConsoleColor.White
For x = 1 To 78

Console.CursorLeft = x
Console.CursorTop = 1
Console.Write(" ")
Console.CursorLeft = x
Console.CursorTop = 23
Console.Write(" ")
Next
For i = 2 To 22

Console.CursorLeft = 1
Console.CursorTop = i
Console.Write(" ")
Console.CursorLeft = 78
Console.CursorTop = i
Console.Write(" ")
Next


Console.BackgroundColor = ConsoleColor.Black
Dim xs, ys
xs = 10
ys = 10
x = 42
y = 2
Dim ay
ay = 1
Dim sp, xp, yp
sp = 0
yp = 0 : xp = 0
Dim skor = 0
Do
Console.CursorTop = 3
Console.CursorLeft = 5
Console.Write("skor=" & skor)
If sp = 1 Then
Console.CursorTop = yp
Console.CursorLeft = xp
Console.Write("-")
End If
Console.CursorLeft = xs
Console.CursorTop = ys
Console.Write("*")
Console.CursorLeft = x
Console.CursorTop = y
Console.Write("0")
System.Threading.Thread.Sleep(10)
If sp = 1 Then
Console.CursorTop = yp
Console.CursorLeft = xp
Console.Write(" ")
End If
Console.CursorLeft = xs
Console.CursorTop = ys
Console.Write(" ")
Console.CursorLeft = x
Console.CursorTop = y
Console.Write(" ")
y = y + ay
If y = 2 Then
ay = 1
ElseIf y = 22 Then
ay = -1
End If

If Console.KeyAvailable Then
tombol = Console.ReadKey.Key
If tombol = 38 Then
If ys > 3 Then
ys = ys - 1
Else
ys = 3
End If
ElseIf tombol = 40 Then
If ys < ys =" ys" ys =" 23" tombol =" 32" sp =" 0" sp =" 1" xp =" xs" yp =" ys" sp =" 1" xp =" xp" sp =" 0" xp =" x" yp =" y" skor =" skor"> 27)



Console.ReadKey()
End Sub

End Module

1 komentar:

Omadi Jaya on 25 Februari 2009 pukul 05.44 mengatakan...

Artikelnya bagus :D

Top dah..
ebenk789

 

Berlangganan

Enter your email address:

Delivered by FeedBurner

Belajar Tik


Pengikut

Komentar Terbaru

Belajar Tik
Tempatnya Belajar Teknologi Informasi dan Komunikasi

Administrator By : 3eta