Phaser - Fast Foodie

Hi!

So I’m totally stuck on task 23 on Phaser - Fast Foodie Link

        targets: gameState.currentCustomer,
        x: 500,
        delay: 100,
        angle: 90,
        duration: 1000,
        ease: 'Power2',
        onComplete: function () {
          gameState.customer.meterContainer.visible =  true;    
        },
        
      });

The on complete function only throws errors like : GameScene.js:137 Uncaught TypeError: Cannot read property ‘meterContainer’ of undefined

I don’t understand what I am doing wrong.

1 Like

solved it

 const tweens = this.tweens.add({
        targets: gameState.currentCustomer,
        x: 500,
        delay: 100,
        angle: 90,
        duration: 1000,
        ease: 'Power2',
        onComplete: () => {
          gameState.currentCustomer.meterContainer.visible =  true;    
        },

I changed the function into an arrow function and changed from customer to currentCustomer. I guesse the problem accrued because the Tweens target is currentCustomer and not customer

1 Like

So, throwback question for you about this post from 3 years ago. LOL. I am on Step 13 where you are just starting to create the tween. In the steps it says the “customer should tween horizontally to gameState.player.x”. I see here that you are creating the tween so I used your work for reference. The part I don’t understand is where I add the code to make them face each other. This is what I have so far and it makes the customer turn to face the chef but not move down the line.
const tween = this.tweens.add({ targets: gameState.currentCustomer, duration: 1000, delay: 100, angle: 90, // the part about gameState.player.x ease: 'Power2', });
I don’t see that part in your code. I hope that makes sense. Please reach out if you’re willing to connect.
Thanks.

I got it. It’s the x property. I’m an idiot. Thank you anyway!