2D Toolkit Forum
2D Toolkit => Support => Topic started by: tomy45 on June 09, 2014, 12:03:52 pm
-
I will play one clip and then after another tap the second clip. Hope you understand.
Example: First Tap on the Ipad opens a door. The second Tap close it. How can i do this in 2D Toolkit.
Thanks for your help.
Here is the code. It play´s one clip.
using UnityEngine;
using System.Collections;
public class Door : MonoBehaviour {
public tk2dSpriteAnimator DoorClip;
void OnMouseDown() {
DoorClip.Play();
}
}
-
You should maintain state yourself.
bool doorOpen = false;
OnMouseDown -
if (!doorOpen) {
DoorAnimator.Play("DoorOpen");
doorOpen = true;
}
else {
DoorAnimator.Play("DoorClose");
doorOpen = false;
}
-
Works ! Thanks.
But now I have the problem to reverse the animation clip. How can I do this ?
-
You cant, not officially anyway. Simply create a reversed version of the clip, Duplicate, then click reverse in the editor.