Question by
mrmlivegamers · Apr 11, 2020 at 12:22 PM ·
androidmovementmovement scriptwindows
pc movement to android,help with a pc movment to work on android
hello, I am trying to make this game I made on pc work on android I got everything working but the movement of my player I've looked everywhere online to see if there is anyone who has code to make an Input.Get to work on android or something which works the same so if I touch the screen it acts like i am pressing down the d key for instance
void FixedUpdate()
{ rb.AddForce(0, 0, forwardForce * Time.deltaTime);
if ( Input.GetKey("d") )
{
rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
if (Input.GetKey("a") )
{
rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
if (rb.position.y < -1f)
{
FindObjectOfType<GM>().EndGame();
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Movement acceleration 1 Answer
achieveing half-life like surfing 0 Answers
The referenced script on this Behaviour is missing! | Help Fast :/ 1 Answer
My controls are wierd 0 Answers
How to connect Windows and Android applications with bluetooth. 2 Answers