0
Answered

Attack on click ONLY if cursor over target

ronangalbraithcode 2 weeks ago in Melee updated 2 days ago 5

Any way to have Input (i.e. Down Mouse Left) trigger attack ONLY if the cursor is over an enemy, and otherwise trigger movement to clicked location? 

Unity version:
2018.4
Game Creator version:
1.1.8
Answered

You can have a "On Left Click" Trigger on top of each enemy and use Melee Input action, instead of detecting when the player presses the attack button without checking what's below the cursor.

so how would you suggest closing down the range between player and target? Follow doesnt have a "wait to complete" which we could queue an attack after, and "move to" will give an out of date location as the target will be moving

Are you done with this or should I keep waiting?

Sorry for the late reply, but we have a high number of support questions and we answer them in order, so please, be patient.


You can use the Move Character To and allow a certain threshold; enough so that the weapon reaches the enemy.

Hi again. 


Move to requires a game object as the destination. As I said in my last comment:


                  "move to" will give an out of date location as the target will be moving


If we could set "On Left Click" to begin a follow routine, which would end when within attack range, followed by an attack, that would work. But we can't. (Or can we?) 


I understand your replies will have to be slow. I just want to know if this software is capable of doing this or if our studio should switch to rival (the functionality is pretty core to point-and-click combat).  


Thanks