Would this be the way to script my controls?

Ok, right now I have a button that returns true or false if being pushed. My character script checks if the button is true, then it plays two animations. When released, it should rewind them and stop them. Both animations use ClampForever. Now my question is, am I doing this correctly? Because right now, it doesn’t rewind the animations fully, only to about a frame after the start. I’ve tried to figure out a better way, but can’t. Anyone that can help? I’ll give you the code I have written…

//this is the character checking if the button was pressed or not
	if( shootTouchPad.bPressed ) {
	 GunPlay();
     isShootAnim = true;
     Fire();
}

if( !shootTouchPad.bPressed ) {
	GunStop();
	isShootAnim = false;
}

//In Update(), I also have this running to sync the two animations
gunMain.animation["WingPoint 1"].normalizedSpeed = wingMain.animation["WingPoint 1"].normalizedSpeed;

//Here is the code in my GunStop function
function GunStop() {
	wingMain.animation.Rewind();
	gunMain.animation.Rewind();
	yield;
	yield;
	yield;
	wingMain.animation.Stop("WingPoint 1");
	gunMain.animation.Stop("WingPoint 1");
}

If you need any more info, just ask :slight_smile: Thanks if you can help!

-Blayke :slight_smile:

Calling Stop on an animation is supposed to rewind it automatically. It might be worth trying the code without the Rewind calls or with them after the Stop calls.

Nope :confused: Now the animations just stop on the last frame and won’t rewind unless I push the button, then it just plays over again. But it stays on the last frame…

Here’s the code I use to play animations…

function GunPlay() {
	if (isShootAnim == true) {
	 wingMain.animation.Play("WingPoint 1");
	 gunMain.animation.Play("WingPoint 1");
	}

Thanks for trying to help though :slight_smile: I’ll keep on playing around with it… but it seems like that isn’t the solution. Thanks!

-Blayke :slight_smile: