'image1 球 'image2 人 if (image1.left+image1.width)>=image2.left and image1.left<=(image2.left+image2.width) and (image1.top+image1.heigth)>=image2.top then
'image1 球 'image2 人 刚才代码有误,height写错了 If (Image1.Left + Image1.Width) >= Image2.Left And Image1.Left <= (Image2.Left + Image2.Width) And (Image1.Top + Image1.Height) >= Image2.Top Then
Private Sub Command1_Click() 'Image2是球,Image1是人 If Image2.Top + Image2.Height > Image1.Top Then If Image2.Left + Image2.Width > Image1.Left And Image2.Left - Image1.Left < Image1.Width Then MsgBox "砸中了" End If End If End Sub
'image2 人
if (image1.left+image1.width)>=image2.left and image1.left<=(image2.left+image2.width) and (image1.top+image1.heigth)>=image2.top then
'image2 人
刚才代码有误,height写错了
If (Image1.Left + Image1.Width) >= Image2.Left And Image1.Left <= (Image2.Left + Image2.Width) And (Image1.Top + Image1.Height) >= Image2.Top Then
'Image2是球,Image1是人
If Image2.Top + Image2.Height > Image1.Top Then
If Image2.Left + Image2.Width > Image1.Left And Image2.Left - Image1.Left < Image1.Width Then
MsgBox "砸中了"
End If
End If
End Sub