Sprite Follow not disabling

i am trying to make a game that has bullets firing at enemies but i cant stop them following. how would i just make it fire in the direction of them but not home like missiles? thanks

1 Like

Do a bit of math. Take the initial position of the bullet and the position of the enemy at the time of firing. Compare them for a difference in x and y coordinates(i.e. enemy is down 2 and left 1). If you follow those sequentially, your bullet will travel across the y axis, and then the x. I assume you want to make the bullet travel along the hypotenuse of this triangle, so you simply need to iterate at the ratio of the change in x over the change of y. This means, in my example, I would move 0.2 pixels down and 0.1 pixels left, 10 times, to reach the enemy, which creates a much smoother line of travel. In makecode, we can accomplish this by using the velocity block, simply configure it to your preferred rate of change modifier. Congratulations, you can now trace a direct line between two objects. Here is an example program of the formula: https://arcade.makecode.com/S57011-33220-72723-62555

1 Like

There is a darts extension I think that uses this purpose. Good luck!

1 Like