Hello
I have a 2d tile puzzle game and want to drag and slide my object with a default speed by touch to empty place like this picture.

please help me with your java script code
it’s for android.
thanks
Hello
I have a 2d tile puzzle game and want to drag and slide my object with a default speed by touch to empty place like this picture.

please help me with your java script code
it’s for android.
thanks
You can use Input.Touches
// JavaScript Code Snippet
function Update () {
// Only if there are touches
if (Input.touches.Length > 0)
{
if (Input.touches[0].phase == TouchPhase.Moved)
{
var x = Input.touches[0].deltaPosition.x * speed * Time.deltaTime;
var y = Input.touches[0].deltaPosition.y * speed * Time.deltaTime;
transform.Translate(new Vector3(x, y, 0));
}
}
}
Çok teşekkürler
– alone1992@ alone1992 how did you create it,can you guide me with the tutorial please..??
– Himani_123nice.. work
– A_never_kill