标签(预)与标签碰撞

时间:2013-03-25 03:37:17

标签: vba label collision-detection point

我正在做一些游戏stuf,我对碰撞测试有疑问。 我要做的是检查一个coordenate是否为空,所以玩家可以移动。 这是我到目前为止所做的,但它不起作用......

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

0 个答案:

没有答案