### Bullet goes towards certain actor (Solved)

#### Edge123

• Posts: 31
What is a way to make a bullet go towards a certain actor's position when spawned?

« Last Edit: August 08, 2018, 06:13:08 pm by Edge123 »

#### JeffreyDriver

• Posts: 2010
ACTORS > MOTION > FORCE

There's blocks there to let you send a bullet towards whatever you want.

What you need to do first of all, is figure out how to identify the actor you want to target. If it's the only actor of it's type or group then that's easy to do: SCENES > ACTOR > GET ACTOR

If you want to get the closest actor of a certain type, or pick one at random, it can be done, but it's a little more complex.

What exactly are you trying to do?
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

#### Edge123

• Posts: 31
So this is for a boss fight, and the boss spawns an orb that's suppose to go directly towards the position of the actor you are playing. Its not meant to be like a homing missile, its only supposed to shoot at the position of where the actor you are playing is when the orb spawns.

#### JeffreyDriver

• Posts: 2010
SCENES > ACTOR > GET ACTOR > FOR EACH ACTOR OF TYPE (select your player actor)

I'm assuming that you've only got one of this particular type of actor on screen??

Assign this to a local (blue) actor attribute. You can then refer to this in your code later.

ACTORS > MOTION > SPEED > SET VELOCITY

You then then send the bullet towards the player, though you'll need to calculate the angle. There's an extension called the Easy Math Extension that provides blocks that will calculate that for you.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

#### Edge123

• Posts: 31
Thank you! I also managed to just use the "atan2 y: x:" block to find the actor's position