Managing multiple tweens for a simple Whac-a-Mole style game?

Hello! I am completely new to Phaser 3 and I am developing a simple Whac-a-Mole style game where targets will popup on the screen from behind background layers and on mouse-click, will gain points.

I am having trouble figuring out the tween timeline. I am able to load the target images, add a data attribute to them (some targets add points, others subtract points), and set up a pointer click event for each.

I have set up a tween timeline for each of these targets but I don’t know how to make all of them loop in succession. Right now, they are each looping on their own.

Meaning, if I had 4 targets, the sequence should go:

Target 1 shows, then target 2, then 3, then 4, then loops back to 1.

Right now, it is doing something more like:

Target 1 goes, then repeats on its own timing. Target 2 goes based off the delay value I set and loops on its own. Target 3 and 4, the same thing.

I’m not sure how to make all of the targets wait until all of them have gone before restarting the loop…

Other than that, the game is working as expected!

http://phaser.io/examples/v3/view/tweens/timelines/loop-timeline

Thank you for your reply! But this only works if I am trying to move one image. What if I want to move multiple images in succession?

Are you using 4 tweens or 4 timelines?

Follow tweens/timelines/loop-timeline but use one target per tween. It will loop only after all the tweens complete.

If you have all the tween delays worked out already, you’ll probably want to use { offset: 0 } for all the timeline tweens.

Hello! I got this to work by following the example here: http://phaser.io/examples/v3/view/tweens/timelines/simple-timeline-8

Thank you!!