x


How can I add sound to this moving platform script?

var horizontalSpeedToEnableEmitters = 1.0;

private var areEmittersOn : boolean;

private var oldPosition : Vector3; private var currentVelocity : Vector3;

function Start() {

oldPosition = transform.position;

}

function Update() {

wereEmittersOn = areEmittersOn;


areEmittersOn = (currentVelocity.y > 0) || (Mathf.Abs(currentVelocity.x) > horizontalSpeedToEnableEmitters);


if (wereEmittersOn != areEmittersOn) {

    for (var emitter in GetComponentsInChildren(ParticleEmitter)) {

       emitter.emit = areEmittersOn;
    }
}
more ▼

asked Feb 18 '12 at 07:24 PM

gamemaker2012 gravatar image

gamemaker2012
1 3 4

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3331
x1029
x534

asked: Feb 18 '12 at 07:24 PM

Seen: 349 times

Last Updated: Feb 18 '12 at 07:24 PM