18 Ekim 2011 Salı

Labirent Oyunu

PROFESYONEL YAZILIM MÜHENDİSLİĞİ UYGULAMALARI DERSİ

BASİT BİR LABİRENT OYUNU




KODLAR

Public Class frmGame
    Dim i As Integer
    Dim Basla As Boolean = False
    Dim gecensure As Integer = 0
____________________________________________________________________ 
Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
        If Basla = True Then
            MsgBox("Kaybettiniz")
            Basla = False
            btnBitir.Visible = False
            Sure.Stop()
        End If
    End Sub

____________________________________________________________________
    Private Sub btnBasla_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBasla.Click
        btnBitir.Visible = True
        Basla = True
        Kare.Start()
        Sure.Start()
        gecensure = 0
    End Sub
____________________________________________________________________
    Private Sub btnBitir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBitir.Click
        If Basla = True Then
            Basla = False
            MsgBox("Kazandınız")
            Sure.Stop()
        End If
    End Sub
____________________________________________________________________
    Dim Saga As Boolean = False
    Private Sub Kare_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kare.Tick
        If Saga = True Then
            btnKare.Left += 10
        Else
            btnKare.Left -= 10
        End If
        If btnKare.Left > 390 Then
            Saga = False
            btnKare.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)
            btnKare.Image = My.Resources._1111
        End If
        If btnKare.Left < 265 Then
            Saga = True
            btnKare.Image.RotateFlip(RotateFlipType.RotateNoneFlipY)
            btnKare.Image = My.Resources.images
        End If
    End Sub
____________________________________________________________________
    Private Sub btnKare_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        If Basla = True Then
            MsgBox("Kaybettiniz")
            Basla = False
            btnBitir.Visible = False
        End If
    End Sub
____________________________________________________________________
    Private Sub Sure_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sure.Tick
        gecensure += 1
        lblSonuc.Text = gecensure
    End Sub
End Class

Hiç yorum yok:

Yorum Gönder