From Test-Scratch-Wiki

(Redirected from Sqi:Blloqe)

Template:Sqi/other version

Template:Sqi/about

Blocks (Kuba) janë pjese-pazëlli formate që përdoren për të koduar në Scratch. Kubat lidhen me njëri-tjetrin si një pazëll, ku çdo kategori e te dhënave (ngjarja, urdhëri, te dhenat e reportuara, te dhenat Vertete/False, ose mbarimi) ka formen e vete te vecante dhe nje vend me forme te vecante ku mund te vendoset — kjo parandalon gabimet gramatikore. Serite e kubave te lidhura quhen scripts.

Ekzistojne 12 kategori te kubave: Levizje, Shikon, Audio, Stilolaps, Ndryshyeshme, List, Ngjarje, Kontroll, Ndjeshmeri, Operatore, PicoBoard, edhe LEGO WeDo (megjithate jane dhe kategori dhe kuba te tjer ne Scratch modifications). Vetëm 10 janë në Block Palette.

Në total, janë 11 kuba kapele, 5 kuba C , 37 kuba reportues, 13 kuba Vertete/False, 2 kuba kapake dhe 77 kuba ndertimi. Sqi/Category:Project Items

Forma Kubesh

Ekzistojne 6 forma te ndryshme te kubavet: Kapele, ndertimi, Vertete/False, Reporter, C and kapake.

Kuba kapele

Forma e kubavet kapele.
Main article: Hat Block

Kuba kapele eshte kubi qe fillon cdo tregim. Ato kane form me nje rreth ne anen e siperme dhe nje nyje ne anen e poshtme — kjo forma eshte qe te vendosesh kuba te tyere vetem nen to. Jane 11 Kuba kapele, 6 nga te cilat jane ne kategorine Ngjarje, 1 ne kategorine Kontrol, dhe 4 me shume kuba kapele. Disa shembuj te kubave kapele jane: when gf clicked, ose when this sprite clicked

Stack blocks

Forma e nje kubi Ndertimi.
Main article: Stack Block

Kubat e ndertimit jane kubat qe zbatojne komandat kryesore. Ato kane forme me nje te prere ne anen e siperme dhe nje nyje ne pjesen e poshtme — keshtu qe mund te vendosesh kuba siper dhe poshte tyre. Ekzistojne 77 kuba ndertimi — forma me e perdorur.

Boolean blocks

Forma e nje kubi Vertete/False
Main article: Boolean Block

Boolean blocks jane kushtezues — ato jane e vertete ose false. Eshte njesoj sikur te pyesesh shokun tend: "Eshte 2 + 2 = 4?", dhe ai do te te thote "YPo" ose "Jo". Me nje forme 6-kendeshi, jane 13 kuba te tille.

Reporter blocks

Forma e nje kubi reporter.
Main article: Reporter Block

Kubat reportere jane vlerat. Kubat reportere mbajne numrat dhe shirit. Eshte njesoj sikur te pyeseh shokun tend, per shembull, "Sa bejne 2 + 2?", dhe ai do te pergjigjet "4". Nuk eshte vetem ekuacion, mund te raportoje te ndryshueshmet, per shembull, "Sa vjec je?". Ai mund te pergjigjet: "15". Me ane te rrumbullakta, ka 37 kuba te tille — pa numeruar sasine teorikisht te pafundshme te kubave reportere qe mund te behen per cdo vlere te ndryshueshme dhe liste. ---(Partially) Translated up to here---

C blocks

The shape of one of the C blocks.
Main article: C Block

C blocks are blocks that take the shape of "C's". Also known as "Wrap blocks", these blocks loop the blocks within the Cs or check if a condition is true. There are five C blocks, and they can be found in the Control category. C blocks can be bumped at the bottom, or capped.

Cap blocks

The shape of a Cap block.
Main article: Cap Block

