🧠Concept
Pick the right answer.
👀Code Reading
Look at the blocks. Predict what happens.
when flag clicked
forever
if <(distance to [Cat v]) > (150)> then
set [mode v] to [patrol]
else
set [mode v] to [chase]
end
endwhen flag clicked
forever
if <(mode) = [chase]> then
point towards [Cat v]
move (5) steps
if <touching color [#333399] ?> then
set [mode v] to [patrol]
end
end
endwhen flag clicked
forever
if <(mode) = [run away]> then
turn right (pick random (1) to (30)) degrees
move (3) steps
if <not <touching color [#333399] ?>> then
set [mode v] to [patrol]
end
end
end🐛Find the Bug
Something is broken. Pick the fix.
This chase script should move toward the player only when the path is clear, and turn when a wall is in the way. But the enemy walks straight into walls. What is the bug?
when flag clicked
forever
if <(mode) = [chase]> then
point towards [Cat v]
move (3) steps
if <touching color [#333399] ?> then
turn right (15) degrees
end
end
end🛠️Build It
Pick a level. Build it. Check the boxes.
Chase only when the cat is close.
More
Build an enemy with two modes. One sprite (the "Enemy") and one sprite (the "Player"). When distance > 100, the Enemy stays still (patrol mode). When distance is 100 or less, the Enemy points at the Player and moves 3 steps each loop (chase mode). Show the mode in a variable on the screen.
Done when
The near/far switch works. The Enemy uses point towards and move in chase mode. The mode variable is visible and updates as the player moves.
Patrol, chase, and run away (here the stage edge is the wall).
More
Add a third mode to the two-mode enemy. Add a "run away" mode. While chasing, count wall turns with a stuck_count variable; when stuck_count goes over 24, switch to "run away". In run away, pick a random spot and glide there, then go back to patrol.
Done when
All three modes switch correctly. The Enemy goes to "run away" only after stuck_count is over 24. The run-away mode glides to a random spot and then goes back to patrol.
Chase and turn at walls (here the stage edge is the wall).
More
Build a full chase game with a maze. Draw a maze on the backdrop with one solid wall color. The Enemy chases the Player through the maze. Use the wall check from the lesson — wrap the move in if <not <touching color [wall]>> so the Enemy moves only when the path is clear, and turns right 15 degrees in the else part. Show a score for how many loops the chase lasts.
Done when
The wall check stops the Enemy from walking into walls — it moves only when the path is clear and turns otherwise. The Enemy chases the Player around the maze. The score counts up during the chase.
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️⃣Run your enemy near a wall shaped like a U.
- 2️⃣Point to where it gets stuck.
- 3️⃣Say one block you would add to help it escape.
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