Saltar navegación

Activa JavaScript para disfrutar de los vídeos de la Mediateca.

LIGHT and OPAQUE materials | How to create SHADOWS | - Scratch Educational Project 3.0 Tutorial - Contenido educativo

Ajuste de pantalla

El ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:

Subido el 6 de mayo de 2021 por Diego M.

43 visualizaciones

In this video, we learn how to use the PEN tool to show how light interacts with opaque objects.

Descargar la transcripción

Hi everyone! Today we're going to make a natural science educational project to explain light 00:00:00
and the creation of shadows when light interacts with opaque objects. We're basically going to have 00:00:07
a source of light which will be the sun and an opaque object, for example this apple, 00:00:13
and another sprite which will actually create the light rays and will stop either when touching the 00:00:19
edge or when touching the opaque object. And finally we will code it so that it 00:00:26
runs instantly and we don't have to wait to see the shadow and I will give you 00:00:32
some more ideas to improve your project as I usually do. Alright, so if you are 00:00:37
ready let's get started. 00:00:42
so let's begin adding the sprites first of all the Sun and then an opaque object 00:00:45
I'm gonna take the Apple but you can take any object let me make the Sun a 00:00:58
little bit smaller and this time I'm not gonna get rid of the cat because I'm 00:01:03
gonna use the cat to draw the light rays well in fact you can use any sprite to 00:01:08
draw the light rays. I'm gonna make the cat as small as possible, I'm gonna set 00:01:15
size to one and as you see the minimum size is five and I'm gonna go to 00:01:20
backdrops to convert it to bitmap and with the paint bucket I'm gonna make it 00:01:26
black. So let's go back to the code and basically the program is gonna be this 00:01:34
the cat is going to start from the Sun and it's going to move pen down I will 00:01:42
explain to you what that is later and it's going to trace a yellow line it 00:01:48
will stop when it touches the edge it will go back turn one degree and another 00:01:54
line go back another line go back another line and when it is touching the 00:02:01
apple it will also stop because if it continues we are not creating the shadow 00:02:07
so when touching the apple it will stop we'll go back we'll turn make another 00:02:12
ray stop when touching the Apple go back and so on so first of all I'm gonna go 00:02:17
here and I'm going to add the pen which is what we need what I was saying well 00:02:23
I'm gonna do it with the Apple so that you see it clearly look if pennies up 00:02:31
and I move the Apple it doesn't paint anything but well pen up basically is 00:02:37
when you move the pen up you are not touching the piece of paper so if you 00:02:45
are not touching the piece of paper you cannot paint pen down means that I move 00:02:49
the pen down and I'm touching the piece of paper so if I move the Apple with the 00:02:55
pen down it traces a line alright so I'm gonna erase all I'm gonna take the apple 00:03:00
here and let's begin coding I'm gonna go to scratch and in event well we could do 00:03:07
one green flag clicked or when space key pressed when space key pressed first of 00:03:15
all I'm gonna make sure I move the pen up so that I'm not touching the paper 00:03:22
let's say the cat is over here so pen up so that I'm not touching the paper and 00:03:27
now with the pen up I'm gonna move the cat to the Sun so go to Sun and I press 00:03:33
space so now the cat is here and I can put the pen down I think before that at 00:03:42
the beginning I'm going to do some things which could be this look when 00:03:51
green flag clicked I'm going to set paint color to yellow because I don't 00:03:59
want to have blue light rays set pen size this is how big how not how big how 00:04:06
wide these lines are we can leave this number and later we will change the pen 00:04:15
size and you will see the different results that we can obtain and finally 00:04:21
what is the direction the cat is gonna be pointing in at the beginning let's 00:04:26
say for example 45 which is this and when we're moving the direction of the 00:04:30
cat we will reach okay other numbers so that could be so as we were saying when 00:04:38
space key pressed the cat goes to the sun and moves the pen down. With the pen 00:04:46
down and pointing in this direction now we can move the cat. As we have to move 00:04:52
the cat a lot we're going to repeat this movement. So let's put repeat until. So 00:04:59
cat is moving and when does the cat have to stop okay it has to stop when it is touching the edge 00:05:16
or when touching the apple so the cat is going to repeat this until and i put an or until touching 00:05:23
the edge or touching the apple. After this it's going to turn one degree and 00:05:32
again go to the Sun to repeat the process. So it will turn one degree and 00:05:48
then repeat this process I'm gonna do one thing when space key pressed the 00:05:57
first thing we're going to do is erase all so that I press and it draws it has 00:06:06
stopped so now basically it has to repeat this and this and this many times 00:06:13
I'm gonna put the apple here so that you see what happens as you see when it 00:06:22
touches the apple it stops and now that is not touching the apple anymore it 00:06:29
completes and and paints the rest of the screen logically I don't want to be 00:06:38
clicking here whenever I want to repeat this so I have a loop which is gonna be 00:06:45
repeat 100 times for example place it here and now green flag oh well maybe 00:06:51
this point in direction could be here let's begin as you see it works but it 00:07:03
takes a long time and I don't want you to fall asleep so maybe you are 00:07:17
wondering Diego is there way to do it instantly and the answer is yes of 00:07:21
course look I'm gonna go to my blogs and I'm gonna make a blog called light up 00:07:26
and I'm gonna select this run without screen refresh I'm gonna pass it here 00:07:35
and all this this repetition is what has to be done instantly so I put the block 00:07:44
light up here which is the same as all this which is run instantly and now only 00:07:52
by pressing space this is done I'm gonna move the Apple I press space and as you 00:08:00
this works very well so what you have here is the basic project this is very good but probably you 00:08:10
want to make an excellent project and to make an excellent project i'm going to give you some ideas 00:08:17
to make it better for example probably you know that a complete circumference has 360 degrees 00:08:23
so if I repeat this 360 times as I'm turning one degree every time I'm gonna 00:08:35
complete all this so I can put this anywhere spacebar and look I complete it 00:08:44
other things we were saying if I change this which could be here as well all 00:08:52
this could be here okay and we would get rid of the green flag if i set pen size to three 00:09:00
as you see this is quite different because these lines are three pixels wide and not one 00:09:10
if i set this to 10 i basically complete the whole the whole screen all right more things we can do 00:09:17
probably you're wondering if we can add more objects obviously we can 00:09:26
i'm going to add for example a bat and i'm going to put it here but look when i press spacebar 00:09:31
the light race or the cat the sprite stops when touching the apple but it doesn't stop when 00:09:42
touching the bat why because we haven't coded it yet okay in the cat we said that it has to 00:09:48
move until touching it or apple but not until touching the bat so we need an or all this 00:09:55
is going to be here and in this space we add touching bat now spacebar and that works 00:10:04
another thing we can do here in the edition uh screen obviously we can move the object 00:10:17
but if i am trying my game i can't so to be able to move the object here when i am actually playing 00:10:26
i'm gonna go to uh the sun and i could put when green flag clicked 00:10:35
it's here set drag mode to draggable okay so that you can drag the sun look now i can drag it 00:10:44
but i can't drag these two so i'm gonna pass this to the apple and i'm gonna pass this to the bat 00:10:53
green flag and now these three are draggable and i can drag them all right and with this you have 00:11:02
an excellent project if you want to make it brilliant um you could add some uh variables 00:11:09
for example if i want to control the pen size if i want to control 00:11:17
this from the game i can create a variable called pen size in this variable with right click slider 00:11:26
i make it into slider and with right click change slider range the minimum could be one 00:11:37
and the maximum 10. so i'm going to set pen size to this variable so i put this here 00:11:44
now if i put here an 8 we are setting pen size to 8. so 00:11:56
before you press spacebar make sure you click on the screen and as you see i'm going to move 00:12:05
the objects and I'm gonna set pen size to six okay so that works and another 00:12:13
thing that you could add for example I'm just gonna do it in one of the objects 00:12:30
but you could do it in both of them is that we can control the size of the 00:12:34
Apple from the game or the size of the bat as well it's quite similar I'm gonna 00:12:38
make a variable which is going to be apple size again right click slider 00:12:45
right click change slider range and the size could go from 5 to 300 for example 00:12:52
now in the Apple after this I could put forever set size to what I have here so 00:13:01
variables Apple size so you will see now Apple size is tiny because this is zero 00:13:15
but if I increase it it sets pen size so it says Apple size to this number so now 00:13:24
I can move the Apple I can move the bat you could create another variable for 00:13:35
the bat size and do the same as I've done in the apple and spacebar and I 00:13:39
create the shadow so this is the project guys to study shadows and light and how 00:13:46
light interacts with opaque objects I hope you liked it and please do not 00:13:52
forget to send me a project when you have them done alright see you guys bye 00:13:56
bye 00:14:01
Valoración:
  • 1
  • 2
  • 3
  • 4
  • 5
Eres el primero. Inicia sesión para valorar el vídeo.
Idioma/s:
es
Autor/es:
Diego Maté Potes
Subido por:
Diego M.
Licencia:
Reconocimiento - No comercial - Sin obra derivada
Visualizaciones:
43
Fecha:
6 de mayo de 2021 - 8:10
Visibilidad:
Público
Centro:
CP INF-PRI INFANTA LEONOR
Duración:
14′ 23″
Relación de aspecto:
1.78:1
Resolución:
1920x1080 píxeles
Tamaño:
1.12

Del mismo autor…

Ver más del mismo autor

Comentarios

Para publicar comentarios debes entrar con tu nombre de usuario de EducaMadrid.

Comentarios

Este vídeo todavía no tiene comentarios. Sé el primero en comentar.



EducaMadrid, Plataforma Educativa de la Comunidad de Madrid

Plataforma Educativa EducaMadrid