Cap blocks are the blocks that end scripts. They are shaped with a notch at the top and a flat bottom — this is so you cannot place any blocks below them. There are two Cap blocks which can both be found in the Control category.

List of Blocks

There are 145 blocks in Scratch 2.0.

Motion blocks

Main article: Motion Blocks


Motion blocks are the blocks that control a sprite's movement. There are 17 Motion blocks in Scratch 2.0.

Scratch 2.0 has the following fourteen Motion Stack blocks:

Scratch 2.0 has the following three Motion Reporter blocks:

Looks blocks

Main article: Looks Blocks


Looks blocks are the blocks that control a sprite's look. There are 23 Looks blocks in Scratch 2.0. Three of the 19 sprite Looks blocks have a counterpart for the Stage.

Scratch 2.0 has the following sixteen Looks Stack blocks:

Scratch 2.0 has the following three Looks Reporter blocks:

Sound blocks

Main article: Sound Blocks


Sound blocks are the blocks that control sound and MIDI functions. There are 13 Sound blocks in Scratch 2.0.

Scratch 2.0 has the following eleven Sound Stack blocks:

Scratch 2.0 has the following two Sound Reporter blocks:

Pen blocks

Main article: Pen Blocks


Pen blocks are the blocks that control the pen. There are 11 Pen blocks in Scratch 2.0.

Scratch 2.0 has the following eleven Pen Stack blocks:

The Scratch Day pre-alpha of Scratch 2.0 had the following one new Pen Stack block:

  • Stamp Transparent () — Pens the sprite's image on the screen at the transparency of the amount in the block. Can be removed using clear. This was made obsolete, because now ghost effect is respected when stamping.

Data blocks

Variables blocks

Main article: Variables Blocks


Variables blocks are the blocks that hold values and strings. There are 5 Variables blocks in Scratch 2.0.

Scratch 2.0 has the following four Variables Stack blocks:

Scratch 2.0 has the following Variables Reporter block:

  • () — The variable's value.

List blocks

Main article: List Blocks


List blocks are the blocks that manage lists. They are stored in the Data category. There are 10 List blocks in Scratch 2.0.

Scratch 2.0 has the following six List Stack blocks:

Scratch 2.0 has the following 3 List Reporter blocks:

Scratch 2.0 has the following List Boolean block:

  • () Contains () — The condition for checking if an item's content is the specified text.

Event blocks

Main article: Events Blocks


Event blocks are blocks that control events and the triggering of scripts. There are 8 Event blocks in Scratch 2.0.

Scratch 2.0 has the following six Event Hat Blocks:

Scratch 2.0 has the following two Event Stack blocks:

  • Broadcast () — Sends a broadcast throughout the Scratch program, activating When I Receive () blocks that are set to that broadcast.
  • Broadcast () and Wait — Like the Broadcast () block, but pauses the script until all scripts activated by the broadcast are completed.

Control blocks

Main article: Control Blocks


Control blocks are the blocks that control scripts. There are 11 Control blocks in Scratch 2.0.

Scratch 2.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 2.0 has the following three Control Stack blocks:

Scratch 2.0 has the following five Control C blocks:

  • Repeat () — A loop that repeats the specified amount of times.
  • Forever — A loop that will never end.
  • If () Then — Checks the condition so that if the condition is true, the blocks inside it will activate.
  • If () Then, Else — 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.
  • Repeat Until () — A loop that will stop once the condition is true.

Scratch 2.0 has the following two Control Cap blocks:

  • Stop () — 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.

Sensing blocks

Main article: Sensing Blocks

Sensing blocks are the blocks that detect things. There are 20 Sensing blocks in Scratch 2.0.

Scratch 2.0 has the following four Sensing Stack blocks:

Scratch 2.0 has the following five Sensing Boolean blocks:

  • Touching ()? — The condition for checking if the sprite is touching the mouse-pointer or another sprite.
  • Touching Color ()? — The condition for checking if the sprite is touching a specific color.
  • Color () is Touching ()? — The condition for checking if a color on the sprite is touching a specific color.
  • Key () Pressed? — The condition for checking if the specified key is being pressed.
  • Mouse Down? — The condition for checking if the mouse is down.

