I’m trying setup a “simple” script to play an animation when pushing a button. I tried modifying a script that was setup to load a scene by changing the loadscene command to a “animation.Play” command but it doesn’t work… i guess nothing is simple. here’s what i’m using;
var nextButton : GUITexture;
var nextButtonUp : Texture;
var nextButtonDown : Texture;
var prevButton : GUITexture;
var prevButtonUp : Texture;
var prevButtonDown : Texture;
var nextScene : String;
var prevScene : String;
var clickSound : AudioClip;
var mainCamera : Camera;
//I added this section
//var animationTarget : Animation;
//function Start(){
// animationTarget.wrapMode = WrapMode.Loop;
// animationTarget[ "instruct" ].wrapMode = WrapMode.ClampForever;
// animationTarget[ "idle" ].wrapMode = WrapMode.ClampForever;
private var prevPressed : boolean;
function Update() {
var count = iPhoneInput.touchCount;
for (var i : int = 0; i < count; i++) {
var touch : iPhoneTouch = iPhoneInput.GetTouch(i);
if (touch.phase == iPhoneTouchPhase.Began) {
var prevPressed = this.prevButton.HitTest(touch.position, this.mainCamera);
var nextPressed = this.nextButton.HitTest(touch.position, this.mainCamera);
if (prevPressed) {
// show "clicked" texture
// play sound
animation.Play("idle");
}
if (nextPressed) {
animation.Play("instruck");
// play sound
// show "clicked" texture
}
}
}
}
Any ideas what i’m doing wrong? should i go back to selling 44 ounce big gulps and 59 cent hot dogs at the am pm?
thanks