Return projectile

I want to throw a projectile and have it return to the player once it hits an enemy but I'm not sure how to go about it?
 
Hmm... the case is pretty unlinear IMO so let's confirm the steps one by one:

1. Cap throw his shield. To which direction will the shield be thrown? is it straight forward (i.e left/right) or toward nearest enemy?
2. After the shield is thrown and if for some reason it doesn't hit anything, how long it will fly before returning?
3. If shield hits obstacle, will it fly back to Cap?

I need these questions answered so I can imagine how the shield would work :)
 
thanks for the reply, ok here we go

1- the shield flies straight forward attacking the nearest enemy

2 - 300 - 400 pixels should be a ok distance I believe if it doesn't make contact with any entities

3 - the shield will fly back to cap after hitting obstacles

I really just need the attack to target the nearest enemy and fly back to cap after making contact or after reaching its defined distance. I thought of trying to trigger a follow anim somehow perhaps by checking if the projectile makes contact or not and if so kill the projectile after it hits an enemy or reaches its maximum distance and immediately triggering the follow animation of the shield coming back to cap. Hope this helps and thanks again for the help
 
Back
Top Bottom