1
Support / Re: Rotating Sprite on Touch and Drag
« on: June 18, 2014, 12:31:03 pm »
Any thoughts on this ??
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

void Start(){
GameObject.Find ("Btn_Left").GetComponent<tk2dButton> ().ButtonDownEvent += MoveLeft;
GameObject.Find ("Btn_Left").GetComponent<tk2dButton> ().ButtonUpEvent += StopMoving;
GameObject.Find ("Btn_Right").GetComponent<tk2dButton> ().ButtonDownEvent += MoveRight;
GameObject.Find ("Btn_Right").GetComponent<tk2dButton> ().ButtonUpEvent += StopMoving;
}
void Update(){
Sprite.transform.Translate(IPDir *0.1f,0,0);
}
void MoveLeft (tk2dButton source)
{
Debug.Log("Left is Pressed");
IPDir = -1;
}
void MoveRight (tk2dButton source)
{
IPDir = 1;
}
void StopMoving (tk2dButton source)
{
IPDir = 0;
}