General Discussion for Lesson 3.12


#1

Use this thread to discuss your questions and comments about how to run the lesson.


#2

HELP! I’m having trouble figuring out how to trigger the image being clicked without the background also being clicked, and jumping to the GAME OVER screen. What am I missing?


#3

Hi Michael

Would you be willing to share your code? It might be helpful if you shared your code so that other teachers could take a look and hopefully give you feedback about what is going on.

-Dani


#4

Absolutely! Link: https://studio.code.org/projects/applab/XK4UscDH4eUVTGroAWKJqA

Code:

onEvent(“startButton”, “click”, function(event) {
console.log(“startButton clicked!”);
setScreen(“gameScreen”);
});
onEvent(“doughtnut”, “click”, function(event) {
console.log(“doughtnut clicked!”);
playSound(“NomNomNom.mp3”);
setPosition(“doughtnut”, randomNumber(-100, 270), randomNumber(-150, 400));
});
onEvent(“gameScreen”, “click”, function(event) {
console.log(“gameScreen clicked!”);
setScreen(“gameOverScreen”);
playSound(“Sad_Trombone-Joe_Lamb-665429450.mp3”);
});
onEvent(“startOverButton”, “click”, function(event) {
console.log(“startOverButton clicked!”);
setScreen(“welcomeScreen”);
});


#5

Hi Michael,

Thanks for sharing your code. This is a known issue in App Lab. When you add a click handler to the screen it will always fire. Our recommendation to students in the lesson is that they add an image element that fills up the whole screen as a background and attach the click handler to that instead.

Hope that helps!

Dani


#6

Thanks, Dani – That was one of the ideas they brainstormed. Good to know that that was a “workaround” and not an issue with our code itself, which was our major concern.

Thanks again!


#7

Dani,

I tried to upload a jpeg to the App Lab to take up my entire background, but the image did not upload. When you have the chance could you please take a look at my code?

Thanks,

Dillon


#8

Dani,
Disregard previous post I was able to troubleshoot.

Dillon


#9

When I look at student code in code studio I can only see the code and not the design view. Is there a way to see what the students have done in the design view?