Unit 3 Lesson 18 Assessment Teacher View

In the For Teacher Only view of the answer for Lesson 18 Assessment (2022 version Bubble #9) the code does not show the sprite needing interaction from the user to start moving. The fish on the screen moves as soon as the page is refreshed. The instructions are for a RIGHT ARROW to be pressed to start the fish moving. The fish moves to the right until the edge of the canvas and is supposed to turn back to left, continue moving to the left edge, and to be facing the correct direction.

My students are able to have the RIGHT KEY start the movement, but if the user presses the right key again, the fish turns again and heads back in the other direction. Is there a way to prevent the use of the right key later once the fish is already moving? The code in the TEACHER ONLY view does not address the pressing of the arrow key, only the reaching the edges and turning.
Thanks.

@audrey.green,

Nice catch on the answer key not meeting the criteria of the task.

Without sharing the answer here in this forum where some students may be able to find it, I will say that if your conditional for the right arrow has the same two blocks as the answer key shows for the conditional statement when the fish reaches the left edge of the screen and needs to turn right, it should function as intended.

In this case, the right arrow could cause the fish to turn right again (if it was headed left).

If you wanted to prevent that, you could have a double conditional that would cause the fish to move right only if its current velocityX was 0 AND if the right arrow was pressed.

To do that, you could use the operator && or you could use nested conditionals.

Here’s some pseudocode …

IF Right arrow pressed && fish.velocityX is equal to 0… THEN use right facing costume and move right.

Hope this helps!

Mike