Activa JavaScript para disfrutar de los vídeos de la Mediateca.
20 blocks 2 - Contenido educativo
Ajuste de pantallaEl ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:
What if we want to perform the same sequence of code, execute the same procedure each time the
00:00:00
custom block is called in the main program, but each time we want to make small changes,
00:00:05
like the text shown, or the coordinate used, or adjust the value in one or more of these blocks?
00:00:10
Let's learn how to create a MyBlock block that can be customized each time it is used.
00:00:17
Let's start by setting up a custom block that has the character speak and say
00:00:22
certain text at the same time you'll see the code stack i want to use here i'll click the mega block
00:00:26
and give it a descriptive name as before like speak and say but since i want to customize the
00:00:32
text my sprite will speak and say each time i'm also going to add an input with an input in place
00:00:38
the custom block will use the parameter the data i provide in the input bubble when i use the block
00:00:44
block. In this case, the input I'm choosing is number or text, and so I remember what
00:00:50
the input is, I also want to give it a descriptive name, like, what to say.
00:00:55
Back in my scripts area, I'll add the desired code sequence under the define block. Then,
00:01:00
in place of static, unchanging text in the speak and say blocks, I want to use the input
00:01:06
I created while creating my block.
00:01:11
To get the input, click on the input label in the define block, and drag it out to place
00:01:13
it in a code block.
00:01:18
In this case, I want to use the same text in both the speak and say blocks, so I'll
00:01:19
do that two times.
00:01:24
Now, when I use this custom block in my main program, you can see the blank input bubble
00:01:25
where I can enter the parameter, in this case my custom text.
00:01:30
Let's run the code to see how it looks.
00:01:34
Hi, I'm a dragon.
00:01:36
I have hot breath.
00:01:38
I'm able to use the same code sequence and customize it over and over without rewriting
00:01:39
this code stack each time.
00:01:44
If I need to make edits to the procedure, I only need to make changes under the Define block to update everywhere the block is used in my main program.
00:01:46
Hi, I'm a dragon. I have hot breath.
00:01:54
Let's see another example where I want to customize the X and Y coordinate every time I run my custom block.
00:01:58
As I create my custom block, I can add labels between inputs to help me remember what is what as I use the block and fill in the parameters.
00:02:03
- Idioma/s:
- Materias:
- Tecnología
- Etiquetas:
- Scratch
- Niveles educativos:
- ▼ Mostrar / ocultar niveles
- Educación Secundaria Obligatoria
- Ordinaria
- Primer Ciclo
- Primer Curso
- Segundo Curso
- Segundo Ciclo
- Tercer Curso
- Cuarto Curso
- Diversificacion Curricular 1
- Diversificacion Curricular 2
- Primer Ciclo
- Compensatoria
- Ordinaria
- Subido por:
- David G.
- Licencia:
- Todos los derechos reservados
- Visualizaciones:
- 10
- Fecha:
- 12 de diciembre de 2024 - 12:47
- Visibilidad:
- Público
- Centro:
- IES MARIE CURIE Loeches
- Duración:
- 02′ 24″
- Relación de aspecto:
- 1.78:1
- Resolución:
- 1920x1080 píxeles
- Tamaño:
- 8.08 MBytes