Source Code: Follow Mouse Cursor
Explanation
This is an example of an object following the mouse cursor.
Instructions
Place your mouse in the game window and the circle will constantly move towards the mouse cursor.
Source Code
SetFPS 60
x# = GetScreenWidth() / 2
y# = GetScreenHeight() / 2
Do
direction = GetAngle2D(x#,y#,MouseX(),MouseY())
x# = CosNewValue(x#,direction,2)
y# = SinNewValue(y#,direction,2)
Cls 0
CircleC x#, y#, 8, False, $0000FF
Sync
Loop
Related Pages
Source Code
| Categories: A.I. : Mouse : Source Code |