[Solved] How to make AI move when a sprite is coming it's way?

So I have a fairly simple game in which an enemy shall move whenever a sprite is coming toward itself (e.g. dodge a bullet)

To decide if something is coming it’s way I tried to use the sprite’s Angle of movement although that seems not reliable. How to use that function correctly?

Something else I tried was to figure out the X speed (after all the bullets can only come from left or right), but the speed in X direction seems hard to be added as condition?

1 Like

Try using the distance between two objects condition. And set a distance between player and enemy. This would help you know if a player is coming towards an enemy in all directions.

1 Like

Thank you for that hint. This approach works much better for me.

Although the “Distance between objects” is confusing when you read the description. It says

Compare the distance between two objects. If condition is inverted, onlz objects that have a distance greater than specified to anz other object will be picket.

So everybody has to guess the condition is true if the distance is the given value or less if not inverted.

2 Likes

By default its set to less than so once the distance is less than you can perform an action once you invert it it simply gives the opposite which could be translated to distance is greater than

1 Like

After thinking twice I understood that much, thank you. Just look at the text with novel eyes and you might see room for improvement. :slight_smile:

BTW: I like your youtube tutorials…

1 Like

…Thanks

1 Like