|
Java Code - KeyCode
[Back]
Code:
//KeyCode for Arrow Keys
if (Input.GetKey (KeyCode.UpArrow))
{
transform.Translate(Vector3(0,8,0) * Time.deltaTime);
}
if (Input.GetKey (KeyCode.DownArrow))
{
transform.Translate(Vector3(0,-8,0) * Time.deltaTime);
}
if (Input.GetKey (KeyCode.LeftArrow))
{
transform.Translate(Vector3(8,0,0) * Time.deltaTime);
}
if (Input.GetKey (KeyCode.RightArrow))
{
transform.Translate(Vector3(-8,0,0) * Time.deltaTime);
}
//KeyCode for LeftShiftDown and LeftShiftUp
if (Input.GetKeyDown(KeyCode.LeftShift))
{
}
if (Input.GetKeyUp(KeyCode.LeftShift))
{
}
if (Input.GetKey (KeyCode.UpArrow))
{
transform.Translate(Vector3(0,8,0) * Time.deltaTime);
}
if (Input.GetKey (KeyCode.DownArrow))
{
transform.Translate(Vector3(0,-8,0) * Time.deltaTime);
}
if (Input.GetKey (KeyCode.LeftArrow))
{
transform.Translate(Vector3(8,0,0) * Time.deltaTime);
}
if (Input.GetKey (KeyCode.RightArrow))
{
transform.Translate(Vector3(-8,0,0) * Time.deltaTime);
}
//KeyCode for LeftShiftDown and LeftShiftUp
if (Input.GetKeyDown(KeyCode.LeftShift))
{
}
if (Input.GetKeyUp(KeyCode.LeftShift))
{
}