You shouldn't use delayedcall for counters, creating animations etc. Even if you can stop specific delayedcall (using name) you almost have no control on these functions - eg. you cannot check if any delayedcall function was "in progress".
Action1 is not a good action - delayedcall functions are not triggered sequentially - in fact you triger 50 delayed calls at the same time, then you want to loop it. It's hard to control it.
Here's the better way:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<action name="frame1">
tween(hotspot[hotspot1].alpha,0,1);
tween(hotspot[hotspot2].alpha,1,1);
delayedcall(nextframe, 1, frame2());
</action>
<action name="frame2">
tween(hotspot[hotspot2].alpha,0,1);
tween(hotspot[hotspot3].alpha,1,1);
delayedcall(nextframe, 1, frame3());
</action>
<action name="frame3">
tween(hotspot[hotspot3].alpha,0,1);
tween(hotspot[hotspot4].alpha,1,1);
delayedcall(nextframe, 1, frame4());
</action>
<action name="frame4">
tween(hotspot[hotspot4].alpha,0,1);
tween(hotspot[hotspot1].alpha,1,1);
delayedcall(nextframe, 1, frame1());
</action>
|
Such created actions give you 2 advantages:
1. you can start hotspot animation with any frame (not the first one)
2. you can stop animation anytime using
|
Source code
|
1
|
stopdelayedcall(nextframe);
|
Of course you can do it even better using self triggered action with counter, but try to do it in the way I wrote above.