1

我正在做一些游戏,并且我在碰撞测试中遇到了问题。我要做的是检查坐标是否为空,以便玩家可以移动。这是我到目前为止所拥有的,但它不起作用......

Function ColissionWithPoint(ByVal Lbl1 As Label, ByVal Lbl2 As Label) As Boolean
    Dim pUp As New Point(Lbl1.Location.X - 1)
    Dim pDown As New Point(Lbl1.Location.X + Lbl1.Height + 1)
    Dim pLeft As New Point(Lbl1.Location.Y - 1)
    Dim pRight As New Point(Lbl1.Location.Y + Lbl1.Width + 1)
    If pDown.Equals(Lbl2.Bounds) Or pUp.Equals(Lbl2.Bounds) Or pLeft.Equals(Lbl2.Bounds) Or pRight.Equals(Lbl2.Bounds) Then
        Return True
    Else
        Return False
    End If
End Function
4

0 回答 0