TUTORIAL PEMBUATAN SLOT MACHINE
kelompok 25
Slot Machine merupakan salah satu games sederhana yang ada pada computer, juga bisa menjadi hiburan bagi kita. Slot machine ini dapat dibuat dengan menggunakan Visual Basic 2010. Pada kali ini kami membuat 2 macam slot machine, slot machine yang pertama menggunakan gambar dan slot machine kedua menggunakan angka. Berikut merupakan langkah-langkah dalam membuat slot machine :
Awalnya kami membuat form welcome dimana disana terdapat 2 button yang menyuruh kita untuk mengklik sala satunya apakah anda akan memainkan slot machine gambar atau angka.
Pada form ini kami juga membuat peraturan bermain games seperti yang kami cantumkan pada form diatas yaitu, pemain akan menang apabila menemukan gambar yang sama pasa box 1 dan box 3 dan apabila ketiga-tiga box mengeluarkan gambar yang sama.
Berikut merupakan keterangan properties pada form diatas
Komponen
|
Properties
|
Keterangan
|
Form 5
|
Name
|
Form 5
|
Text
|
Form 5
| |
Label 1
|
Name
|
Label 1
|
Text
|
Welcome to slot machine game
| |
Button 1
|
Name
|
Button 1
|
Text
|
Picture
| |
Button 2
|
Name
|
Button 2
|
Text
|
Number
| |
Label 2
|
Name
|
Label 2
|
Text
|
FOUND 2 SAME PICTURE IN THE BOX1 AND BOX3
| |
Label 3
|
Name
|
Label 3
|
Text
|
The Winner is our King
|
Kemudian listing dari form diatas sebagai berikut :
Public Class Form5
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form3.Show()
Me.Hide()
End Sub
End Class
1. Jika anda mengklik button picture pada form welome tersebut maka akan muncul form berikut
Jadi pada form ini anda sudah mulai bermain, gambar akan teracak sesuai dengan jangka waktu yang sudah kami tentukan dengan munggunakan “timer” pada propertiesnya jika anda mengklik button roll, kemudian jika anda mengklik stop, dan keluar message box yang menandakan anda menang, maka anda menang dan mendapatkan tambahan 3 credit. Sebaliknya, jika anda mendapatkan message box “sorry, please try again” berarti anda harus mengulangi permainan dan credit anda berkurang satu. Begitulah seterusnya. Jika anda mengklik button “back” berarti anda kembali ke form awal. Jika anda mengklik “give up”akan muncul form yang akan saya jelaskan nanti.
Berikut merupakan properties pada form diatas :
Komponen
|
Properties
|
Keterangan
|
Form 1
|
Name
|
Form 1
|
Text
|
Form 1
| |
Label 1
|
Name
|
Label 1
|
Text
|
Play
| |
Label 2
|
Name
|
Label 2
|
Text
|
Credit
| |
Label 3
|
Name
|
Label 3
|
Text
|
The Area of The game
| |
Textbox1
|
Name
|
Textbox1
|
Text
|
5
| |
Textbox2
|
Name
|
Textbox2
|
Text
| ||
PictureBox1
|
Name
|
PictureBox1
|
Image
|
Image
| |
PictureBox2
|
Name
|
PictureBox2
|
Image
|
Image
| |
PictureBox3
|
Name
|
PictureBox3
|
Image
|
Image
| |
Button1
|
Name
|
Button1
|
Text
|
Roll
| |
Button2
|
Name
|
Button2
|
Text
|
Stop
| |
Button3
|
Name
|
Button3
|
Text
|
Back
| |
Button 4
|
Name
|
Button 4
|
Text
|
Give Up
|
Kemudian Listing dari program ini adalah :
Public Class Form1
Dim counter, x1, x2, x3 As Integer
Dim credit As Integer
Dim main As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If counter < 1000 Then
x1 = Int(1 + Rnd() * 4)
x2 = Int(1 + Rnd() * 4)
x3 = Int(1 + Rnd() * 4)
Select Case x1
Case 1
PictureBox1.Image = ImageList1.Images.Item(0)
Case 2
PictureBox1.Image = ImageList1.Images.Item(1)
Case 3
PictureBox1.Image = ImageList1.Images.Item(2)
Case 4
PictureBox1.Image = ImageList1.Images.Item(3)
End Select
Select Case x2
Case 1
PictureBox2.Image = ImageList1.Images.Item(0)
Case 2
PictureBox2.Image = ImageList1.Images.Item(1)
Case 3
PictureBox2.Image = ImageList1.Images.Item(2)
Case 4
PictureBox2.Image = ImageList1.Images.Item(3)
End Select
Select Case x3
Case 1
PictureBox3.Image = ImageList1.Images.Item(0)
Case 2
PictureBox3.Image = ImageList1.Images.Item(1)
Case 3
PictureBox3.Image = ImageList1.Images.Item(2)
Case 4
PictureBox3.Image = ImageList1.Images.Item(3)
End Select
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static counter As Integer
counter = counter + 1
TextBox1.Text = Val(TextBox1.Text) - Val(1)
TextBox2.Text = counter
If TextBox2.Text = "" Then
TextBox2.Text = ""
main = ("0")
End If
Timer1.Enabled = True
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
If x1 = x3 Or x1 = x2 = x3 Then
MsgBox("PERFECT! YOU GOT 3 ADDITIONAL CREDITS")
Form4.Show()
Me.Hide()
TextBox1.Text = Val(TextBox1.Text) + Val(3)
Else : MsgBox("SORRY, TRY AGAIN")
End If
If TextBox1.Text = "0" Then
FORM2.SHOW()
Me.Hide()
End If
Button1.Enabled = True
Button2.Enabled = False
Button3.Enabled = True
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Form2.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Application.Restart()
End Sub
End Class
1. Sekarang, jika anda mengklik button number pada form welcome tadi maka akan muncul form berikut :
Sama seperti form sebelumnya, peraturannya juga sama, apabila anda mengklik roll dan angka akan beracak-acak an, setelah anda meng klik stop dan pada box 1 dan box 3 keluar angka yang sama atau tiga-tiganya keluar angka yang sama, maka anda dinyatakan menang lalu mendapatkan tambahan credit. Tapi jika tidak berarti nanti akan keluar message box “sorry, try again” maka anda diperkenankan untuk :mengulangi games lagi dan creditnya akan berkurang 1. Jika anda mengklik button “back” berarti anda kembali ke form awal. Jika anda mengklik “give up”akan muncul form yang akan saya jelaskan nanti.
Berikut merupakan properties yang terdapat pada form diatas :
Komponen
|
Properties
|
Keterangan
|
Form 3
|
Name
|
Form 3
|
Text
|
Form 3
| |
Label 1
|
Name
|
Label 1
|
Text
|
0
| |
Label 2
|
Name
|
Label 2
|
Text
|
0
| |
Label 3
|
Name
|
Label 3
|
Text
|
0
| |
Label 4
|
Name
|
Label 4
|
Text
|
5
| |
Label 5
|
Name
|
Label 5
|
Text
| ||
Label 6
|
Name
|
Label 6
|
Text
|
Just Roll !!
| |
Text Box 1
|
Name
|
Text Box 1
|
Text
|
5
| |
Text Box 2
|
Name
|
Text Box 2
|
Text
| ||
Button1
|
Name
|
Button1
|
Text
|
Roll
| |
Button2
|
Name
|
Button2
|
Text
|
Stop
| |
Button3
|
Name
|
Button3
|
Text
|
Back
| |
Button 4
|
Name
|
Button 4
|
Text
|
Give Up
|
Dan listing dari form diatas adalah :
Public Class Form3
Dim counter, x1, x2, x3 As Integer
Dim credit As Integer
Dim main As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = Int(Rnd() * 10)
Label2.Text = Int(Rnd() * 10)
Label3.Text = Int(Rnd() * 10)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static counter As Integer
counter = counter + 1
TextBox1.Text = Val(TextBox1.Text) - Val(1)
TextBox2.Text = counter
If TextBox2.Text = "" Then
TextBox2.Text = ""
main = ("0")
End If
Timer1.Enabled = True
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = False
Label1.Text = CStr(Int(Rnd() * 10))
Label2.Text = CStr(Int(Rnd() * 10))
Label3.Text = CStr(Int(Rnd() * 10))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
If Label1.Text = Label3.Text Or Label1.Text = Label2.Text = Label3.Text Then
MsgBox("PERFECT! YOU GOT 3 ADDITIONAL CREDITS")
TextBox1.Text = Val(TextBox1.Text) + Val(3)
Else : MsgBox("SORRY, TRY AGAIN")
End If
If TextBox1.Text = "0" Then
Form2.Show()
Me.Hide()
End If
Button1.Enabled = True
Button2.Enabled = False
Button3.Enabled = True
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Application.Restart()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Form2.Show()
Me.Hide()
End Sub
1. Form berikut akan muncul apabila anda menang dalam permainan slot machine ini, baik slot machine berupa angka maupun slot machine berupa gambar.
Jadi form form congrats ini akan muncul setelah message box yang menyatakan anda menang, baik pada slot machine gambar maupun pada slot machine angka. Jika anda mengklik button “continue” berarti anda melanjutkan games slot machine tersebut. Apabila anda mengklik “close” maka permainan selesai.
Berikut merupakan properties dari form diatas :
Komponen
|
Properties
|
Keterangan
|
Form4
|
Name
|
Form 4
|
Text
|
Form 4
| |
Label 1
|
Name
|
Label 1
|
Text
|
Congratulation
| |
Label 2
|
Name
|
Label 2
|
Text
|
you're the king !
| |
Button 1
|
Name
|
Button 2
|
Text
|
Continue
| |
Button 2
|
Name
|
Button 2
|
Text
|
Close
|
Kemudian listing dari form diatas adalah sebagai berikut :
Public Class Form4
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
1. Nah, ini merupakan form yang ditampilkan apabila anda mengklik “give up” pada form permainan kedua slot machine tadi, atau credit anda sudah habis dalam permainan (0).
Jika anda ingin bermain kembali silahkan mengklik button “play again” dan jika akan keluar silahkan kill button “qQ” . dan permainan berakhir.
Berikut merupakan properties dari form diatas :
Komponen
|
Properties
|
Keterangan
|
Form2
|
Name
|
Form 2
|
Text
|
Form 2
| |
Label 1
|
Name
|
Label 1
|
Text
|
Play again
| |
Button 1
|
Name
|
Button 1
|
Text
|
Play again
| |
Button 2
|
Name
|
Button 2
|
Text
|
qQ
|
Dan listing dari formdiatas adalah sebagai berikut :
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Application.Restart()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
TUTORIAL PEMBUATAN PUZZLE
Puzzle juga merupakan permainan sederhana yang melatih otak. Pada puzzle kali ini, kami membuat puzzle huruh, dimana huruf A-H yang tadinya acak-acakan bisa dibuat berurutan dari A-H pada permainan puzzle ini. Berikut merupakan tutorial dari Puzzle.
1. Awalnya kami membuat form welcome untuk pemain seperti ini :
Untuk bermain anda harus mengetahui dulu aturan dari permainan ini, dengan cara mengklik button “rules” pada form diatas.
Berikut merupakan properties form diatas :
Komponen
|
Properties
|
Keterangan
|
Form2
|
Name
|
Form 2
|
Text
|
Form 2
| |
Label 1
|
Name
|
Label 1
|
Text
|
Welcome to alphbet puzzle
| |
Button 1
|
Name
|
Button 1
|
Text
|
Rules
| |
Label 2
|
Name
|
Label 2
|
Text
|
Games for smart person
|
Dan listingnya sebagai berikut :
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.Show()
Me.Hide()
End Sub
End Class
1. Setelah mengklik button “rules”pada form 1 tadi, makanakan muncul form ini
Form ini berisikan peraturan sebelum kita memainkan puzzle ini, apabila anda sudah mengerti, silahkan klik button “game area”.
Berikut merupakan properties dari form diatas :
Komponen
|
Properties
|
Keterangan
|
Form2
|
Name
|
Form 2
|
Text
|
Form 2
| |
Label 1
|
Name
|
Label 1
|
Text
|
The rules
| |
Button 1
|
Name
|
Button 1
|
Text
|
Games Area
| |
Label 2
|
Name
|
Label 2
|
Text
|
Sort the alphabet from A-H by moving the alphabet box
|
Listing dari program diatas adalah sebagai berikut :
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.Show()
Me.Hide()
End Sub
End Class
1. Selanjutnya anda akan menikmati permainan puzzle dengan form berikut :
Inilah form permainan puzzle, dimana, jika anda mengklik “random”, maka huruf akan teracak –acak dan berhenti apabila anda mengklik “stop”. Kemudian anda diperkenankan untuk menyusun huruh tersebut sesuai abjad, jika sudah tersusun maka anda menang dengan ditandai oleh keluarnya message box. Tapi jika anda meras permainan tidak bisa lagi dilanjutkan, maka anda cukup meng klik button “give up?”
Berikut merupakan properties dari form diatas :
Komponen
|
Properties
|
Keterangan
|
Form 1
|
Name
|
Form 1
|
Text
|
Puzzle
| |
Label 1
|
Name
|
Label 1
|
Text
|
Puzzle Area
| |
Button 1
|
Name
|
Button 1
|
Text
|
A
| |
Button 2
|
Name
|
Button 2
|
Text
|
B
| |
Button 3
|
Name
|
Button 3
|
Text
|
C
| |
Button 4
|
Name
|
Button 4
|
Text
|
D
| |
Button 5
|
Name
|
Button 5
|
Text
|
E
| |
Button 6
|
Name
|
Give Up
|
Text
|
G
| |
Button 8
|
Name
|
Button 8
|
Text
|
H
| |
Button 9
|
Name
|
Button 9
|
Text
| ||
Button 10
|
Name
|
Button 10
|
Text
|
Give Up
| |
Button 11
|
Name
|
Button 11
|
Text
|
Random
| |
Button 12
|
Name
|
Button 12
|
Text
|
Stop
|
Berikut merupakan listing permainan puzzle pada form diatas :
Public Class Form1
Dim smt As String
Dim random As Integer
Private Sub cek()
If Button1.Text = "A" And
Button2.Text = "B" And
Button3.Text = "C" And
Button4.Text = "D" And
Button5.Text = "E" And Button6.Text = "F" And
Button7.Text = "G" And Button8.Text = "H" Then
MessageBox.Show("PERFECT")
Form5.Show()
Hide()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Form4.Show()
Me.Hide()
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button11_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
Timer1.Enabled = True
random = Rnd() * 10
Button1.Enabled = True
Button2.Enabled = True
Button3.Enabled = True
Button4.Enabled = True
Button5.Enabled = True
Button6.Enabled = True
Button7.Enabled = True
Button8.Enabled = True
Button9.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
smt = Button9.Text
Button9.Text = Button4.Text
Button4.Text = smt
smt = Button8.Text
Button8.Text = Button3.Text
Button3.Text = smt
smt = Button9.Text
Button9.Text = Button5.Text
Button5.Text = smt
smt = Button9.Text
Button9.Text = Button7.Text
Button7.Text = smt
smt = Button3.Text
Button3.Text = Button2.Text
Button2.Text = smt
smt = Button6.Text
Button6.Text = Button1.Text
Button1.Text = smt
smt = Button5.Text
Button5.Text = Button3.Text
Button3.Text = smt
smt = Button5.Text
Button5.Text = Button1.Text
Button1.Text = smt
smt = Button6.Text
Button6.Text = Button8.Text
Button8.Text = smt
smt = Button4.Text
Button4.Text = Button1.Text
Button1.Text = smt
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Timer1.Enabled = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button2.Text = "" Then
Button2.Text = Button1.Text
Button1.Text = ""
ElseIf Button4.Text = "" Then
Button4.Text = Button1.Text
Button1.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button1.Text = "" Then
Button1.Text = Button2.Text
Button2.Text = ""
ElseIf Button3.Text = "" Then
Button3.Text = Button2.Text
Button2.Text = ""
ElseIf Button5.Text = "" Then
Button5.Text = Button2.Text
Button2.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button2.Text = "" Then
Button2.Text = Button3.Text
Button3.Text = ""
ElseIf Button6.Text = "" Then
Button6.Text = Button3.Text
Button3.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Button1.Text = "" Then
Button1.Text = Button4.Text
Button4.Text = ""
ElseIf Button7.Text = "" Then
Button7.Text = Button4.Text
Button4.Text = ""
ElseIf Button5.Text = "" Then
Button5.Text = Button4.Text
Button4.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If Button2.Text = "" Then
Button2.Text = Button5.Text
Button5.Text = ""
ElseIf Button4.Text = "" Then
Button4.Text = Button5.Text
Button5.Text = ""
ElseIf Button6.Text = "" Then
Button6.Text = Button5.Text
Button5.Text = ""
ElseIf Button8.Text = "" Then
Button8.Text = Button5.Text
Button5.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If Button9.Text = "" Then
Button9.Text = Button6.Text
Button6.Text = ""
ElseIf Button3.Text = "" Then
Button3.Text = Button6.Text
Button6.Text = ""
ElseIf Button5.Text = "" Then
Button5.Text = Button6.Text
Button6.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If Button4.Text = "" Then
Button4.Text = Button7.Text
Button7.Text = ""
ElseIf Button8.Text = "" Then
Button8.Text = Button7.Text
Button7.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If Button7.Text = "" Then
Button7.Text = Button8.Text
Button8.Text = ""
ElseIf Button9.Text = "" Then
Button9.Text = Button8.Text
Button8.Text = ""
ElseIf Button5.Text = "" Then
Button5.Text = Button8.Text
Button8.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If Button6.Text = "" Then
Button6.Text = Button9.Text
Button9.Text = ""
ElseIf Button8.Text = "" Then
Button8.Text = Button9.Text
Button9.Text = ""
End If
If Button1.Text = "A" And Button2.Text = "B" And Button3.Text = "C" And Button4.Text = "D" And Button5.Text = "E" And Button6.Text = "F" And Button7.Text = "G" And Button8.Text = "H" And Button9.Text = "" Then
Form5.Show()
Me.Hide()
End If
End Sub
End Class
1. Jika anda menang, maka akan tampil form berikut :
Jika ingin bermain lagi, anda dipersilahkan untuk meng klik button “restart” , dan jika keluar silahkan klik button “close”.
Berikut merupakan properties dari form di atas :
Komponen
|
Properties
|
Keterangan
|
Form 5
|
Name
|
Form 5
|
Text
|
Form 5
| |
Label 1
|
Name
|
Label 1
|
Text
|
Congratulation
| |
Label 2
|
Name
|
Label 2
|
Text
|
Think smart work hard
| |
Label 3
|
Name
|
Label 3
|
Text
|
God bless you
| |
Button 1
|
Name
|
Button 1
|
Text
|
Restart
| |
Button 2
|
Name
|
Button 2
|
Text
|
Close
|
Listing dari form diatas :
Public Class Form5
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form1.Show()
Form1.Timer1.Enabled = True
Me.Hide()
End Sub
End Class
1. Jika anda meng klik tombol “give up” pada permainan tadi maka akan tampil form ini :
Jika anda meng klik button “close” maka permainan selesai, dan anda keluar.
Berikut merupakan properties dari form diatas :
Komponen
|
Properties
|
Keterangan
|
Form 4
|
Name
|
Form 4
|
Text
|
Form 4
| |
Label 1
|
Name
|
Label 1
|
Text
|
Don't be easily to give up
| |
Label 2
|
Name
|
Label 2
|
Text
|
Think smart work hard
| |
Label 3
|
Name
|
Label 3
|
Text
|
good Success Next Time
| |
Button 1
|
Name
|
Button 1
|
Text
|
Close
|
Listing dari form diatas adalah :
Public Class Form4
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
End Class