“PUZZLE”
Tujuan
pembuatan program aplikasi puzzle ini adalah untuk memenuhi penugasan modul 3
yang diberikan oleh asisten Desision Suport System selain itu juga bertujuan
untuk menghibur atau penghilang stress bagi para user dan menantang para user
untuk dapat memenangkan sebuah permainan puzzle ini.
Sasaran
Sasaran
dari pembuatan program aplikasi puzzle ini adalah semua usia baik anak-anak,
remaja, maupun orang dewasa karena tujuan dari permainan ini untuk menghibur
atkau untuk melepas penat dari segala kesibukan aktivitas.
Deskripsi
Program
aplikasi puzzle terdiri dari 2 form
dengan form pertama adalah permainan puzzle dan form ke 2 adalah gambar asli
dari puzzle. Form 1 adalah tempat permainan puzzle dimana user harus menean tombol start untuk mengacak
gambar tersebut dan menekan tombol stop untuk menghentikan acakan gambar.
Setelah gambar diacak maka user wajib menyusun gambar sesuai contoh yang ada di
form 2 dengan cara menggeser ke arah kanan, kiri, atas maupun bawah. Apabila
user dapat menyusun puzzle tersebut sesuai dengan contoh yang terdapat di form
2 maka user memenangkan permainan tersebut dan bila user tidak dapat
menyelesaikan permainan ini maka gambar akan kembali seperti semula.
TUTORIAL PEMBUATAN PROGRAM :
1.Membuka Aplikasi Visual Basic 2010
2.Pilih Windows Form aplication
3. klik Ok, dan akan muncul tampilan seperti dibawah ini
4. Pilih toolbox yg ingin anda gunakan
5.buatlah tampilan seperti di bawah ini
6. lalu masukan listing ke dalam setiap form
untuk form 1 :
ini adalah main form dari aplikasi Puzzle ini, berikut isi listingnya :
Public Class Form1
Dim mulai As Integer
Dim smt As String
Dim gbr As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
mulai = Rnd() * 50
Label2.Text = 0
Button1.Visible = False
Label4.Text = Int(Label4.Text) + 1
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
smt = Button11.Text
Button11.Text = Button6.Text
Button6.Text = smt
gbr = Button11.BackgroundImage
Button11.BackgroundImage = Button6.BackgroundImage
Button6.BackgroundImage = gbr
smt = Button11.Text
Button11.Text = Button5.Text
Button5.Text = smt
gbr = Button11.BackgroundImage
Button11.BackgroundImage = Button5.BackgroundImage
Button5.BackgroundImage = gbr
smt = Button4.Text
Button4.Text = Button9.Text
Button9.Text = smt
gbr = Button4.BackgroundImage
Button4.BackgroundImage = Button9.BackgroundImage
Button9.BackgroundImage = gbr
smt = Button4.Text
Button4.Text = Button8.Text
Button8.Text = smt
gbr = Button4.BackgroundImage
Button4.BackgroundImage = Button8.BackgroundImage
Button8.BackgroundImage = gbr
smt = Button5.Text
Button5.Text = Button10.Text
Button10.Text = smt
gbr = Button5.BackgroundImage
Button5.BackgroundImage = Button10.BackgroundImage
Button10.BackgroundImage = gbr
smt = Button5.Text
Button5.Text = Button3.Text
Button3.Text = smt
gbr = Button5.BackgroundImage
Button5.BackgroundImage = Button3.BackgroundImage
Button3.BackgroundImage = gbr
smt = Button7.Text
Button7.Text = Button10.Text
Button10.Text = smt
gbr = Button7.BackgroundImage
Button7.BackgroundImage = Button10.BackgroundImage
Button10.BackgroundImage = gbr
smt = Button7.Text
Button7.Text = Button9.Text
Button9.Text = smt
gbr = Button7.BackgroundImage
Button7.BackgroundImage = Button9.BackgroundImage
Button9.BackgroundImage = gbr
smt = Button8.Text
Button8.Text = Button3.Text
Button3.Text = smt
gbr = Button8.BackgroundImage
Button8.BackgroundImage = Button3.BackgroundImage
Button3.BackgroundImage = gbr
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button4.Text = "" Then
gbr = Button3.BackgroundImage
Button3.BackgroundImage = Button4.BackgroundImage
Button4.BackgroundImage = gbr
smt = Button3.Text
Button3.Text = Button4.Text
Button4.Text = smt
ElseIf Button6.Text = "" Then
gbr = Button3.BackgroundImage
Button3.BackgroundImage = Button6.BackgroundImage
Button6.BackgroundImage = gbr
smt = Button3.Text
Button3.Text = Button6.Text
Button6.Text = smt
End If
Label2.Text = Int(Label2.Text) + 1
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Label2.Text = Int(Label2.Text) + 1
If Button3.Text = "" Then
gbr = Button4.BackgroundImage
Button4.BackgroundImage = Button3.BackgroundImage
Button3.BackgroundImage = gbr
smt = Button4.Text
Button4.Text = Button3.Text
Button3.Text = smt
ElseIf Button7.Text = "" Then
gbr = Button4.BackgroundImage
Button4.BackgroundImage = Button7.BackgroundImage
Button7.BackgroundImage = gbr
smt = Button4.Text
Button4.Text = Button7.Text
Button7.Text = smt
ElseIf Button5.Text = "" Then
gbr = Button4.BackgroundImage
Button4.BackgroundImage = Button5.BackgroundImage
Button5.BackgroundImage = gbr
smt = Button4.Text
Button4.Text = Button5.Text
Button5.Text = smt
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Label2.Text = Int(Label2.Text) + 1
If Button4.Text = "" Then
gbr = Button5.BackgroundImage
Button5.BackgroundImage = Button4.BackgroundImage
Button4.BackgroundImage = gbr
smt = Button5.Text
Button5.Text = Button4.Text
Button4.Text = smt
ElseIf Button8.Text = "" Then
gbr = Button5.BackgroundImage
Button5.BackgroundImage = Button8.BackgroundImage
Button8.BackgroundImage = gbr
smt = Button5.Text
Button5.Text = Button8.Text
Button8.Text = smt
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Label2.Text = Int(Label2.Text) + 1
If Button3.Text = "" Then
gbr = Button6.BackgroundImage
Button6.BackgroundImage = Button3.BackgroundImage
Button3.BackgroundImage = gbr
smt = Button6.Text
Button6.Text = Button3.Text
Button3.Text = smt
ElseIf Button7.Text = "" Then
gbr = Button6.BackgroundImage
Button6.BackgroundImage = Button7.BackgroundImage
Button7.BackgroundImage = gbr
smt = Button6.Text
Button6.Text = Button7.Text
Button7.Text = smt
ElseIf Button9.Text = "" Then
gbr = Button6.BackgroundImage
Button6.BackgroundImage = Button9.BackgroundImage
Button9.BackgroundImage = gbr
smt = Button6.Text
Button6.Text = Button9.Text
Button9.Text = smt
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Label2.Text = Int(Label2.Text) + 1
If Button4.Text = "" Then
gbr = Button7.BackgroundImage
Button7.BackgroundImage = Button4.BackgroundImage
Button4.BackgroundImage = gbr
smt = Button7.Text
Button7.Text = Button4.Text
Button4.Text = smt
ElseIf Button6.Text = "" Then
gbr = Button7.BackgroundImage
Button7.BackgroundImage = Button6.BackgroundImage
Button6.BackgroundImage = gbr
smt = Button7.Text
Button7.Text = Button6.Text
Button6.Text = smt
ElseIf Button10.Text = "" Then
gbr = Button7.BackgroundImage
Button7.BackgroundImage = Button10.BackgroundImage
Button10.BackgroundImage = gbr
smt = Button7.Text
Button7.Text = Button10.Text
Button10.Text = smt
ElseIf Button8.Text = "" Then
gbr = Button7.BackgroundImage
Button7.BackgroundImage = Button8.BackgroundImage
Button8.BackgroundImage = gbr
smt = Button7.Text
Button7.Text = Button8.Text
Button8.Text = smt
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Label2.Text = Int(Label2.Text) + 1
If Button5.Text = "" Then
gbr = Button8.BackgroundImage
Button8.BackgroundImage = Button5.BackgroundImage
Button5.BackgroundImage = gbr
smt = Button8.Text
Button8.Text = Button5.Text
Button5.Text = smt
ElseIf Button7.Text = "" Then
gbr = Button8.BackgroundImage
Button8.BackgroundImage = Button7.BackgroundImage
Button7.BackgroundImage = gbr
smt = Button8.Text
Button8.Text = Button7.Text
Button7.Text = smt
ElseIf Button11.Text = "" Then
gbr = Button8.BackgroundImage
Button8.BackgroundImage = Button11.BackgroundImage
Button11.BackgroundImage = gbr
smt = Button8.Text
Button8.Text = Button11.Text
Button11.Text = smt
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Label2.Text = Int(Label2.Text) + 1
If Button6.Text = "" Then
gbr = Button9.BackgroundImage
Button9.BackgroundImage = Button6.BackgroundImage
Button6.BackgroundImage = gbr
smt = Button9.Text
Button9.Text = Button6.Text
Button6.Text = smt
ElseIf Button10.Text = "" Then
gbr = Button9.BackgroundImage
Button9.BackgroundImage = Button10.BackgroundImage
Button10.BackgroundImage = gbr
smt = Button9.Text
Button9.Text = Button10.Text
Button10.Text = smt
End If
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Label2.Text = Int(Label2.Text) + 1
If Button7.Text = "" Then
gbr = Button10.BackgroundImage
Button10.BackgroundImage = Button7.BackgroundImage
Button7.BackgroundImage = gbr
smt = Button10.Text
Button10.Text = Button7.Text
Button7.Text = smt
ElseIf Button11.Text = "" Then
gbr = Button10.BackgroundImage
Button10.BackgroundImage = Button11.BackgroundImage
Button11.BackgroundImage = gbr
smt = Button10.Text
Button10.Text = Button11.Text
Button11.Text = smt
ElseIf Button9.Text = "" Then
gbr = Button10.BackgroundImage
Button10.BackgroundImage = Button9.BackgroundImage
Button9.BackgroundImage = gbr
smt = Button10.Text
Button10.Text = Button9.Text
Button9.Text = smt
End If
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
Label2.Text = Int(Label2.Text) + 1
If Button10.Text = "" Then
gbr = Button11.BackgroundImage
Button11.BackgroundImage = Button10.BackgroundImage
Button10.BackgroundImage = gbr
smt = Button11.Text
Button11.Text = Button10.Text
Button10.Text = smt
ElseIf Button8.Text = "" Then
gbr = Button11.BackgroundImage
Button11.BackgroundImage = Button8.BackgroundImage
Button8.BackgroundImage = gbr
smt = Button11.Text
Button11.Text = Button8.Text
Button8.Text = smt
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CenterToScreen()
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
If Button1.Visible = True Then
MsgBox("anda belum menyelesaikan permainan anda", MsgBoxStyle.Critical, "error")
Else
MsgBox("selamat anda berhasil menyelesaikan game dalam " & Label2.Text & "" & "langkah", MsgBoxStyle.Information, "congratulation")
End If
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
Button1.Visible = True
Label2.Text = 0
Button3.Text = 1
Button4.Text = 2
Button5.Text = 3
Button6.Text = 4
Button7.Text = 5
Button8.Text = 6
Button9.Text = 7
Button10.Text = 8
Button11.Text = ""
Button3.BackgroundImage = WindowsApplication1.My.Resources.bt11
Button4.BackgroundImage = WindowsApplication1.My.Resources.bt2
Button5.BackgroundImage = WindowsApplication1.My.Resources.bt3
Button6.BackgroundImage = WindowsApplication1.My.Resources.bt4
Button7.BackgroundImage = WindowsApplication1.My.Resources.bt5
Button8.BackgroundImage = WindowsApplication1.My.Resources.bt6
Button9.BackgroundImage = WindowsApplication1.My.Resources.bt7_2
Button10.BackgroundImage = WindowsApplication1.My.Resources.bt8_2
Button11.BackgroundImage = Nothing
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
Form2.Show()
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
If Form3.Visible = True Then
MsgBox("pemuatan gagal !!!!!")
Else
Form3.ListBox1.Items.Add(Label2.Text)
Form3.ListBox2.Items.Add(Label4.Text)
Form3.Show()
End If
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
End
End Sub
End Class
untuk form 2 :
sedangkan form 2 adalah form untuk menunjukan contoh gambar yg harus disusun,isi listingnya sebagai berikut :
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
untuk form 3 :
sedangkan form 3 digunakan sebagai rekaan data dari permainan, isi listing sebagai berikut :
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
End Sub
End Class
program dapat didownload di :
0 komentar:
Posting Komentar