Junkbots session 3: Move the robot but now there are rocks in the way.
What
is the Junkbots project
The Junkbots
project has been running for a number of years as an initiative to bring
sustainability, computing and engineering together by building bots out of junk;
details of the project can be found at. https://junkbots.blogspot.com/ . Junkbots is an extension of
the Research into the teaching problem-solving going on at the University of
Northampton please feel to visit https://computingnorthampton.blogspot.com/2019/01/problem-solving-research-outputs-and.html for more details.
What
are we going to do?
· Play
with a Scratch robot on the screen!
· Build
on the routines from the previous session.
· Look
at example of what happens when the junkbot and the rock met.
· Adding
key press to control the code to guide the junkbot around.
· Extend
your solution
Activity
1: Reminder of the blocks we used previously?
|
This
means when the green flag is pressed do whatever follows.
|
|
This
means place our robot (go to block) to point on the screen roughly in the
centre of the screen. |
Do you want a challenge: What do think would happen if instead
0 and 0 in the white spaces in the go to block, we put in 50 and 50? Have a
guess.
|
This
means stop the scratch program for 1 second and then carry on. |
|
We
can use this block to move the robot 50 steps on the screen in the direction
it is facing. |
|
We
can use this block to turn the robot to the right 45 degrees. |
We are also going to look at two more ‘things’ today: one
new block and a new type of blocks to make our programming easier – the control
blocks.
|
We
can use this block to change the direction the robot faces. |
|
When
we click on the control button at the side we see several more blocks we can
use.
One
of these we have played with before the wait block.
The
other two we are going to use today in later activities.
When
we want to repeat a combination of blocks so many times, we can use the
middle block and then change the 10 to the number of times we want to repeat.
If we
want it repeat something forever (or until we stop the program with the red
button) we can use the last block. |
|
Sometimes
we want to change what the program does when something happens.
We
will look at three types of instructions -
If this ‘thing’ happens then do this. -
If this ‘thing’ happens then do this else to this other
thing -
When a key is pressed do this. |
|
Activity 2: Have a go at guessing what it
is going to do?
Follow
this link to a new Scratch project https://scratch.mit.edu/projects/405642711
Challenge
1: Press the green flag and see what it does.
THEN press the green flag and see what it does. Tell others what you saw it do?
Challenge
2: Now go in the Scratch code for the rock (it should look like the scratch
program shown next to this). - describe what you think this does? - tell others why do you think the if block is inside a forever block?
|
Activity 3: Modify and Make
·
Staying with the same scratch code you might have
noticed that the junkbot doesn’t always hit the rock. ·
We are going change this so we can guide the junkbot to
hit the rocks. ·
Go to the code for the junkbot/robot/rcx. ·
Challenge 3: Add instructions to move the junkbot by
pressing the arrow keys. In the picture you can see two events blocks one
group of blocks says what happens when the up key is pressed then other when
the right key is pressed. ·
Add blocks to make the down and left keys move the
junkbot down or left.
|
|
Activity 4: Modify and make play
·
Lets get it to add more blocks either using the program
you have developed or https://scratch.mit.edu/projects/405650433 ·
Go to the stage code you will see a block saying create
clone of Rocks every time this block is used a new rock is added to the
screen. ·
Challenge 4: Can you change the code so 20 rocks are put on the screen and
now create a game where you have to hit every rock. ·
Challenge 5 – looking at other scratch examples (for
example https://projects.raspberrypi.org/en/projects/ghostbusters/4) could you add a
scoring system to this game. |
|
No comments:
Post a Comment