100 likes | 192 Views
Greenfoot B2. Selection IF statements. Today’s Objectives. You will all be able to explain IFs and have added one to your game – level 5. Most of you will add Random Turning behavior – level 6. Some of you will add Random turn amounts in both directions – level 7. Definition.
E N D
Greenfoot B2 Selection IF statements
Today’s Objectives • You will all be able to explain IFs and have added one to your game – level 5. • Most of you will add Random Turning behavior – level 6. • Some of you will add Random turn amounts in both directions – level 7.
Definition • It’s a conditional clause • Also known as an If, Then, Else statement • With a Yes/No or True/False question • If something is true then do option A. • Otherwise take option B if it exists.
Start If you are MALE Sit Down FALSE TRUE Stand Up Stop
Start If your name has less than 7 letters Stand Up FALSE TRUE Sit Down Stop
Start If you are wearing WHITE socks OR a BLACK jumper Stand Up FALSE TRUE Raise Your Left Hand Stop
Start If you have blonde hair AND were born in an Odd month Sit Down FALSE 1 – Jan 2 – Feb 3 – Mar 4 – Apr 5 – May 6 – Jun 7 – Jul 8 – Aug 9 – Sep 10 – Oct 11 – Nov 12 - Dec TRUE Cross your arms Stop
Start If your first name has less than 7 letters If your last name has more than 10 letters FALSE FALSE TRUE TRUE Stand Up Sit Down Levitate Stop
Start If you are NOT at home TRUE Sit Down Stop
Homework • Think about what features a simple platform game needs to be successful? • Compare your ideas to classics like Pacman, Mario and Sonic. • Use http://www.wordle.net to represent your words in an image and upload it to your blog. • Unless your teacher says otherwise – due NEXT LESSON!