Download

Mouse control in "Top Down" mode

Help me figure it out. I work with the project in the “top down” mode. "I can’t understand how to correctly assign defferent actions to one button (or to be more precise, to the left mouse button: to move, interact with objects and attack enemy mobs). At the moment, I created to move the character around the map and rotate the camera. Please tell me how to solve my problem. I guess that i need to write logic on the objects themselves, so that when you hover over them with the mouse, the action takes place (but after making 2-3 main types of classes for them, and write this logic there, so as not to do it in each object separately), but this is only my guess, I ask for help from more experienced people. Thank you and forgive me for my English

Hi man,
I would suggest you to build the behaviour inside your “playerChar-actor”
when clicking with mouse or touch you can get the actor you are clicking on , and make evaluation on this information.
For example
when you click on something you can ask if the actor clicked has a tag, and switch to different action based on that,
and then you can also read variable of the actor clicked to know more.

take a look at these two old answers, 1is for make a point&click behaviour where the player walk toward the clicked item and then based on the tag, do , or not do an action.
the 2 is just for show the hit-break of the input finger and linetrace, that give you the actor reference.

ConvertMouse And Linetrace.jpg

Est_engine,
Thank you very much for the detailed answer! I will definitely try this method.