Blockly Session 3: Bird Game

Summary

This document teaches a Blockly lesson. It explains different coding blocks and describes the principles in terms of real-world situations with birds collecting worms. The lesson is targeted at a primary school level.

Full Transcript

BLOCKLY SESSION 3 Bird game What is heading block? The heading block tells the bird where to fly. Think of it as giving directions like "go north," "turn east," or "fly straight ahead." How It Works The heading is measured in degrees. It follows a circle (360 degrees):...

BLOCKLY SESSION 3 Bird game What is heading block? The heading block tells the bird where to fly. Think of it as giving directions like "go north," "turn east," or "fly straight ahead." How It Works The heading is measured in degrees. It follows a circle (360 degrees): 0°: Fly right. 90°: Fly up. 180°: Fly left. 270°: Fly down. 90 180 0 270 Let's try level 1 The "If-Do-Else Block" checks if something is true. If it is true, the program does one thing. If it is not true, the program does something else. If (Condition): This is the question or test ("Is the bird near a worm?"). Do: The action to take if the condition is true ("Pick up the worm"). Else: The action to take if the condition is false ("Fly forward"). Can you do levels 3 and 4? 'x' is your current horizontal position. Use this block to go in one heading if 'x' is less than a number, or a different heading otherwise. x is a variable that stores a number. The program checks if the number in x is smaller than 50. If it's true, the program does one thing. If it's false, the program can do something else. Example If x = 30: The condition x < 50 is true. If x = 60: The condition x < 50 is false. The "And" block checks two or more conditions. The result is: True: If all conditions are true. False: If even one condition is false. The bird needs to collect worms and reach the target. You can use the "And" block like this: Condition 1: The bird is near a worm. Condition 2: The bird’s heading is correct. Action: Pick up the worm. Can you complete till level 10?

Use Quizgecko on...
Browser
Browser