Conditional Birds


Collapse Content

Get some more practice with conditional by helping the early bird catch the worm and return to nest!

Level Guidelines

  1. Heading sets the angle of direction to travel in (relative to the grid)
  2. Use a condition to change the heading at the right moment.
  3. Set your angle on target!

  4. x returns your current x position on the grid. You can add a condition that checks where x is.

  5. You can also examine y. An if-block can be changed to an if-else block to do something different when the condition isn't true.

  6. An if block can have multiple conditions in it known as else if. else if checks another condition if the first condition wasn't true. For example, let's say you encounter a dangerous dragon:

"If" you have a Bazooka, you should shoot the dragon.
"Else if" you have a sword, you should fight the dragon.
"Else", you should run for your life.

If the first condition is true, you won't even check the other conditions. This means you have to set up the order of your If, else if, else statements carefully.

If Else If Else Block

  1. Setup your conditions carefully to solve this.
  2. This problem can be solved in a few ways. One way is to use the And condition. An "And" condition is true only if both conditions in it are true. For example:

    "If" you have a Bazooka "And" you have ammunition, you should shoot the dragon.

    If either condition is false, the overall condition is false, so the code inside the if statement will be skipped.

  3. Use an And condition and multiple "Else If" statements to solve this problem.
  4. Get the worm and return to your nest!
  5. Blockly Bird Game

Contact Us