Programalama > VISUAL BASIC

Etiketler: oyun, yasin

Ort. 0
Puan ver:
' 2 adet timer 1 label 1 pictrue box ve bir tane command tuşu form da bulunması gerekenlerdendir

Dim satirsayisi, sutunsayisi, kutusayisi, puan

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Left = Command1.Left + 100

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft: Command1.Left = Command1.Left - 15
Case vbKeyRight: Command1.Left = Command1.Left + 15
If Command1.Left >= Form1.ScaleWidth - Command1.Width Then
Command1.Left = Form1.ScaleWidth - Command1.Width
End If
End Select

End Sub

Private Sub Form_Load()
Caption = "yasin çakmak"
Dim i, j, k
Show
ScaleMode = 3 'pixel
KeyPreview = True
satirsayisi = 5
sutunsayisi = 10
kutusayisi = satirsayi * sutunsayisi
Timer1.Interval = 10
Timer2.Interval = 10
Command1.Top = ScaleHeight - Label1.Height
Label1 = "0 "
Shape1.Shape = 3
Shape1.FillStyle = 7
Shape1.Width = 18
Shape1.Height = 18
Picture1(0).Width = 60
Picture1(0).Height = 20
widh = Picture1(0).Width * sutunsayisi * Screen.TwipsPerPixelX + 30
Picture1(0).Move 0, 0
Picture1(0).BackColor = QBColor(1)
For i = 1 To satirsayisi
For j = 1 To sutunsayisi
k = k + 1
Load Picture1(k)


Picture1(k).Left = Picture1(k - 1).Left + Picture1(k).Width
Picture1(k).Top = (i - 1) * Picture1(k).Height
Picture1(k).Visible = True
Picture1(k).BackColor = QBColor(i)
Next
Picture1(k).Left = 0
Next

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Left = X
End Sub



Private Sub Timer1_Timer()
Static xa, ya
If IsEmpty(xa) Then xa = 10: ya = 10
If Shape1.Left <= 0 Then xa = -xa
If Shape1.Left >= ScaleWidth Then xa = -xa
If Shape1.Top < 0 Then ya = -ya
If (Shape1.Top >= Command1.Top) And (Shape1.Top < (Command1.Top + Command1.Height)) And Shape1.Left > Command1.Left And Shape1.Left < (Command1.Left + Command1.Width) Then ya = -ya
If Shape1.Top >= ScaleHeight Then
MsgBox "oyun bitti"
Timer1.Interval = False
End

End If

Dim i, j, k
k = -1
For i = 1 To sutunsayisi
For j = 1 To satirsayisi
k = k + 1
If Picture1(k).Visible = True And Shape1.Left >= Picture1(k).Left And Shape1.Left < (Picture1(k).Left + Picture1(k).Width) And Shape1.Top <= (Picture1(k).Top + Picture1(k).Height) Then
Picture1(k).Visible = False
kutusayisi = kutusayisi - 1
ya = -ya
puan = puan + 100
Label1 = puan
End If
Next
Next
Shape1.Left = Shape1.Left + xa
Shape1.Top = Shape1.Top + ya
If kutusayisi = 1 Then
MsgBox ("tebrikler")

End If

End Sub

Private Sub Timer2_Timer()
Picture1(Rnd * (satirsayisi * sutunsayisi - 1)).BackColor = QBColor(Rnd * 15)
End Sub


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.