Private Sub MoveEnemy
Dim v As B2Vec2 = Mouse.Body.Position.CreateCopy
v.SubtractFromThis(Enemy.Body.Position)
If v.Length > 0.7 Then ' <--- check, if they are too close to each other
v.NormalizeThis
' you could multiply that v by a scalar to change the speed like:
' v.MultiplyThis(1.5) ' >1 = faster, <1 = slower
Enemy.Body.LinearVelocity = v
Enemy.Body.SetTransform(Enemy.Body.Position, ATan2(v.Y, v.X) + cPI / 2) ' <--- turning the enemy in player direction
Else
Enemy.Body.LinearVelocity = X2.CreateVec2(0, 0) ' <--- yes, too close, therefore stop enemy
Enemy.Body.AngularVelocity = 0 ' <--- stops the spinning
End If
End Sub