Skip to main content
added 90 characters in body
Source Link
Megasa3
  • 167
  • 7

You may not have the player control but you have the coordinates of that player so you just need to makeAs Vector2 is a path between player's coords and your ball coordstype composed by two numbers which are x and make the ball in the player's direction. Of coursey, then you will haveshould be able to update the player coords every second and updateget the ball's direction and final position by asking both numbers:

 Vector2 YourVar; 
 YourVar.x; 
 YourVar.y;

So you should use something like:

 SetPositionToMove(YourVar.x,YourVar.y); //if the functions expect x and y or:
 SetPositionToMove(Point2(YourVar.x,YourVar.y)); //if it expects a Point2 for example 

You may not have the player control but you have the coordinates of that player so you just need to make a path between player's coords and your ball coords and make the ball in the player's direction. Of course, you will have to update the player coords every second and update the ball's direction and final position

As Vector2 is a type composed by two numbers which are x and y, then you should be able to get the position by asking both numbers:

 Vector2 YourVar; 
 YourVar.x; 
 YourVar.y;

So you should use something like:

 SetPositionToMove(YourVar.x,YourVar.y); //if the functions expect x and y or:
 SetPositionToMove(Point2(YourVar.x,YourVar.y)); //if it expects a Point2 for example 
Source Link
Megasa3
  • 167
  • 7

You may not have the player control but you have the coordinates of that player so you just need to make a path between player's coords and your ball coords and make the ball in the player's direction. Of course, you will have to update the player coords every second and update the ball's direction and final position