Create a 'predict' custom block
To begin the prediction you will press the space bar. We will get the costume names of the 'parent 1' and 'parent 2' sprites (as this will tell us what colour they are) and pass these into function called 'predict'.
First add the following code to the 'child' sprite:
- events when [space] key pressed
- looks set size to 20 %
- motion go to x: 50 y: 0
- pen clear (we will be stamping on the stage area so we need to clear it at the start)
Next we will create our custom block called 'predict' and we will set it up to allow two values to be passed into it; an eye colour for parent 1 and an eye colour for parent 2.
To create a custom block go to the More Blocks palette:
- Click on the 'Make a Block' button
- Type 'predict' into the purple box
- Click on the arrow beside Options
- Click on the 'Add string input' button 2 times (2 number boxes will appear in the block)
- Rename 'string1' and 'string2' so they they're called 'parent1' and 'parent2' respectively.
- Click on the OK button
A large purple block called define predict parent1 parent2 will appear in the code area and a predict block will appear in the toolbox.
To call this function add the following code underneath the clear block:
- moreblocks predict
(replace the first  with sensing [costume name] of [parent 1])
(replace the second  with sensing [costume name] of [parent 2])