Snapblocks Tutorial

Snapblocks is a fork of scratchblocks by @ego-lay_atman-bay, it does exactly what you think. Although it's mostly scratchblocks but with Snap! style, there ARE differences you need to know incase Snap! puts them in forums or you want to try them.

To test out snapblocks for your self, click on this text to visit the website.

CATEGORIES

The categories are mostly the same in snapblocks.

motion::motion
looks::looks
sound::sound
pen::pen
control::control
sensing::sensing
operators::operators
variables::variables
list::list
grey::grey
gray::gray
other::other
custom::#2038FF
custom 2::#F35

OPTIONS

There are 3 options available in snapblocks.

ZEBRA COLORING

Zebra coloring is what you'd expect, when there are 2 or more blocks connected which belongs to the same coloring it will do "zebra coloring" which is where some blocks are brighter that the other ones like a zebra.
To enable, simply turn on zebraColoring option. (Called "Zebra Coloring" in the homepage)
A demonstration of what zebra coloring looks like:

if < < <(x position) \>= ([left V] of [Stage V])> and <(x position) \<= ([right V] of [Stage V])>> or <<(y position) \<= ([top V] of [Stage V])> and <(y position) \>= ([bottom V] of [Stage V])>>> {
...
}

BLOCK WRAPPING

Block wrapping is what happens when a block contains too many blocks on itself and wraps to fit the screen.
To enable this option, enable wrap option. (Called "Block Wrapping" in the homepage) Additionally, you could change the size using the wrapSize option.
A demonstration of what block wrapping looks like:

go to ((postion) + ((list ([sin V] of (direction)) ([cos V] of (direction)) @delInput @addInput) x (steps) @delInput @verticalEllipsis @addInput) @delInput @verticalEllipsis @addInput)

SHOW SPACES

Show spaces is probably not what you expect. If you're familiar with Snap!, you probably already know what this means. In the editor, the spaces are shown as a purple-ish circle to easily know if it's a space, and this option shows exactly that.
The spaces only show in inputs such as a number input, text input, any input.
To enable, simply turn on showSpaces option. (Called "Show Spaces" in the homepage)
A demonstration of what show spaces look like:

ask [Should snapblocks be implemented in Snap! forums?] and wait

And that's everything for the options! Now onto the fun part...

SYNTAX

Just as you thought everything would be the same, you're completely WRONG.

C-BLOCKS

As you might know, to make a c-block you use these: "{}", and for already existing ones you just type the name and it'll be a c-block right? WRONG.
Normally in scratchblocks, if you type if <> then, you'll get [scratchblocks] if <> then [/scratchblocks]
However... if you do that in snapblocks you'll instead get snapblocks (4)
To make a c-block, even if it's not a custom c-block, you STILL have to use "{}":

if <>{
}@addInput // good
if <> // bad

ICONS

As you might've already known, we have THESE icons:
snap
Believe it or not, there are MORE icons from Snap! that has already been exported into snapblocks!

@pointRight@gears@gearPartial@gearBig@turtle@turtleOutline@pause@cloud@cloudOutline@storage@flash@brush@circle@circleSolid@paintBucket@eraser@pipette@arrowUp@arrowUpThin@arrowUpDownThin@arrowLeft@arrowLeftThin@arrowLeftRightThin@arrowDown@arrowDownThin@arrowRight@arrowRightThin@arrowLeftOutline@arrowDownOutline@arrowUpOutline@arrowRightOutline@notes@camera@location@globe@globeBig@verticalEllipsis::grey

You can also change the size AND color however you like!
@iconname-s-r-g-b
iconname = The icon name
s = the size
r = Red
g = Green
b = Blue
EXAMPLE:

@notes-2-0-0-0 play notes::sound

snapblocks (2)

DROPDOWNS

Normally in Scratchblocks, you can only get read-only dropdowns in 3.0, one non-readonly dropdown in 2.0 (number input). But in Snapblocks, you can make your OWN dropdowns!
Capital V = READ-ONLY
Lowercase v = EDITABLE
Example:

find [a funny bird v]::motion
if <[a funny bird v] spotted?::motion>{
say [OMG IT'S A BIRD!!!!] in font [Arial V] text size (12 v) for (5) seconds::looks
}@addInput

NOTE: Number input dropdowns on 3.0 will ALWAYS be read-only no matter what.

This is a great tutorial. You can take some information from the documentation if needed.

Which documentation do you mean? I checked the snapblocks documentation and guess what it documents? It has the same contents as the scratchblocks documentation other than that all scratchblocks snippets are replaced by snapblocks.

This is what one of the scripts in there looks like (this is a crazy mess caused by unintended syntax alterations):

I don't think you should choose this script (especially when you have emphasis on zebra coloring) because the true/false switch is in the wrong colour.

I agree, you shouldn't create an example using a boolean block that hasn't been implemented into snapblocks yet. I personally think using operators blocks in a large check is a much better example of zebra coloring (and block wrapping).

if < < <(x position) \>= ([left V] of [Stage V])> and <(x position) \<= ([right V] of [Stage V])>> or <<(y position) \<= ([top V] of [Stage V])> and <(y position) \>= ([bottom V] of [Stage V])>>> {
...
}

1000377442

Yes, the snapblocks documentation really needs more info, especially since I just copy / pasted the sxrtmatchblocks tutorial from the sxratch wiki, and edited it.

Hmm when I quote that line it all comes out in one color, but in the original it had the "2" in cyan and the "::" in pink. So I was going to suggest using

``​`sdfrg

(any old garbly text after the backquotes will work) in front of the code lines to defeat the silly syntax coloring and leave everything in monochrome. If you're too proud to use garble, you could say

``​`text

to make it look all official.

I've been using

```snapblocks

That way I know it's snapblocks (if it's scratchblocks, I use scratchblocks). The plus side is, if I ever make snapblocks syntax highlighting (which I've been thinking about recently), then it would show up.

Ugh. (imho of course)

update: added 2 things that probably isnt much

Hey, I have a request. Can you please follow the style guide, so that the snapblocks you show here is clean, and easy to read?

Also,

It's probably better if you did s-r-g-b instead of a-b-c-d

Another note

The correct terms are, read-only and editable.