WEBVTT

00:00.000 --> 00:21.720
Come to the video 2 of making your sprite move up and down using the arrow keys on your

00:21.720 --> 00:23.720
keyboard.

00:23.720 --> 00:27.520
Now we're going to code our sprite to move up and down.

00:27.520 --> 00:32.680
To do this we need to click and drag go and space key press block from the events category

00:32.680 --> 00:36.120
in the block palette onto the code area.

00:36.120 --> 00:41.720
Click on the drop down menu in the one space key press block and select the up arrow.

00:41.720 --> 00:45.720
This will tell your sprite that when you press the up arrow it will follow the code underneath

00:45.720 --> 00:47.040
it.

00:47.040 --> 00:53.040
Next click and drag a change y by 10 block from the motion category in the block palette.

00:53.040 --> 00:56.360
Attach this block to the one up arrow key press block.

00:56.360 --> 01:01.000
The change y by 10 block tells your sprite to move up the y axis because the number is

01:01.000 --> 01:02.320
getting bigger.

01:02.320 --> 01:07.360
Therefore, when you press the up arrow key your sprite should move 10 places upward on

01:07.360 --> 01:10.840
the y axis to a new y-code.

01:10.840 --> 01:16.000
Next we need to click and drag a second when space key press block from the events category

01:16.000 --> 01:18.160
onto your code area.

01:18.160 --> 01:23.800
Click on the drop down menu in the one space key press block and select down arrow.

01:23.800 --> 01:27.480
This will tell your sprite that when you press the down arrow it will follow the code

01:27.480 --> 01:29.360
underneath it.

01:29.360 --> 01:34.320
Next we want to click and drag a change y by 10 block onto the code area and attach it

01:34.320 --> 01:37.480
to the one down arrow key press block.

01:37.480 --> 01:42.040
Click on the white bubble inside the change y by 10 block that is attached to the one down

01:42.040 --> 01:44.280
arrow key press block.

01:44.280 --> 01:48.520
We're going to change this number to 10 and this will tell your sprite to move down the

01:48.520 --> 01:51.440
y axis because the number is getting smaller.

01:51.760 --> 01:56.600
Therefore, when you press the down arrow key your sprite should move 10 places downward

01:56.600 --> 02:00.120
on the y axis to a new y-code in it.

02:00.120 --> 02:04.080
Test out your code by pressing the green flag button above the stage.

02:04.080 --> 02:09.760
Use your up and down arrow keys to move your sprite up and down on along the y axis.

02:09.760 --> 02:10.640
Thanks for watching.

