CODING GAME ROKET MENGGUNAKAN
VISUSAL BASIC 6
CODE :
Public XHOR As Integer
Public XVER As Integer
Public XPESAWAT As Integer
Private Sub Form_Activate()
XHOR = 4700
XVER = 6000
XPESAWAT = 0
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyRight Then
ROKET.Height = 600
ROKET.Width = 800
ROKET.Picture = LoadPicture(App.Path & "\RKANAN.JPG")
ROKET.Left = XHOR
XHOR = XHOR + 50
End If
If KeyCode = vbKeyLeft Then
ROKET.Height = 600
ROKET.Width = 800
ROKET.Picture = LoadPicture(App.Path & "\RKIRI.JPG")
ROKET.Left = XHOR
XHOR = XHOR - 50
End If
If KeyCode = vbKeyUp Then
ROKET.Height = 800
ROKET.Width = 600
ROKET.Picture = LoadPicture(App.Path & "\ROKET.JPG")
ROKET.Top = XVER
XVER = XVER - 50
End If
If KeyCode = vbKeyDown Then
ROKET.Height = 800
ROKET.Width = 600
ROKET.Picture = LoadPicture(App.Path & "\RBAWAH.JPG")
ROKET.Top = XVER
XVER = XVER + 50
End If
If KeyCode = vbKeySpace Then
PELURU.Visible = True
PELURU.Left = XHOR + 150
For A = XVER - 600 To 0 Step -0.5
PELURU.Top = A
Next A
End If
PELURU.Visible = False
End Sub
Private Sub Form_Load()
AWAN.Left = 0
AWAN.Top = 0
AWAN.Width = FormROKET.Width
AWAN.Height = FormROKET.Height
End Sub
Private Sub Timer1_Timer()
PESAWAT.Left = XPESAWAT
If XPESAWAT = XHOR Then
LEDAKAN.Left = XHOR + 200
LEDAKAN.Visible = True
A = Timer + 1
Do While A > Timer
DoEvents
Loop
LEDAKAN.Visible = False
XPESAWAT = 0
End If
XPESAWAT = XPESAWAT + 50
If XPESAWAT > 10000 Then XPESAWAT = 0
End Sub
.png)
.png)
Komentar
Posting Komentar