I have a “high flying” student who is working on their Lesson 27 Game for our Unit 3 work. They want to have a “screen” with directions and a play button appear at first and then when the play button is clicked, the appearance shifts to the playing environment.
A copy of the code they have set up so far can be found here: Code.org - Game Lab
It currently works to display the directions, but using similar code to the game with the ducks doesn’t seem to have the same effect on the sprite-based background in this game.
Thanks for any guidance or suggestion. They’ll be working on these Monday and Tuesday of next week as well.
What a great use of functions! I saw two things that would help her button work. First, I always follow the rule that text should be after the drawSprites. So, in your main draw loop, the drawSprites is after all the function calls that write text to the screen. Try moving it to the top. Also, although there is an if statement to only run the “directions” function if the condition is true, there is still another “directions” function in the draw loop so it is always running. Try removing that.
I figured out a way to do what I think the student wants.
Here’s my run at it involving what seems to be the default state of an IF statement run on a variable (if the variable is true then the IF statement runs, if the variable is false, then it doesn’t):