From Test-Scratch-Wiki
Esta página contém links a websites ou programas sem relação ao Scratch ou à Wikipédia. Lembre-se de navegar com segurança, já que não podemos garantir que outros sites são seguros. |
Este artigo ou seção documenta a versão atual do Scratch (versão 3.0). Para ver este artigo no Scratch 2.0, ver Blocos (2.0). Para ver este artigo no Scratch 1.4, ver Blocos (1.4).
- Este artigo é sobre os blocos de programação. Para outros usos, ver Blocos (desambiguação).
Blocos são peças estilo quebra-cabeça que são usadas para criar código no Scratch. Os blocos conectam-se uns aos outros verticalmente como LEGO, onde cada tipo de dado (chapéu, pilha, repórter, booleano, ou final) tem sua própria forma e um buraco de formato especial onde ele pode ser encaixado, o que previne erros de sintaxe. Séries de blocos conectados se chamam scripts.
Existem dez categorias de blocos: Movimento, Aparência, Som, Lista, Eventos, Controle, Sensores, Operadores, Variáveis, e Meus Blocos. Apenas nove destes aparecem na paleta de blocos.
No total, tem sete blocos chapéu, cinco blocos C, trinta e um blocos repórter, treze blocos booleano, dois blocos finais e cinquenta e nove blocos de empilhar.
Nota: | Blocos de extensões não foram incluídos na contagem. |
Formatos de Bloco
Existem seis tipos diferentes de formas de bloco: chapéu, pilha, booleano, repórter, C e final.
Blocos Chapéu
- Página principal: por:Bloco Chapéu
Blocos chapéu são os blocos que começam scripts. Eles têm uma parte redonda no topo e um encaixe em baixo — para que você só consiga colocar blocos em baixo deles. Existem 8 blocos chapéu no editor do Scratch, seis na categoria Eventos, um na categoria Controle e um na categoria Meus Blocos (se você tiver criado um bloco customizado).
Blocos de Empilhar
- Página principal: por:Bloco de Empilhar
Blocos de empilhar (ou blocos de pilha) são blocos que comandam ações. Eles têm um buraco no topo e um encaixe em baixo — para que você possa encaixar blocos em cima e em baixo dele. Esistem 77 blocos de pilha — o tipo mais comum de bloco.
Blocos Booleano
- Página principal: por:Bloco Booleano
Blocos booleano são condições — eles podem ter o valor verdadeiro ou falso. Por exemplo, se você perguntar a alguém: "2 + 2 é igual a 4?", ele teria de responder com "sim" ( verdadeiro) ou "não" (falso). Existem 13 destes blocos de formato hexagonal.
Blocos Repórter
- Página principal: por:Bloco Repórter
Blocos repórter carregam valores. Eles podem conter números e strings. É como você perguntar a alguém "Quanto é 2 + 2", e ele responderia "4". Esses valores podem também ser variáveis, como "Qual é a sua idade?", e ele pode responder "15", ou "Qual é o seu nome?", e ele tem milhões de respostas possíveis. Existem 37 destes blocos redondos — sem contar o número teoricamente infinito de repórteres que você pode criar usando variáveis e listas.
Blocos C
- Página principal: por:Bloco C
Blocos C são blocos que têm formato parecido com a letra "C". Estes blocos encapsulam outros blocos e podem repetí-los ou executá-los quando uma condição for cumprida. Existem cinco blocos C, todos na categoria Controle. Blocos C podem ou não ter encaixe.
Blocos Finais
- Página principal: por:Bloco Final
Blocos finais (ou blocos tampa) são blocos que finalizam scripts. Eles têm um buraco no topo mas não têm encaixe na parte de baixo — para que você não possa encaixar blocos em baixo deles. Existem dois blocos finais, ambos na categoria Controle.
Lista de blocos
Existem 119 blocos no Scratch 3.0 (não incluindo extensões):
Blocos de movimento
- Página principal: Por:Blocos de Movimento
Blocos de movimento são os blocos que controlam o movimento de um ator. Existem 17 blocos de movimento no Scratch 3.0.
Scratch 3.0 tem os seguintes 15 blocos de movimento de empilhar:
— Move o ator um certo número de passos na direção a que ele está olhado.
— Gira o ator em sentido horário em um certo ângulo.
— Gira o ator em sentido anti-horário em um certo ângulo.
— Aponta o ator na direção escolhida.
— Aponta o ator na direção do mouse ou de outro ator.
— Transporta o ator para as posições X e Y especificadas.
— Transporta o ator para o mouse, uma posição aleatória, ou até outro ator.
— Faz o ator deslizar até a posição levando a quantidade de tempo especificada para chegar lá.
— Faz o ator deslizar até a posição do mouse, uma posição aleatória, ou outro ator, levando a quantidade de tempo especificada para chegar lá.
— Adiciona o número dado à posição X do ator.
— Transporta o ator à posição X especificada.
— Adiciona o número dado à posição Y do ator.
— Transporta o ator à posição Y especificada.
— Se o ator estiver tocando na borda, sua direção é espelhada.
— Muda o estilo de rotação do ator.
O Scratch 3.0 tem três blocos repórter de Movimento:
— A posição X do ator.
— A posição Y do ator.
— A direção para qual o ator está olhando.
Blocos de aparência
- Página principal: Por:Blocos de Aparência
Blocos de aparência são os blocos que controlam a aparência de um ator. Existem 23 blocos de aparência no Scratch 3.0. Três dos 19 blocos de aparência para atores têm uma duplicata para o palco.
Scratch 3.0 tem os seguintes 18 blocos de aparência de empilhar:
— Um balão de fala aparece em cima do seu ator e desaparece depois de um tempo.
— Um balão de fala aparece em cima do seu ator.
— Um balão de pensamento aparece em cima do seu ator e desaparece depois de um tempo.
— Um balão de pensamento aparece em cima do seu ator.
— Faz o ator aparecer.
— Faz o ator desaparecer.
— Muda a fantasia/cenário do ator/palco para o que foi selecionado.
— Mesma coisa que o bloco "Mude para o Cenário ()", mas ele espera que todos os blocos "Quando o Cenário Mudar para ()" terminem de executar para continuar o script. (Palco apenas)
— Muda a fantasia/cenário do ator/palco para o próximo na lista.
— Adiciona o valor especificado ao efeito selecionado.
— Muda o efeito selecionado para o valor especificado.
— Reseta todos os efeitos do ator.
— Adiciona o valor especificado ao tamanho do ator.
— Muda o tamanho do ator para a porcentagem selecionada.
— Coloca um ator na frente ou atrás de todos os outros.
— Trás o ator para frente ou para trás do número especificado de camadas.
O Scratch 3.0 tem três blocos repórter de Aparência:
— O número ou nome da fantasia/cenário atual do ator/palco na lista.
— O tamanho do ator.
Sound blocks
- Página principal: Sound Blocks
Sound blocks are the blocks that control sound and MIDI functions. There are 16 Sound blocks in Scratch 3.0. The note blocks in 3.0 are considered an add-on, not one of the standard categories.
Scratch 3.0 has the following eight Sound Stack blocks:
— Plays a sound without pausing the script.
— Plays a sound and pauses the script until it finishes.
— Stops all playing sounds.
— Changes the volume by the amount.
— Sets the volume to the amount.
— Change the pan left/right or pitch by the amount.
— Set the pan left/right or pitch to the amount.
— Clears any sound effects currently in place. Scratch 3.0 has the following Sound Reporter block:
— The volume.
Blocos de dados
Blocos de variáveis
- Página principal: Variables Blocks
Variables blocks are the blocks that hold values and strings. There are 5 Variables blocks in Scratch 3.0.
Scratch 3.0 has the following four Variables Stack blocks:
— Sets the specified variable to the amount.
— Changes the specified variable by the amount.
— Shows the variable's Stage Monitor.
— Hides the variable's Stage Monitor.
Scratch 3.0 has the following Variables Reporter block:
— The variable's value.
Blocos de lista
- Página principal: List Blocks
List blocks are the blocks that manage lists. They are stored in the Data category. There are 11 List blocks in Scratch 3.0.
Scratch 3.0 has the following six List Stack blocks:
— Adds an item to the list (the item goes at the bottom of the list of items) with the specified content in it.
— Deletes the item of the list.
— Deletes all items of the list.
— Adds an item to the list (the item goes where you specify in the list of items) with the specified content in it.
— Replaces the item's content with the specified content.
— Shows a list.
— Hides a list.
Scratch 3.0 has the following 4 List Reporter blocks:
— The list's value.
— The item's value.
— How many items there are in the specified list.
— Reports the index in a list where an item first appears. Scratch 3.0 has the following List Boolean block:
— The condition for checking if an item's content is the specified text.
Blocos de eventos
- Página principal: Events Blocks
Event blocks are blocks that control events and the triggering of scripts. There are 8 Event blocks in Scratch 3.0.
Scratch 3.0 has the following six Event Hat Blocks:
— When the flag is clicked, the script activates.
— When the specified key is pressed, the script activates. The event will only be triggered again after the event is released.
— When the sprite is clicked, the script activates.
— When the backdrop switches to the one chosen, the script activates.
— When the first value is greater than the second value, the script activates.
— When the broadcast is received, the script activates.
Scratch 3.0 has the following two Event Stack blocks:
— Sends a broadcast throughout the Scratch program, activating When I Receive () blocks that are set to that broadcast.
— Like the Broadcast () block, but pauses the script until all scripts activated by the broadcast are completed.
Blocos de controle
- Página principal: Control Blocks
Control blocks are the blocks that control scripts. There are 11 Control blocks in Scratch 3.0.
Scratch 3.0 has the following one Control Hat block:
when I start as a clone
(sprites only)
— This hat block is triggered whenever a clone is created, and will only be run by that clone.
Scratch 3.0 has the following three Control Stack blocks:
— Pauses the script for the amount of time.
— Pauses the script until the condition is true.
— Creates the specified clone.
Scratch 3.0 has the following five Control C blocks:
— A loop that repeats the specified amount of times.
— A loop that will never end unless the Stop Sign is pressed.
— Checks the condition so that if the condition is true, the blocks inside it will activate.
— Checks the condition so that if the condition is true, the blocks inside the first C will activate and if the condition is false, the blocks inside the second C will activate.
— A loop that will stop once the condition is true.
Scratch 3.0 has the following two Control Cap blocks:
— Stops the scripts chosen through the drop-down menu. Can also be a stack block when "other scripts in this sprite" is chosen.
delete this clone
(sprites only)
— Deletes a clone.
Blocos sensores
- Página principal: Sensing Blocks
Sensing blocks are the blocks that detect things. There are 21 Sensing blocks in Scratch 3.0.
Scratch 3.0 has the following three Sensing Stack blocks:
— An input box appears
— you type the value in and it stores the value in the (answer)
variable.
— Resets the timer.
— Sets the sprite to draggable or not draggable.
Scratch 2.0 has the following two Sensing Boolean blocks:
— The condition for checking if the specified key is being pressed.
— The condition for checking if the mouse is down.
Scratch 2.0 has the following ten Sensing Reporter blocks:
— The distance from the sprite to the mouse-pointer or another sprite.
— The most recent input with the Ask () And Wait block.
— The mouse-pointer's X position.
— The mouse-pointer's Y position.
— How loud the noise is that the microphone is sensing.
— How much time has passed since the Scratch program was opened or the timer reset.
— The X position, Y position, direction, costume, size or volume of the Stage or a sprite.
— The specified time unit selected.
— The number of days since 2000.
— The username of a user.
Blocos operadores
- Página principal: Operators Blocks
Operators blocks are the blocks that perform math functions and string handling. There are 18 Operators blocks in Scratch 3.0.
Scratch 3.0 has the following seven Operators Boolean blocks:
— The condition for checking if a value is less than the other.
— The condition for checking if two values are equal.
— The condition for checking if a value is greater than the other.
— True if both conditions are true.
— True if either condition is true.
— Makes the condition checked if it is false, not true, or true, not false.
<[] contains []?>
Checks if the first parameter's text contains the second parameter's text
— if it does, the block returns true.
Scratch 3.0 has the following eleven Operators Reporter blocks:
— The value of the addition.
— The value of the subtraction.
— The value of the multiplication.
— The value of the division.
— Picks a random number between the two limits.
— The two values put right next to each other.
— The specified character of the value.
— The length of the value.
— The remainder of the division.
— Rounds the value to the nearest whole number.
— The absolute value (abs), square root (sqrt), sine (sin), cosine (cos), tangent (tan), asine (asin), acosine (acos), atangent (atan), natural logarithm (ln), logarithm (log), exponential function (e^), or base 10 exponential function (10^) of a specified value.
Right-clicking some of the blocks will yield more choices of its type.
Meus blocos
- Página principal: My Blocks
My blocks are user-made custom blocks. There are 2 unique kinds of My blocks in Scratch 3.0.
Scratch 3.0 has the following My Blocks Hat block:
— Defines a custom block.
Scratch 3.0 has the following My Blocks Stack block:
— A custom block.
Plugin ScratchBlocks
- Página principal: Por:Plugin ScratchBlocks
O plugin ScratchBlocks lhe permite escrever blocos e scripts nos fóruns do Scratch e na Wiki do Scratch, além de outros websites que contém o código JavaScript necessário. Foi escrito pelo Scratcher blob8108.
Editando as cores dos blocos
Este artigo ou seção fala sobre algo que não existe na versão mais recente do Scratch (3.0), e é útil apenas como documentação histórica. |
- Página principal: Por:Editar as Cores dos Blocos
No editor online do Scratch 2.0, você podia editar as cores dos blocos clicando no menu Editar com a tecla Shift pressionada. Fazendo isso, um menu aparecia com 3 sliders HSL e ferramentas para modificar as cores de blocos de uma categoria de bloco. Cores personalizadas podiam ser salvas para o seu computador e carregadas.
Em outras linguagens de programação
O Scratch é uma das primeiras linguagens a usar blocos, e inspirou outras a adotar a ideia. Modificações do Scratch contêm muito mais blocos que o Scratch não possui. O MIT, que criou o Scratch, criou também outras linguagens usando blocos, como o MIT App Inventor. Stencyl é uma linguagem profissional que oferece um editor baseado em blocos para a programação de jogos e aplicativos. Scratch Jr também usa blocos que são mais fáceis de crianças mais novas entenderem.