Anda di halaman 1dari 4

bagaimana cara membuat game kloningan FlappyBird yang sedang booming.

siapa yang tidak tahu game buatan nguyen.


yang anda butuhkan adalah :
1. anda harus memiliki visual basic 6.0 untuk membuatnya.
yang belum punya bisa menuju postingan saya sebelumnya disini

2. karakter burungnya , tangki , dan backgroundnya.


bisa diunduh lengkap disini

3. Komponen Transparansi Gambar, klik disini

Ok, Pertama Silahkan Buka Aplikasi VB6.0nya


dan buatlah design seperti dibawah ini

keterangan :
2 Buah Timer dengan nama
tmrmove
timer1
importlah gambar tanki
tambahkan 1 label sebagai score
dan 1 karakter serta juga 3 buah command button.
dan masuklah ke bagian kode, pastekan kode dibawah ini
Private Sub Command1_Click()
If Command1.Caption = "Flap" Then
If Not started Then
started = True
Timer1.Enabled = True
tmrMove.Enabled = True
End If
imgBird.Picture = LoadPicture(App.Path & "\img\bird-up.gif")
imgBird.Top = imgBird.Top - 600
Else
NewGame
End If
End Sub

Private Sub Command2_Click()


started = False
tmrMove.Enabled = False
End Sub

Private Sub Command3_Click()


MsgBox "Welcome Semua, Saya Raka Adi N. Admin Blog Raka Adi Nugroho.blogspot.com | Flappybird gila",
vbOKOnly, "@RakaAdiN"

End Sub

Private Sub Form_Load()


ucPicBuddy1.AttachChildControl Image1
ucPicBuddy2.AttachChildControl imgBird
pipeHDistance = 2333
pipeVDistance = 1750
allHeight = 4200
speed = 100
Me.Width = (2333 * 3) - Image1.Width

NewGame
End Sub

Private Sub Timer1_Timer()


If imgBird.Top >= 3600 Then
Gameovered
Else
If started Then
imgBird.Picture = LoadPicture(App.Path & "\img\bird-down.gif")
imgBird.Top = imgBird.Top + 300
End If
End If
End Sub

Private Sub tmrMove_Timer()


If CheckIfGameOver Then
Exit Sub
Else
Image1.Top = Image2.Top + Image2.Height + pipeVDistance
Image4.Top = Image3.Top + Image3.Height + pipeVDistance
Image1.Height = allHeight - (Image2.Top + Image2.Height + pipeVDistance)
Image4.Height = allHeight - (Image3.Top + Image3.Height + pipeVDistance)

Image1.Left = Image1.Left - speed


Image2.Left = Image1.Left
Image3.Left = Image3.Left - speed
Image4.Left = Image3.Left

Image5.Left = Image5.Left - speed


Image6.Left = Image6.Left - speed

If Image1.Left <= 1580 And scored1 = False Then


scored1 = True
scored4 = False
Label1.Caption = Val(Label1.Caption) + 1
PlaySound App.Path & "\img\scored.wav", 0, SND_FILENAME Or SND_ASYNC
End If

If Image4.Left <= 1580 And scored4 = False Then


scored4 = True
scored1 = False
Label1.Caption = Val(Label1.Caption) + 1
PlaySound App.Path & "\img\scored.wav", 0, SND_FILENAME Or SND_ASYNC
End If

Randomize
Dim value As Integer
value = CInt(Int((1000 * Rnd()) + 615))
If Image1.Left <= (Image1.Width - (Image1.Width * 2)) Then
Image2.Height = value
Image1.Left = Me.Width
End If
If Image3.Left <= (Image3.Width - (Image3.Width * 2)) Then
Image3.Height = value
Image3.Left = Me.Width
End If
If Image5.Left <= (Image5.Width - (Image5.Width * 2)) Then
Image5.Left = Image6.Left + (Image6.Width - 180)
End If
If Image6.Left <= (Image6.Width - (Image6.Width * 2)) Then
Image6.Left = Image5.Left + (Image5.Width - 180)
End If
End If
End Sub

Anda mungkin juga menyukai