ポイント A をポイント B から遠ざけるために、1 秒あたり 20 回メソッドを呼び出そうとしています。メソッドは次の変数を使用する必要があります。
- ポイント A (X)
- ポイント A (Y)
- ポイント B (X)
- ポイント B (Y)
- 力
点 A と点 B が近づくほど、互いに遠ざかる速度が速くなります。強度変数は、ティックごとの距離と、ポイント A が押されなくなるポイント間の距離を制御します...
基本的に、カーソルを指定されたポイントからゆっくりと押し出そうとしています。
これを実装する方法はありますか?
これは私の試みですが、残念ながら距離が長くなるとカーソルの動きが速くなります...
'PosX and PosY are the percentage of the screen width/height
'Calculate the real position
Dim ScreenPosX As Integer = Screen.PrimaryScreen.WorkingArea.Width * (PosX / 100)
Dim ScreenPosY As Integer = Screen.PrimaryScreen.WorkingArea.Height * (PosY / 100)
Dim PointOffsetX As Integer = Cursor.Position.X - ScreenPosX
Dim PointOffsetY As Integer = Cursor.Position.Y - ScreenPosY
If PointOffsetX > -Strength And PointOffsetX < Strength Then
Dim StrengthFactorX As Integer = Strength - ScreenOffsetX
Dim StrengthFactorY As Integer = Strength - ScreenOffsetY
Cursor.Position = New Point(Cursor.Position.X + StrengthFactorX, Cursor.Position.Y + StrengthFactorY)
'Would be the same for Y. Obviously doesn't work though.
End If