- Home /
PC Input to Android
Hi! I made a Pong game, and right now its for PC/MAC/LINUX standalone. I would like to convert the controls to android/touch, but don't know how.. I am not that good with coding, and I also have a Main Menu that when you click on the 3d text, it will load a level. It is made with the new unity 2D Tools. Thanks!!
Scripts:
//MENU BUTONS SCRIPT
var levelToLoad : String;
var soundhover : AudioClip;
var beep : AudioClip;
var QuitButton : boolean = false;
function OnMouseEnter(){
audio.PlayOneShot(soundhover);
}
function OnMouseUp(){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
if(QuitButton){
Application.Quit();
}
else{
Application.LoadLevel("pong");
}
}
@script RequireComponent(AudioSource)
//PLAYER CONTROLS
#pragma strict
var moveUp : KeyCode;
var moveDown : KeyCode;
var speed : float = 10;
function Update ()
{
if(Input.GetKey(moveUp))
{
rigidbody2D.velocity.y = speed;
}
else if (Input.GetKey(moveDown))
{
rigidbody2D.velocity.y = speed *-1;
}
else
{
rigidbody2D.velocity.y = 0;
}
rigidbody2D.velocity.x = 0;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613153256im_/https://answers.unity.com/themes/thub/images/avi.jpg)