Game Development Community

Tutorial wanted: Emulate controls while programming on PC

by Andy Hawkins · in iTorque 2D · 05/12/2012 (8:44 am) · 2 replies

Is there a technique to emulate controls of the acelerometer via cursor keys and touch by mouse click? This would be extremely handy as I mainly develop on the PC and trialing the controls in the this manner would speed up production, meaning I wouldn't have to connect to a device all the time.

#1
05/12/2012 (12:00 pm)
What I do is run this on the game start code:
moveMap.bindCmd(keyboard, "left", "gravityXFunction(-1);", " gravityXFunction(0);");
moveMap.bindCmd(keyboard, "right", "gravityXFunction(1);", " gravityXFunction(0);");

You could either run the input in gravityXFunction as "set the linear velocity to %input * %modifier", or "increase the linear velocity by %input every time the key is tapped".
#2
05/12/2012 (5:54 pm)
And is gravityXFunction built in? Or do I need to write that?

EDIT: Don't worry found it. But it just reports the values. Hmmm I guess I could control the player from that function... let's see...