Skip to content

Commit 5c8712d

Browse files
committed
Small updates and tweaks
1 parent b958722 commit 5c8712d

File tree

9 files changed

+105
-83
lines changed

9 files changed

+105
-83
lines changed
-937 Bytes
Loading

01-blocks-scripts-and-sprites/index.md

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ A [Snap]{.snap} program\index{"Snap! program"} consists of one or more
2424
*scripts,* each of which is made of *blocks.* Here’s a typical script
2525
\index{script} :
2626

27-
![image6.png](assets/image6.png){#fig-draw-square} <!-- {width=1.47917in height=1.35417in} -->
27+
![image6.png](assets/image6.png){#fig-draw-square}
2828

2929
The five blocks\index{block} that make up this script have three different
3030
colors, corresponding to three of the eight *palettes* in which blocks
@@ -402,7 +402,7 @@ wouldn’t say ![image84.png](assets/image84.png), although (as you can see from
402402
you do it if you really want. Instead, you normally use predicates in
403403
special hexagonal input slots like this one:
404404

405-
![image86.png](../blocks/images/block_doIf.png){.image-2x}
405+
![image86.png](../blocks/images/block_doIf.png){.image-4x}
406406

407407
The C-shaped if block\index{if block} runs its input script if (and only
408408
if) the expression in its hexagonal input reports true.
@@ -798,7 +798,7 @@ Create a primitive using JavaScript\index{JavaScript}. (This block is
798798
disabled by default; the user must check “Javascript extensions” in the
799799
setting menu *each time* a project is loaded.)\index{pen down? block}
800800

801-
<!-- This needs 2 columns -->
801+
::: {.evenly-spaced-images layout-ncol=2}
802802
![image150.png](assets/image150.png){.image-inline}
803803

804804
The `at` block\index{at block} lets you examine the screen pixel
@@ -810,18 +810,19 @@ reports a list.) The “sprites” option reports a list of all sprites,
810810
including this one, any point of which overlaps this sprite’s rotation
811811
center (behind or in front). This is a hyperblock with respect to its
812812
second input.
813+
:::
813814

814815
<!-- This needs 2 columns ??? -->
815-
![image154.png](assets/image154.png){.image-2x} Checks the\index{is
816-
\_ a \_ ? block} data\index{stage blocks} type\index{type} of a value.
816+
![image154.png](assets/image154.png){.image-4x}
817+
818+
Checks the\index{is-a-block@`is \_ a \_ ?` block} data\index{stage blocks} type\index{type} of a value.
817819

818820
<!-- These two need to be remade as text -->
819-
![image151.png](assets/image151.png){.image-2x}
820-
![image152.png](assets/image152.png){.image-2x}
821+
![image151.png](assets/image151.png){.image-4x}
822+
![image152.png](assets/image152.png){.image-4x}
821823

822-
<!-- This needs 2 columns -->
823-
::: {style="columns: 2; column-gap: 0.5em;"}
824-
![image155.png](assets/image155.png){.image-2x}\index{set flag block}
824+
::: {layout-ncol=2}
825+
![image155.png](assets/image155.png){.image-4x}\index{set flag block}
825826

826827
Turn the\index{split block} text into a list,
827828
using the second input as the delimiter between items. The default
@@ -838,7 +839,7 @@ takes a script as the first input, reporting a list structure
838839
representing the structure of the script. See Chapter XI.
839840
:::
840841

841-
![image170.png](assets/image170.png){.image-inline}{.image-2x} For lists,
842+
![image170.png](assets/image170.png){.image-inline} For lists,
842843
\index{identical to} reports true only if its two input values are the
843844
very same list, so changing an item in one of them is visible in the
844845
other. (For `=`, lists that look the same are the same.) For text strings,
@@ -852,51 +853,51 @@ are Δ*x* and Δ*y* in that order, because we measure angles clockwise
852853
from north. `max` /index{max block} and `min` /index{min block} are *variadic;* by clicking the arrowhead, you
853854
can provide additional inputs.
854855

855-
![image177.png](assets/image177.png) <!-- style="width:0.63in;height:0.19in" alt="Logo Description automatically generated with medium confidence" / -->
856-
![image178.png](assets/image178.png) <!-- style="width:0.63in;height:0.19in" alt="A picture containing text, monitor, screenshot Description automatically generated" / -->
857-
![image179.png](assets/image179.png) <!-- style="width:0.63in;height:0.19in" alt="Logo Description automatically generated" / -->
856+
![image177.png](assets/image177.png){.image-inline} ![image178.png](assets/image178.png){.image-inline} ![image179.png](assets/image179.png){.image-inline}
858857

859-
Similarly, these\index{*less-than-or-equal@\texttt{≤} block} hidden predicates can be found by relabeling the relational predicates.
858+
Similarly, these\index{*less-than-or-equal@`` block} hidden predicates can be found by relabeling the relational predicates.
860859

861860
### Metaprogramming (see @sec-ch11)
862861

863862
![image172.png](assets/image172.png)
864863

865864
These blocks support *metaprogramming,* which means manipulating blocks
866865
and scripts as data. This is not the same as manipulating procedures
867-
(see Chapter VI. ), which are what the blocks *mean;* in metaprogramming
866+
(see @sec-ch06), which are what the blocks *mean;* in metaprogramming
868867
the actual blocks, what you see on the screen, are the data. This
869868
capability is new in version 8.0.
870869

870+
### First class list blocks (see @sec-ch04):
871871

872-
### First class list blocks (see Chapter IV, page[46](#first-class-lists)):
873-
874-
<!-- TODO: welp. this needs to be rena -->
872+
<!-- TODO: welp. this needs to be remade -->
875873
![image173.png](assets/image173.png)
876874

877875
`Numbers from`\index{numbers from block} will
878876
count up or down.
879877

880-
![image224.png](assets/image224.png){.image-inline} ![image225.png](assets/image225.png){.image-inline}
878+
![image224.png](assets/image224.png){.image-inline} ![image225.png](assets/image225.png){.image-inline}
881879
report\index{position block} the sprite or mouse position as a two-item
882880
vector (x,y).
883881

884-
**First class procedure blocks (see Chapter VI, page[65](#procedures-as-data)):**
882+
**First class procedure blocks (see @sec-ch06):**
885883
![image226.png](assets/image226.png)
886884

887-
**First class continuation blocks (see Chapter X, page[93](#continuations)):**
888-
![image227.png](assets/image227.png) <!-- {width=0.72in height=0.2in} -->
885+
**First class continuation blocks (see @sec-ch10):**
886+
![image227.png](assets/image227.png)
887+
888+
**First class sprite, costume, and sound blocks (see @sec-ch07):**
889889

890-
**First class sprite, costume, and sound blocks (see Chapter VII, page[73](#object-oriented-programming-with-sprites)):**
890+
![image228.png](assets/image228.png)
891891

892-
![image228.png](assets/image228.png) <!-- {width=0.72in height=0.2in} -->
892+
![image229.png](assets/image229.png)
893893

894-
![image229.png](assets/image229.png) <!-- {width=0.72in height=0.2in} --> Object is a hyperblock.
894+
Object is a hyperblock.
895895

896896
**Scenes:**
897897

898-
![image280.png](assets/image280.png){.image-inline} <!-- {width=2.38in height=1.32in} --> The
899-
major new feature of version 7.0 is *scenes:*\index{scenes} A project can include
898+
![image280.png](assets/image280.png){.image-2x}
899+
900+
The major new feature of version 7.0 is *scenes:*\index{scenes} A project can include
900901
within it sub-projects, called scenes, each with its own stage, sprites,
901902
scripts, and so on. This block makes another scene active, replacing the
902903
current one.
@@ -906,11 +907,11 @@ no variables. But the old scene can send a message to the new one, to
906907
start it running, with optional payload as in broadcast\index{broadcast
907908
block} (See @sec-broadcast).
908909

909-
![image282.png](assets/image282.png){.image-2x}
910+
![image282.png](assets/image282.png){.image-4x}
910911

911912
In particular, you can say
912913

913-
![image281.png](assets/image281.png){.image-2x}
914+
![image281.png](assets/image281.png){.image-4x}
914915

915916
if the new scene expects to be started with a green flag signal.
916917

@@ -919,7 +920,7 @@ These accept two-item (x,y)\index{points as inputs} lists
919920
\index{two-item (x,y) lists} as input, and have extended menus (also
920921
including other sprites):\index{to block}
921922

922-
![image283.png](assets/image283.png) <!-- {width=0.72in height=0.2in} -->
923+
![image283.png](assets/image283.png)
923924

924925
“Center” means the center of the stage\index{center of the stage}, the
925926
point at (0,0). “Direction” is in the point in direction sense, the
@@ -928,14 +929,16 @@ the mouse, or the center. “Ray length” is the distance from the center
928929
of this sprite to the nearest point on the other sprite, in the current
929930
direction.
930931

931-
![image284.png](assets/image284.png){.image-2x}{.image-inline} <!-- {width=0.72in height=0.2in} --> The `stop` block\index{stop block} has two extra menu choices. `Stop this block` is used inside the definition of a custom block to stop just this
932+
![image284.png](assets/image284.png){.image-4x}
933+
The `stop` block\index{stop block} has two extra menu choices. `Stop this block` is used inside the definition of a custom block to stop just this
932934
invocation of this custom block and continue the script that called it.
933935
`Stop all` but this script is good at the end of a game to stop all the
934936
game pieces from moving around, but keep running this script to provide
935937
the user’s final score. The last two menu choices add a tab at the
936938
bottom of the block because the current script can continue after it.
937939

938-
![image285.png](assets/image285.png){.image-inline} <!-- {width=0.72in height=0.2in} --> The new “pen trails” option is true if the sprite is touching any drawn
940+
![image285.png](assets/image285.png){.image-2x}
941+
The new “pen trails” option is true if the sprite is touching any drawn
939942
or stamped ink on the stage. Also, `touching`\index{touching block} will
940943
not detect hidden sprites, but a hidden sprite can use it to detect
941944
visible sprites.
@@ -944,18 +947,22 @@ visible sprites.
944947
\index{video block} has a snap option\index{snap option} that takes a
945948
snapshot and reports it as a costume. It is hyperized with respect to its second input.
946949

947-
![image304.png](assets/image304.png){.image-inline} <!-- style="width:1.05972in;height:0.27986in" alt="Icon Description automatically generated" / --> The “neg” option\index{neg option} is a monadic\index{of block
950+
:::{.evenly-spaced-images layout-ncol=2}
951+
![image306.png](assets/image306.png){.image-inline}
952+
953+
![image304.png](assets/image304.png){.image-inline} The “neg” option\index{neg option} is a monadic\index{of block
948954
(operators)}\index{length of text block} negation operator
949-
\index{negation operator}, equivalent to ![image306.png](assets/image306.png){.image-inline}. “lg” is log<sub>2</sub>.
955+
\index{negation operator}, equivalent to “lg” is log<sub>2</sub>.
950956
“id” is the identity function, which reports its input. “sign” reports 1
951957
for positive input, 0 for zero input, or -1 for negative input.
952958
\index{set background block}
959+
:::
953960

954-
::: {.callout-tip}
955-
## Two Different Length Of Blocks
961+
<!-- ::: {.callout-tip} -->
962+
<!-- ## Two Different Length Of Blocks -->
956963

957964
The ![length of text block](../blocks/images/block_reportTextAttribute.png){.image-inline} name was changed to clarify it is different from ![length of text block](../blocks/images/block_reportListAttribute.png){.image-inline}
958-
:::
965+
<!-- ::: -->
959966

960967
![image308.png](assets/image308.png)
961968

@@ -980,7 +987,7 @@ Extended broadcast\index{broadcast block} : Click the right arrowhead to direct
980987
:::
981988

982989
::: {.evenly-spaced-images layout-ncol=2}
983-
![image311.png](assets/image311.png){.image-2x}
990+
![image311.png](assets/image311.png){.image-4x}
984991

985992
Extended `when I receive`\index{when I receive block}: Click the right
986993
arrowhead to expose a script variable (click on it to change its name,
@@ -995,14 +1002,14 @@ broadcast, or to a two-item list containing the message and the payload.
9951002
![image355.png](assets/image355.png){.image-2x}
9961003

9971004
If the input is set to “any key,” then a right arrowhead appears:
998-
![image357.png](assets/image357.png){.image-inline} and if you click it,
1005+
![image357.png](assets/image357.png){.image-inline-tall} and if you click it,
9991006
a script variable key is created whose value is the key that was
10001007
pressed. (If the key is one that’ represented in the input menu by a
10011008
word or phrase, e.g., “enter” or “up arrow,” then the value of key
10021009
will be that word or phrase, *except for* the space character, which
10031010
is represented as itself in key.)
10041011

1005-
![image356.png](assets/image356.png){.image-2x} <!-- style="width:2.25in;height:0.41944in" alt="Website Description automatically generated with medium confidence" -->
1012+
![image356.png](assets/image356.png){.image-4x} <!-- style="width:2.25in;height:0.41944in" alt="Website Description automatically generated with medium confidence" -->
10061013

10071014
The RGB(A)\index{set pen block} option accepts a single number, which
10081015
is a grayscale value 0-255; a two-number list, grayscale plus opacity
@@ -1024,7 +1031,7 @@ library.
10241031
![image362.png](assets/image362.png)
10251032

10261033
::: {.evenly-spaced-images layout-ncol=2}
1027-
![image363.png](assets/image363.png){.image-2x}
1034+
![image363.png](assets/image363.png){.image-4x}
10281035

10291036
The `of` block\index{of block (sensing)} has an extended menu of
10301037
attributes of a sprite. Position reports an (x,y) vector. Size reports
@@ -1074,7 +1081,7 @@ needs.
10741081
The libraries and their contents may change, but as of this writing the
10751082
list library\index{list library} has these blocks:
10761083

1077-
![image387.png](assets/image387.png){.image-2x} <!-- {width=1.84861in height=2.49236in} -->
1084+
![image387.png](assets/image387.png){.image-4x} <!-- {width=1.84861in height=2.49236in} -->
10781085

10791086
(The lightning bolt (⚡️)\index{*lightning-bolt@⚡️ (lightning bolt)} before the name in several of these
10801087
blocks means that they use compiled HOFs or JavaScript primitives to achieve
@@ -1232,7 +1239,7 @@ Lisp/Scheme.
12321239

12331240
The pixels library\index{pixels library} has one block:
12341241

1235-
![image395.png](assets/image395.png{.image-2x} <!-- {width=0.77917in height=0.62986in} -->
1242+
![image395.png](assets/image395.png{.image-4x} <!-- {width=0.77917in height=0.62986in} -->
12361243

12371244
Costumes are first class data
12381245
in [Snap]{.snap}. Most of the processing of costume data is done by primitive
@@ -1325,7 +1332,7 @@ reports the color currently in use by the pen. The `from color` block
13251332
\index{from color block} reports names or numbers associated with a
13261333
color:
13271334

1328-
![image411.png](assets/image411.png){.image-2x} <!-- style="width:0.95in;height:0.225in" alt="Macintosh HD:Users:bh:Desktop:color picker.png" / -->
1335+
![image411.png](assets/image411.png){.image-4x} <!-- style="width:0.95in;height:0.225in" alt="Macintosh HD:Users:bh:Desktop:color picker.png" / -->
13291336

13301337
Colors can be created from
13311338
other colors:\index{mix colors block}
@@ -1448,7 +1455,7 @@ The text costumes library\index{text costume library} has only two
14481455
blocks:
14491456

14501457
![image446.png](assets/image446.png) <!-- style="width:1.92in;height:0.45078in" alt="Macintosh HD:Users:bh:Desktop:textcostume.png" / -->
1451-
![image447.png](assets/image447.png){.image-2x} <!-- {width=3.25972in height=0.18958in} -->
1458+
![image447.png](assets/image447.png){.image-4x} <!-- {width=3.25972in height=0.18958in} -->
14521459

14531460
`Costume from text`
14541461
reports a costume\index{costume from text block} that can be used with

0 commit comments

Comments
 (0)