Visual Basic Mob AI漫游?

时间:2014-01-06 21:24:29

标签: vb.net

现在我的暴徒只是随机移动,我需要它以30像素然后转弯的直线行走,但我真的不知道从哪里开始......

    Function mob()
        Application.DoEvents()
        Randomize()
        Dim value As Integer = CInt(Int((4 * Rnd()) + 1))
        If value = 1 Then
        ElseIf value = 2 Then
    If Me.mob2.Location.Y < 549 Then
        Me.mob2.Location = New Point(Me.mob2.Location.X, Me.mob2.Location.Y + 1)
    End If
        ElseIf value = 3 Then
    If Me.mob2.Location.X > 12 Then
        Me.mob2.Location = New Point(Me.mob2.Location.X - 1, Me.mob2.Location.Y)
    End If
        ElseIf value = 4 Then
    If Me.mob2.Location.X < 750 Then
        Me.mob2.Location = New Point(Me.mob2.Location.X + 1, Me.mob2.Location.Y)
    End If
        End If

End Function

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    mob()
End Sub

0 个答案:

没有答案