I was wondering if anybody has any suggestions for a system for combat in which you click then drag the sword in the direction you want it to strike.
I would then add a limb damage system but that is later on.
I was wondering if anybody has any suggestions for a system for combat in which you click then drag the sword in the direction you want it to strike.
I would then add a limb damage system but that is later on.
Hi,
You need to break the feature down first, that will make the implementation much easier.
With the context you gave, here’s what I’m thinking:
1/ Detect mouse click.
2/ Once mouse click is detected, store the position and set some boolean is_dragging to true.
3/ While is_dragging is true, move the sword to the mouse position (probably done in process).
4/ After each movement, check if there’s any object between the previous position and the new position. If any object is detected, then apply the hit.
5/ Detect mouse release to reset is_dragging to false and stop the slashing behaviour.
I’d suggest you give it a try and ask for help with a first implementation done, whether it’s working or not, but hopefully that gives you a place to start.
Hello thanks I will try to implement this