Phaser - Fast Foodie In general

Hi !

I’ve been struggling allot with the last Phaser exercise. I find that the lack in how the tasks are written and the lack of hints and documentation and post makes it very hard just to understand what I am even supposed to do at times.

Right now I’m at task 27 that states " You only want to add to the tray when gameState.currentMeal.children.entries.length is less than 3 and the customer is ready. If conditions are met, create a new sprite in gameState.currentMeal . Make it so the X position can vary based on the number of entries in gameState.currentMeal ."

For me how is not at native english speaker i find these statements very hard to even understand.

Is there anyone who has finished this exercis how is willing to point me in the right direction?

1 Like

Hi, i’m on the same step… same issue, i think the tasks (at least for this last exercise) are not very clear as the previous project, i will give more tries to that. Did you finish it?

So this is what I came up with:


  placeFood(food, fullnessValue) {
        if(gameState.currentMeal.children.entries.length < 3 &&  gameState.customerIsReady === true) {
            let Xposition = gameState.tray.x;
            switch(gameState.currentMeal.children.entries.length) {
                case 1:
                    Xposition += 50;
                    break;
                case 2:
                    Xposition += 100;
                    break;
            }

            gameState.currentMeal.create(Xposition, gameState.tray.y, food);
            gameState.currentMeal.fullnessValue += fullnessValue;
        }

    }

I incremented in 50 and 100 just to test, on step 34 you have to call the placeFood(), I did it but is not displaying nothing yet :confused:

This should be inside the if statement

let Xposition = gameState.tray.x;
switch ( gameState.currentMeal.children.entries.length){
case 0:
Xposition -+ 50;
break;
case 2:
Xposition +=50;
break;

// the “let Xposition = gameState.tray.x;” is the case 1 as it is the center of the tray. hope you understand.

1 Like

Yeah, I solved a while ago, actually for me it worked with -90

case 0:
                    Xposition -= 90;
                    break;
                case 2:
                    Xposition += 100;
                    break;