Hi all,
I was wondering if anyone can help.
I am trying to move two paddles for a pong style game on ios with the code below attached to each paddle with half the touch screen moving each paddle.
I cant seem to be able to move both paddles at the same time ,I think it the multi touch input being entered wrong . HELP!
-----------------------------------------------------------
function Update () {
if(Input.touchCount > 0 )
{
var touch = Input.touches[1];
if (touch.position.y > Screen.height/2) ////// (Each Paddle has a side of the screen)
{
if (Input.touches[0].phase == TouchPhase.Moved)
{
var x = Input.touches[1].deltaPosition.x *speed* Time.deltaTime;
var y = Input.touches[1].deltaPosition.y *speed* Time.deltaTime;
transform.Translate( new Vector3(x, 0 ) );
---------------------------------------------------
Many thanks in advance!
↧