I'm trying to get the delay action in scene2d working correctly. I have multiple image objects which I store in an array and I have managed to get them all displaying, scaling and moving correctly. I can't however seem to get them moving independently using the delay action.
I have tried using the sequence action and that isn’t working either…
I’m trying to create transition effects using little squares that move off the screen.
I have included a sample of the code im using below:
for (i = 0; i < scaleActions.length; i++) {
ScaleByAction scaleAction = new ScaleByAction();
scaleAction.setAmount(-0.1f);
scaleAction.setDuration(0.5f);
scaleActions[i] = scaleAction;
}
float increase = 0;
for (i = 0; i < delayActions.length; i++) {
DelayAction delayAction = new DelayAction();
delayAction.setDuration(0.05f+increase);
increase += 0.1;
delayActions[i] = delayAction;
}
for (i = 0; i < boxArray.length; i++) {
SequenceAction sequence = new SequenceAction(scaleActions[i],moveActions[i],delayActions[i]);
boxArray[i].setOrigin(boxW / 2, boxH / 2);
boxArray[i].addAction(sequence);
//boxArray[i].addAction(sequenceActions[i]);
//boxArray[i].addAction(scaleActions[i]);
//boxArray[i].addAction(moveActions[i]);
//boxArray[i].addAction(delayActions[i]);
}
public void addToStage() {
for (i = 0; i < boxArray.length; i++) {
stage.addActor(boxArray[i]);
}
}
Everything seems to be moving and scaling at the same time, the delay doesn’t look like it is even working.
Hope you guys can help point out what I'm doing wrong.