🧠Concept

Pick the right answer.

Concept · Q1
A game uses a game_state variable. What does this variable hold?
Concept · Q2
The game_state variable holds "play", so only the play code runs this frame. Next frame the player loses, so game_state changes to "game over". What does this design guarantee?
Concept · Q3
A game uses a game_state variable. What is the most common bug after the first run?
Concept · Q4
Both if blocks below run in the same frame: the player presses space while past x = 200, so both checks are true. What happens to game_state?
if <key (space v) pressed?> then
  set [game_state v] to [play]
end
if <(x position) > (200)> then
  set [game_state v] to [game over]
end

👀Code Reading

Look at the blocks. Predict what happens.

Code Reading · CR1
What word does game_state hold after this setup script runs?
when flag clicked
set [game_state v] to [start]
set x to (-100)
Code Reading · CR2
Trace this loop for one frame when game_state is "play" and the left arrow is NOT pressed. What happens?
forever
  if <(game_state) = [play]> then
    if <key [left arrow v] pressed?> then
      change x by (-3)
    end
  end
  if <<(game_state) = [play]> and <not <key [left arrow v] pressed?>>> then
    set [game_state v] to [start]
  end
  if <(game_state) = [game over]> then
    stop [this script v]
  end
end
Code Reading · CR3
What is wrong with this screen change?
when flag clicked
set [game_state v] to [start]
forever
  if <key [space v] pressed?> then
    set [game_state v] to [play]
  end
  if <(game_state) = [play]> then
    change y by (5)
  end
  if <(game_state) = [start]> then
    set x to (-100)
  end
end

🐛Find the Bug

Something is broken. Pick the fix.

This game should reset to the start screen when the flag is clicked. But after a game over and a restart, the sprite runs the game over code at once. What is the fix?

when flag clicked
forever
  if <(game_state) = [start]> then
    set x to (-100)
  end
  if <(game_state) = [play]> then
    change x by (3)
  end
  if <(game_state) = [game over]> then
    say [Game Over] for (2) secs
    stop [all v]
  end
end

🛠️Build It

Pick a level. Build it. Check the boxes.

🧑‍🏫
For the teacher

Review the student's project, then check each thing they did.

Project Evaluation

0 of 4 ticked

💬Talk About It

Present your project to your teacher or a classmate.

  1. 1️⃣Show your project.
  2. 2️⃣Point to the game_state variable.
  3. 3️⃣Make one screen change and say the new screen out loud.
🧑‍🏫
For the teacher

Watch the student present, then check each thing they did.

Presentation Checklist

0 of 4 ticked

📤Submit

Send your results to your teacher and parent.

0 of 0 answered