Simulating a keypress / stick input
by James Ford · in Torque X 2D · 07/17/2007 (10:52 am) · 2 replies
Is there a way to simulate gamepad / keyboard input? I was going to modify a Move object but it is read only.
About the author
http://jamesdev.info
#2
07/17/2007 (12:59 pm)
A better approach might be to split your player input and whatever processing you do into two separate components that communicate via interfaces. Then you can keep the processing component but swap out the input handling component for the AI component, as long as they use the same interfaces.
Associate James Ford
Sickhead Games
The idea is to handle AI player actions the same way I handle human player actions, that is, with the same ControllerComponent. So in my controllercomponent::updateticks if the move == null because it is not a player then it will grab the Move object from the AIBrainComponent (where it is generated). Does this seem like a good idea or does someone else have a better one '-)