Program Design Process - Emoji game

Can you tell me how to stop the player’s y progress when there is a winner?

Nancy,

Use the if statement in the checkWin function to change what you want about the program. If you want the Y-Player to stop moving, how would you cancel out the things happening in the buttonR and buttonL clicked.

Sorry if I’m being vague, but because this forum is available to students, I don’t want to just give away the answer.

Hope that helps -

Brad

hello, i was wondering if you could send it to me as well, i’m trying to teach my son about coding and was wondering if you could send me the working copy of the emoji race?

Thanks -Dr. Delgado

Could you send it to me also? Thank you.

I’m stumbling too on this Emoji game. With Unit 3 there was teacher answers. Why are there not teacher answers for Unit 6? Is there anyway you can please email me the Emoji code at ewitkowski@randolph.k12.nc.us?

I am also looking for a SIMPLE way to explain the difference between getProperty and setProperty. Thanks

@ewitkowski, I hope I can help you a little with your questions.

I went into the code studio for unit 6, lesson 8 and I was able to find teacher answer keys for several different levels. The final level (13) has an Example Solution when you open the teacher panel (as long as you are signed into a teacher account). (See screenshot below).

As far as the difference between the “getters” and the “setters”, getProperty retrieves a stored value (for use somehow) and setProperty assigns a value to a property to store it for later use.

There is an explanation on W3Schools here. It doesn’t use the exact terminology as appLab, but it does illustrate the difference.

Is that what you are looking for? If not, I know we have some creative teachers in the forum who can explain how they teach this in their classes.

If this doesn’t help or if you still can’t find the answer keys, please respond and we can try again!

thanks,

Mike

1 Like

Hello Mr. Wood,

Thank you for your assistance. This is my first time teaching Unit 6 and when I saw that some levels didn’t have an answer key, I assumed they all did not. I do see the key for the emoji game. Thank you for the link. It helped me understand better. Have a nice day! Elaine

1 Like

I have tried what feels like 10 different solutions to get the emojis to stop moving once a winner is declared, and I can’t figure it out. Would you mind sharing the solution with me so I can share it with my students who are curious? Thank you! My email is david.decker@cherokee.k12.nc.us

Hi @david.decker,

There are many possible solutions to this game and a few avenues for help in finding solutions. First, if you are a verified teacher, the example solution is available to you in the teacher panel. There is a great screenshot above of the teacher panel by @mwood and where you can find the answer. Another option is to post the code you have now and we can take a look and help guide you to a solution. For example, you stated you can’t find a way to stop the emoji’s but the example solution and instructions ask you to change screen when a winner is declared. So, if you share your code we can coach you to find a solution that fits your game.
~Michelle

Thank you for your response. I have the emoji game working as it is shown in the teacher’s solution. I’m referring to the optional “Make it Your Own” challenges on bubble 13, where it says,

  • Use a variable and conditionals to make sure that players can only move their emojis when the “game” screen is showing

So far I have tried many different methods to get this to work. I am a CSD teacher. I’ve been teaching this curriculum since 2018, but this is my first time teaching unit 6.

Oh sorry. I see. Unit 6 is fun but it is challenging! Hope you and the students are having fun with it.

There is no teacher solution to that challenge that I am aware of but I can share how I would solve it. Again, there are probably many methods.

The problem to solve is to stop the buzzing (and stop the emojis triggering the buzzing) once the win screen is visible and do this by using a variable and conditional. So, I created a variable that is only true if the game screen is on. I made this a global variable at the very top of the program. It starts at false (because the first screen is “start”), sets to true when the “game” screen is set, and changes again to false when a player is > 350. I then added a conditional to the counter pattern that moves the player y value that stated to only run the conditional if the gameScreen variable was true ELSE set the y value of the emoji to 349 (or anything less than 350).

That was how I saw it. It does seem to be working for me. Let me know if that helps or if I can clarify further.

~Michelle

Wow! Thank you so much for working it out, and the explanation. It is very much appreciated! My brain is operating on fumes this Friday afternoon. I’m not sure how to structure the global variable you created at the top of your program. Would that look like, var gameScreen = “game” == false; ? If not, how should that be written out? I might just have some sort of mental block for this today.

I did:
var onGameScr = false; //because you are initializing a value

Then in the event that sets the screen to the game screen:
onGameScr = true; //because you are changing a value

Then in the if/conditional , the Boolean expression is:
if (onGameScr == true) //because you are asking question and if it is true the emojis will move but if it is false you will set the emojis to player y to anything less than 350

Finally on when one of the players y exceeds 350
onGameScr = false; //because the screen has been set to the winner screen.

Good luck!
~Michelle

2 Likes

Amazing! Thank you times a million! I was able to get it to work as intended with your help!

2 Likes

I’m trying to get the players to stop as well. Do you have a screen shot of what the code should look like??? I create what I think @melynn described above but it’s not working.

Thanks

my email is jsearcy@centerville.k12.in.us is you need to send a screenshot through email.

@jsearcy,

Thanks for checking in!

Have you looked at the teacher exemplar (assuming you have a teacher account?)

If you can click on the share button on your screen and send us your project, we can take a look at it.

thanks!

Mike

@mwood ,

Yes I have a teacher account the example doesn’t stop the user from moving the object was a winner has been declared. So, technically if the students continue hitting the button then they winner can change on the win screen.

Here’s the example:

1 Like

Yes, that’s right… I notice that earlier in this thread, @bradleywellsashley gave some advice on fixing that.

Use the if statement in the checkWin function to change what you want about the program. If you want the Y-Player to stop moving, how would you cancel out the things happening in the buttonR and buttonL clicked.

As he mentioned, since some students can view the forum, we don’t usually like to post answers to programming questions directly. I might add another possible solution, though. Rather than cancelling out what is happening in the buttonR and ButtonL clicks, could you perhaps reset the y location of the losing player like in the startGame function?

There is always more than one way to approach a problem.

If you try something and it isn’t working, we’re happy to look at it.

Mike

1 Like

I got it to work by send each player to the y position of -500. that works. I’ve been experimenting win the checkWin if statement.
I tried to make the if stop the players. something like
if (player_y > 350) {
player_y = player_y + 0;
}

objects still move

1 Like