Sorry but the delayCall which seem to be the most accurate function doesn't work with random
Here is my code :
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
|
<action name="random">
mul(randomvalue, random, 10);
roundval(randomvalue,0);
showlog();
trace('randomvalue=', randomvalue);
delayedcall(randomvalue, action(playS1); );
trace('randomvalue=', randomvalue);
</action>
<action name="playS1">
playsound(s1,sounds/s1.mp3,1);
</action>
|
Whatever the random value is the sound starts immediately.
Whereas this code works
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
|
<action name="random">
mul(randomvalue, random, 10);
roundval(randomvalue,0);
showlog();
trace('randomvalue=', randomvalue);
delayedcall(8, action(playS1); );
</action>
<action name="playS1">
playsound(s1,sounds/s1.mp3,1);
</action>
|
What is going on ?
Thanks