%` l icompute...kodu - activity 3 4 let’s make the game fairer by programming kodu to move and...

19
iCompute Code Bꝏk Learn Programming S��l

Upload: others

Post on 31-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • iCompute

    Code Book

    Learn Progra

    mming

    S���l�

  • iCompute

    Code Book

    Learn Progra

    mming

    P���t���B��� �

  • www.icompute-uk.com

    Learning to program is easy with iCompute. This workbook is designed to complement our best

    selling whole-school computing scheme of work - iCompute for Primary Schools. It is matched to our

    Year 3 curriculum but can be used independently and flexibly to suit the needs of your pupils.

    The four workbooks in the series are loosely based on computing progression from Year 3 to Year 6 in

    Primary Key Stage 2.

    Following the creative and fun activities enables children to practice what they have learned, develop

    and consolidate their computational thinking and coding skills.

    Book 1 Code Book

    For Scratch 2.0 visit http://icomp.site/scratch-2

  • Activity 3

    www.icompute-uk.com 6

    Activity 3 Animation

    In this activity you will program a sprite to appear to walk.

    Mapped to iProgram Unit 3.2.3

    Start a new project and delete the cat. Now, we’ll add a backdrop to our project

    by selecting

    Choose a backdrop.

    The backdrop will appear in your stage

    list.

    1

    2

    3

    Next, we’ll add a sprite to the stage that

    we will program to walk.

    Open the sprite library by selectingHover your mouse over a sprite to see its

    animation and choose a walking sprite.

    Drag to position and resize if necessary.

    Click on the Costumes tab to open the costumes pane.

    Notice there is more than one costume for

    your sprite.

    These are the sprites walking poses.

  • Activity 3

    www.icompute-uk.com 7

    4

    Press to execute your code.

    Now add another walking sprite to the

    stage.

    This time we will program it to ‘walk’ using

    arrow keys.

    5

    6

    To make our sprite look like it is walking

    across the stage we need to switch

    between the walking poses.

    Select the code tab, drag out a Greenflag clicked block and attach a repeat block. Change the value to 40.

    We need to swap costume every few

    steps.

    Snap a next costume block from the

    Looks palette inside the repeat block. Add a move _ steps block and a block to

    set your sprite at the start each time.

    Drag a When _ key pressed from the

    events palette. Enter ‘up arrow’

    Snap 2 switch costume to blocks to it

    Make sure each has a different

    costume. What do you see?

    7

  • Activity 3

    www.icompute-uk.com 8

    The sprite is moving too quickly for you to

    see.

    We need to add a wait block to slow things down.

    Snap a wait block between them.

    8

    9 Now lets make the sprite ‘walk’ forever when the key is pressed.

    Snap a forever block around the costume animation.

    Then add a move block.

    ¬ Change the wait time. What happens?

    ¬ Change the move steps. What happens?

    ¬ Stop the sprite walking off the end of the stage.

    ¬ Use Scratch drawing tools to draw your own sprite with at least two walking poses.

    ¬ Change your code so that the user moves one of the sprite using arrow keys.

    Next Steps

  • iCompute

    Code Book

    Learn Progra

    mming

    P���t���B��� �

  • www.icompute-uk.com

    Learning to program is easy with iCompute. This workbook is designed to complement our best

    selling whole-school computing scheme of work - iCompute for Primary Schools. It is matched to our

    Year 4 curriculum but can be used independently and flexibly to suit the needs of your pupils.

    The four workbooks in the series are loosely based on computing progression from Year 3 to Year 6 in

    Primary Key Stage 2.

    Following the creative and fun activities enables children to practice what they have learned, develop

    and consolidate their computational thinking and coding skills.

    Book 2 Code Book

    Download Robomind at:icomp.site/links

    Download iCompute’s Robomind maps at: icomp.site/icomp-robo-maps

  • Activity 5

    www.icompute-uk.com 10

    For this activity you will need iCompute maps Resource4.2.5a; Resource4.2.5b; Resource4.2.5c and Resource4.2.5d

    Activity 5 Decisions Decisions…

    Open Robomind and open the map

    Resource4.2.5a.map

    Select Edit à Insert à Conditions and choose the first ‘if’ statement in the list.

    1

    Now we will add the condition to test

    whether it is true or false.

    Select Insert à See and click frontIsBeacon

    Now put your cursor inside the if

    statement’s curly brackets

    2

    3

    This is inserted in the script area

    if ( ) { }

    Using your mouse, put your keyboard

    cursor inside the if statement’s curved

    brackets if(é)

    In this activity you will program something to happen depending upon whether something is true or false

    Mapped to iProgram Unit 4.2.5

  • Activity 5

    1

    For this activity you will need iCompute maps Resource4.2.5a; Resource4.2.5b; Resource4.2.5c and Resource4.2.5d

    We want to program the robot to pick up

    the beacon if it is in front of it.

    Choose Insert à Grab à pickUp

    Now execute your code by clicking

    4

    We need to program the robot to keep

    turning until the beacon is in front.

    Open the map Resource4.2.5b.map

    Write some code that makes the robot turn

    and pick up the beacon if it is in front.

    Repeat step 5 for Resource4.2.5c.map and

    Resource4.2.5d.map

    Then, using a repeat loop, program the robot to keep turning, picking up the

    beacon if it is in front. Then add a break. This code should work for all the maps!

    5

    6

    You could use a repeatwhile loop and test the frontIsClear condition here.

    ¬ Using squared grid paper, design your own simple map for Robo that involves

    repetition and conditions

    ¬ Design a program using repeats and if statements to make Robo pick up the beacon

    ¬ Now use icomp.site/robo-map to make your map into a map that Robomind can use¬ Download the map to your computer and challenge a friend to open it in Robomind

    and program Robo to pick up the beacon

    Next Steps

  • iCompute

    Code Book

    P���t���B��� �

    Learn Programming

  • www.icompute-uk.com

    Learning to program is easy with iCompute. This workbook is designed to complement our best

    selling whole-school computing scheme of work - iCompute for Primary Schools. It is matched to our

    Year 5 curriculum but can be used independently and flexibly to suit the needs of your pupils.

    The four workbooks in the series are loosely based on computing progression from Year 3 to Year 6 in

    Primary Key Stage 2.

    Following the creative and fun activities enables children to practise what they have learned, develop

    and consolidate their computational thinking and coding skills.

    Book 3 Code Book

    Access Scratch at: icomp.site/scratch-3

    Download Microsoft Kodu at:

    icomp.site/download-kodu

    Download supporting resources at: icomp.site/codebook-3-resources

  • www.icompute-uk.com 14

    Kodu - Activity 3For this activity you need Kodu program file Resource5.3.3a.kodu

    Activity 3 Jumping with keys

    1

    Let’s add some code so that the cycle

    scores a point each time a missile hits

    Kodu.

    Program the cycle with:

    WHEN DO

    2

    3

    In this activity you will program a cycle to respond to user input

    Locate Resource5.3.3a on your network

    and open it with Kodu.

    Press , select the object tool

    then right click the cycle and choose

    ‘program’.

    Now add a new row

    WHEN Next click the DO stack and click actions, more and add a jump tile.

    Execute

    Mapped to iProgram Unit 5.3.3

  • www.icompute-uk.com 15

    Kodu - Activity 3

    4 Let’s make the game fairer by programming Kodu to move and return

    fire.

    Select the object tool and choose

    Kodu, then ‘Program’

    Program Kodu so that WHEN

    DO .

    Then WHEN DO

    5

    ¬ Add some obstacles to the world for the cycle to avoid

    ¬ Program the cycle to be damaged when it bumps an obstacle or is hit by a missile, or

    reduce points scored when hit

    ¬ Add terrain to the world so that the cycle does not have so far to jump over water

    ¬ Add obstacles for the cycle to collect (E.g. apples, hearts or coins) and score points

    when collected

    ¬ Program the game to end when a certain number of points are scored

    Next Steps

  • iCompute

    Code Book

    Learn Progra

    mming

    P���t���B��� �

  • www.icompute-uk.com

    Learning to program is easy with iCompute. This workbook is designed to complement our best

    selling whole-school computing scheme of work - iCompute for Primary Schools. It is matched to our

    Year 5 curriculum but can be used independently and flexibly to suit the needs of your pupils.

    The four workbooks in the series are loosely based on computing progression from Year 3 to Year 6 in

    Primary Key Stage 2.

    Following the creative and fun activities enables children to practise what they have learned, develop

    and consolidate their computational thinking and coding skills.

    Book 4 Code Book

    Access Scratch at: icomp.site/scratch-3

    Access BitsBox at: http://icomp.site/bitsbox-hoc

  • www.icompute-uk.com 12

    Bitsbox - Activity 4

    Activity 4 Jolly Good Coding!

    1

    Next, we will program a function that is

    called when the present is tapped.

    Program the present to disappear, and

    then reappear at a random position.

    Get creative by adding sounds and effects!

    2

    3

    In this activity you create an app to catch falling presents

    Create a new blank Bitsbox app.

    Start by filling the canvas with a Christmas

    themed background.

    Then add a stamp for Santa and a stamp

    for a present. Add a song for extra

    Christmas Spirit!

    We need to make a loop for Santa to fly.

    We also need presents to drop randomly.

    This can go inside our loop too.

    The wrap() function makes the objects scroll (reappear on screen when they hit

    the screen edge)

  • www.icompute-uk.com 13

    Bitsbox - Activity 4

    ¬ You could add another sprite and program it to throw snowballs at Santa’s sleigh

    ¬ Add a message and program it to move on the screen – E.g. Happy Christmas or Ho Ho

    Ho!

    ¬ Can you use basic shapes to draw a snowman?

    You could use circle commands to draw circles of different sizes for the head, body,

    eyes, buttons and lines for nose, mouth and arms. Make it as

    detailed as you can!

    4 Let’s make things more Christmassy by programming snow to fall!

    We need to create a new function for that.

    Remember to call the function from inside

    the main function loop.

    Now we have a working app, explore lots

    of different Bitsbox features like sound,

    songs, fills and stamps.

    Combine them with commands to improve

    your app and get Jolly Good at coding!

    5

    Next Steps

  • A computing scheme of work for teachers of all levels of experience.

    Fully matched to the National Curriculum for Computing.

    Used by thousands of teachers around the world, it contains all the materials

    schools need to teach computing creatively and with confidence.

    INSPIRING THE NEXT GENERATION

    iCompute in the EYFS

    iCompute - Years 1-6

    iCompute for iPad

    iCompute Across the Curriculum

    Computational Thinking Puzzle Workbooks

    step

    step

    by

    Our Products

    iCompute

    www.icompute-uk.com

    in the

    www.icompute-uk.comiCompute

    www.icompute-uk.com

    ®

    A Complete Primary Computing Curriculum

    iCompute

    All the materials schools need to teach computing from EYFS to Year 6

    Fully matched to the National Curriculum for Computing

    Used by thousands of teachers around the world

    Computing

    in the

    E

    arly Years

    iCompute

    EYFS

    Computing

    with

    iPads iComputefor

    iPad

    Cuide

    iCompute

    Curriculum