how to build a brick wall using snap! (build your …...if/else logic statement “if” •the...
TRANSCRIPT
Use NCSU SNAP! program
1. Make all of your variables
2. Make all of the lower-level blocks
3. Build 2nd level blocks
4. Build main block and implement script variables
• Try to keep individual blocks as simple as possible
• Initialize pen and initialize position will be in the main script block, but transitions can also be done with a modified “initialize position” block
Use variables in blocks
Initialize position “Y start” variable will be dynamic
(will change as program runs)
If/else logic statement
“If”
• The ‘if’ statement uses a nested operator • Click ‘help’ over the “mod”
operator to see what it does
• This operation tells whether to build an odd or even number of rows
• Top half of ‘if’ statement builds walls with an even number of rows
If/else logic statement
“Else”
• Conversely, the ‘else’ half of the control block builds walls with an odd number of rows
Links
• Josh's XML code for "brick wall"
• Back to Josh's Homepage