Work you way through the Blockly Pond Tutor following the link below.
As with the previous lessons, make sure that you upload your code to the QuizMaster site.Blockly Pond Tutor
The Blockly Pond cannon has two required arguments.
- The direction the canon is to fire in.
- The distance the canon is to fire.
Scan() ===> Return the distance to a duck (if found)
The scan function looks in the direction indicated and if it finds a duck, it returns the distance to the duck. If it doesn’t find a duck it returns infinity(or doesn’t return a value??).
The scan is very useful when used inside a cannon block ( set to the same angle). The scan block feeds the return value out from the inner block to the outer block.
The result? The code scans for an enemy and if it finds one it shoots in exactly the correct direction and distance!
Load your completed challenges on to the Quizmaster site.
Finish off your challenges and make sure you click save and submit on your work