Scratch 2.0 has the following eleven Sensing Reporter blocks:

  • Distance to () — The distance from the sprite to the mouse-pointer or another sprite.
  • Answer — The most recent input with the Ask () And Wait block.
  • Mouse X — The mouse-pointer's X position.
  • Mouse Y — The mouse-pointer's Y position.
  • Loudness — How loud the noise is that the microphone is sensing.
  • Timer — How much time has passed since the Scratch program was opened or the timer reset.
  • Video () on () — The video motion or direction of video motion on an object.
  • () of () — The X position, Y position, direction, costume, size or volume of the Stage or a sprite.
  • Current () — The specified time unit selected.
  • Days Since 2000 — The number of days since 2000.
  • Username — The username of a user.

Operators blocks

Main article: Operators Blocks


Operators blocks are the blocks that perform math functions and string handling. There are 17 Operators blocks in Scratch 2.0.

Scratch 2.0 has the following six 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.
  • () and () — Joins two conditions.
  • () or () — Joins two conditions, but they function separately.
  • Not () — Makes the condition checked if it is false, not true.

Scratch 2.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.
  • Pick Random () to () — Picks a random number between the two limits.
  • Join ()() — The two values put right next to each other.
  • Letter () of () — The specified character of the value.
  • Length of () — The length of the value.
  • () Mod () — The remainder of the division.
  • Round () — Rounds the value to the nearest whole number.
  • () of () — 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.

More blocks

Main article: More Blocks

More blocks are user-made custom blocks. There are 2 unique kinds of More blocks in Scratch 2.0.

Scratch 2.0 has the following More Modified Hat block:

Scratch 2.0 has the following More Stack block:

  • () — A custom block.

PicoBoard blocks

Main article: PicoBoard Blocks


PicoBoard blocks are used to control and sense data from the PicoBoard.

Scratch 2.0 has the 2 following PicoBoard Hat blocks:

Scratch 2.0 has the following PicoBoard Boolean block:

Scratch 2.0 has the following PicoBoard Reporter block:

LEGO WeDo blocks

Main article: LEGO WeDo Blocks

LEGO WeDo blocks are used to control the LEGO WeDo. They are accessed via the Add an Extension button.

Scratch 2.0 has the following five LEGO WeDo Stack blocks:

Scratch 2.0 has the following two LEGO WeDo Hat blocks:

Scratch 2.0 has the following two LEGO WeDo Reporter blocks:

Scratch Block Plugin

Main article: Block Plugin


The Scratch Block Plugin allows blocks and scripts to be used in the Scratch Forums and Scratch Wiki, as well as other sites with the included JavaScript. They look like this:

when flag clicked
go to x: (0) y: (0) // center the sprite for the first stamp
stamp
forever
go to x: (pick random (-240) to (240)) y: (0)
stamp
wait (0.2) secs
change [color v] effect by (pick random (5) to (14))

The current version that includes all blocks from Scratch 2.0 was made by blob8108.

Editing the Block Colors

Editing the block colors.
Main article: Edit Block Colors

In the online Scratch 2.0 editor, by shift-clicking the Edit menu an option called "Edit block colors" appears. By selecting this, a menu will appears with a few color sliders and tools for modifying the block colors of a specific block category. Personalized colors can be saved to one's computer, but loading the colors currently does not work properly.

In Other Programming Languages

Scratch is one of the original languages ever to use blocks, inspiring other languages to inherit the idea. Scratch modifications contain many new blocks typically that are not present in Scratch. MIT, at which Scratch is designed, has also created other languages using blocks such as the MIT App Inventor. Stencyl is a highly-professional language that features an entire block interface for programming real-time apps and online games. Scratch Jr also has blocks which are even more friendly for younger children to understand.

See Also