Senin, 23 Desember 2013

Modifikasi Aplikasi “Roulette Table” pada Visual Basic 6.0

Roulette Table 2nd VB6

Sedikit memodifikasi aplikasi serupa yang sebelumnya sudah saya postingkan sehingga terlihat seperti games sesungguhnya. Seperti yang terlihat pada gambar di samping, tidak banyak perubahan yang saya tambahkan hanya beberapa faktor yang sudah sepatutnya terdapat pada sebuah games.

1. Jalankan aplikasi Visual Basic 6.0

2. Pada jendela “New Project” pilih “Standard EXE” kemudian tekan tombol “Open”

3. Berikut setingan kontrol properti yang terdapat pada aplikasi ini

Object Name Properties Setting
Form Form1 Border Style 1 - Fixed Single
    Caption

Roulette Table

    Font Tahoma; 10pt
    Start Up Position 2 - Center Screen
Label lblDisplay1 Alignment 2 - Center
    Back Color &HFFFFFF
    Caption (Empty)
    Font Tahoma; 28pt
Label lblDisplay2 Alignment 2 - Center
    Back Color &HFFFFFF
    Caption (Empty)
    Font Tahoma; 28pt
Label lblDisplay3 Alignment 2 - Center
    Back Color &HFFFFFF
    Caption (Empty)
    Font Tahoma; 28pt
Picture Box picDisplay Border Style 0 - None
    Picture C:\Program Files\Microsoft Visual Studio\Common\Graphics\Metafile\Business\MONEY.WMF
    Visible False
Command Button cmdSpin Caption Spin
Command Button cmdExit Caption E&xit
Label lblDisplayPlayed Auto Size True
    Caption Played:
Label lblPlayed Alignment 2 - Center
    Back Color &HFFFFFF
    Caption 0
Label lblDisplayPoint Auto Size True
    Caption Point:
Label lblPoint Alignment 2 - Center
    Back Color &HFFFFFF
    Caption 1000
Label lblDisplayWin Auto Size True
    Caption Win:
Label lblWinCount Alignment 2 - Center
    Back Color &HFFFFFF
    Caption 0
Label lblDisplayLose Auto Size True
    Caption Lose:
Label lblLoseCount Alignment 2 - Center
    Back Color &HFFFFFF
    Caption 0
Line Line1 Border Width 1
Line Line2 Border Color &HFFFFFF
    Border Width 2
Label lblDisplayBets Auto Size True
    Caption Total Bets:
Label lblBets Alignment 2 - Center
    Back Color &HFFFFFF
    Caption 0

4. Berikut event code program

Private Sub cmdExit_Click()
    End
End Sub

Private Sub cmdSpin_Click()
    Dim Count, Response, Bets As Integer

    picDisplay.Visible = False
    lblDisplay1.Caption = Int(Rnd * 10)
    lblDisplay2.Caption = Int(Rnd * 10)
    lblDisplay3.Caption = Int(Rnd * 10)
    Count = 0
    Count = lblPlayed.Caption
    lblPlayed.Caption = Val(Count) + 1
    If lblDisplay1.Caption = 9 Or lblDisplay2.Caption = 9 Or lblDisplay3.Caption = 9 Then
        picDisplay.Visible = True
        lblPoint.Caption = Val(lblPoint.Caption) + 100
        lblWinCount.Caption = Val(lblWinCount.Caption) + 1
    Else
        lblPoint.Caption = Val(lblPoint.Caption) - 100
        lblLoseCount.Caption = Val(lblLoseCount.Caption) + 1
    End If
    If lblDisplay1.Caption = 9 And lblDisplay2.Caption = 9 Then
        lblPoint.Caption = Val(lblPoint.Caption) + 100
    ElseIf lblDisplay1.Caption = 9 And lblDisplay3.Caption = 9 Then
        lblPoint.Caption = Val(lblPoint.Caption) + 100
    ElseIf lblDisplay2.Caption = 9 And lblDisplay3.Caption = 9 Then
        lblPoint.Caption = Val(lblPoint.Caption) + 100
    End If
    If lblDisplay1.Caption = 9 And lblDisplay2.Caption = 9 And lblDisplay3.Caption = 9 Then
        lblPoint.Caption = Val(lblPoint.Caption) + 200
    End If
    If lblPoint.Caption = "0" Then
        Response = MsgBox("You don’t have enough point!!" + vbCrLf + vbCrLf + "Try again?", vbQuestion + vbYesNo, "Confirmation")
        If Response = vbYes Then
            lblPoint.Caption = 1000
            lblWinCount.Caption = 0
            lblLoseCount.Caption = 0
            lblPlayed.Caption = 0
            lblDisplay1.Caption = 0
            lblDisplay2.Caption = 0
            lblDisplay3.Caption = 0
            Bets = 1000
            lblBets.Caption = Bets + Val(lblBets.Caption)
        Else
            End
        End If
    End If
End Sub

Private Sub Form_Load()
    Randomize
End Sub

Label:

0 Komentar:

Posting Komentar

Berlangganan Posting Komentar [Atom]

<< Beranda