Visual Basic - 我做错了什么?

时间:2013-10-07 18:32:33

标签: vb.net-2010

我正在制作一个迷宫游戏,我将生命设置为5.总是在我的表格顶部:

Dim lives As Integer = 5

进一步沿着我已经制作的形式,当用户击中边界时,图片框移回到它的起始位置并扣除一个生命。然而,除了第一次生命失去时,这一切都有效,它减少了2个生命而不是1个。我使用的代码是:

Private Sub PictureBoxPlayer_move(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBoxPlayer.Move
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall12.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
        End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall11.Bounds) Then
       PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall9.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall8.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall7.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall6.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall5.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall4.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall3.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall2.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    If PictureBoxPlayer.Bounds.IntersectsWith(PictureBoxWall1.Bounds) Then
        PictureBoxPlayer.Location = New Point(44, 503)
        lives -= 1
        LabelLives.Text = lives
    End If
    End Sub

我可能做错了什么?

0 个答案:

没有答案
相关问题