Sound and Animation script assistance needed.

Hi there!

Hope all is well... I'm having problems playing sound clips, and also problems with animations.

I have 2 sound clips I want to play, first, "PowerUpStart" when the "Power Up" animation is playing, and then "PowerLoop" sound when the "PowerUpLoop" animation is playing. I tried everything but cannot get it to work, and nothing regarding the sound is in the below script.

Second, when my "PowerUpLoop" animation plays, I dont want the player to be able to move around until the the "Power Up" button is released, any ideas?

var PowerUp : String = "PowerUp"; var PowerUpLoop : String = "PowerUpLoop"; var emit : boolean; var enabled : boolean;

private var inTransition : boolean = false; private var isPowerUpLoop : boolean = false; particleEmitter.emit = false; renderer.enabled = false; light.enabled = false;

function COPowerUp() { inTransition = true; isPowerUpLoop = true; var state : AnimationState = animation[PowerUp]; state.wrapMode = WrapMode.Once; state.speed = 1.0; animation.Play(PowerUp); yield new WaitForSeconds(state.length); (animation.Play(PowerUpLoop)); particleEmitter.emit = true; renderer.enabled = true; yield new WaitForSeconds(.1); light.enabled = true; }

function Update () { var horizontal = Input.GetAxis("Horizontal"); var vertical = Input.GetAxis("Vertical");

if (Input.GetButtonDown("Power Up")) {

if (Input.GetButtonUp("Power Up")){
    particleEmitter.emit = false;
    light.enabled = false;
    inTransition = false;
    isPowerUpLoop = false;



Set up a boolean. Make is so that while you are powering up, a boolean is true and if that boolean is true, the player's horizontal and vertical controls are cut. As for the sound, make a while loop and have the sound play for as long as the condition for the power up is true;