I have two scripts for a gameobject: PlayerControl and Entity.
I’d like PlayerControl to handle the input (for now it’s just using the mouse to determine a target tile), and Entity to handle all movement.
Once I determine the tile that has been clicked, how can I transfer that information to Entity? I have two variables in Entity named “tx” and “ty”, and if I can just get that info from PlayerControl, I can make the character move to that tile.
The reason I have them separated is because I’d like to use Entity for both the protagonist and the NPCs. It’s going to handle basic, low-level actions such as movement and attacks. All input and AI will be handled by separate scripts.
Thanks so much!