How pass parameters to counter and do not lose it when it changed outside tweens ?
I tried to set " onStartScope: this," and some other ways, but it hasn’t helped.
var obj_enemy, aa;
for ( aa = 0; aa < 5; aa++ )
{
obj_enemy = group_vragi.create(x, y, "enemy")
this.tweens.addCounter({
from: 0,
to: 100,
repeat: 10,
duration: 50,
onStart: function ()
{
window.console.info("aa =", aa);
obj_enemy.x = 30;
obj_enemy.y = 30;
}
})
}
Result of this code is :
aa = 5
aa = 5
aa = 5
aa = 5
aa = 5
Even “onStart” it gets aa = 5 , but i need 5 different “aa” : aa = 0, aa = 1, aa = 2, aa = 3, aa = 4, and 5
different sprites . Now each tween counter works with last created sprite.
Same problem is with " this.time.addEvent " .