Iam new to android touch controlling programs so could anyone let me get the code for it
code i need is like a slider moving up and down like brick breaker
Here’s left and right, it should be pretty easy to do from here. This code is already all over the internet. Not to be rude but you will be able to find the exact code with minimal searching
private void Move()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0); // get first touch since touch count is greater than zero
if (touch.phase == TouchPhase.Stationary || touch.phase == TouchPhase.Moved)
{
// get the touch position from the screen touch to world point
Vector3 touchedPosx = Camera.main.ScreenToWorldPoint(new Vector3(touch.position.x, Screen.height / 16, 10));
// lerp and set the position of the current object to that of the touch, but smoothly over time.
transform.position = Vector3.Lerp(transform.position, touchedPosx, Time.deltaTime * moveSpeed);
}
}
}