FastFoodie - Phaser JS Final Project

Hi, I’m doing the last project of the skill path Phaser JS, since step 27 I had some issues understanding the task, but after a couple of hours I could figure it out and now I’m stuck again :sweat_smile: on step 37 and 38, I’m not sure if the refer to the same thing, because they have the same values:

  1. Inside the check for previous customers, add a loop to create a tween for each previous customer to have:
  • Over a duration of 750 ms,
  • their x coordinate shift to the left 300 px,
  • their angle set to 0 .
  1. Use a tween to move customers down the line after they are fed. Therefore, if you’ve served at least one customer, create a tween for each previous customer to have:
  • Over a duration of 750 ms,
  • their x coordinate shift to the left 300 px,
  • their angle set to 0 .

These tweens should be added in the conditional that you added your previous tween.

Also… This is how I’m solving it, the previous customer moves -300 but I still see him for a while, it never dissapears T_T and in the demo game, it does.

            if(gameState.currentCustomer){
               for(let i = 0; i < gameState.customersServedCount; i++){
                    this.tweens.add({
                        targets: gameState.currentCustomer,
                        duration: 750,
                        x: '-=300',
                        angle: 0,
                        //onComplete: () => {gameState.currentCustomer.meterContainer.visible = false;}
                    });
                }
            };

Thanks in advance :slight_smile:

You can check the project and the tasks in here:FastFoodie

This is my solution so far --> FastFoodie-Github(piratelicorne)

I just understand it :sweat_smile: :sweat_smile: :sweat_smile:

            if(gameState.currentCustomer){
               for(let i = 0; i < gameState.customersServedCount; i++){
                    this.tweens.add({
                        targets: gameState.currentCustomer,
                        duration: 750,
                        x: '-=300',
                        angle: 0,
                        onStart: () => {
                            gameState.customers.children.entries[i].meterContainer.visible = false;
                        }
                    });
                    this.tweens.add({
                        targets: gameState.customers.children.entries[i],
                        duration: 750,
                        x: '-=300',
                        angle: 0
                    });
                }

            };