Skip to content

Latest commit

Β 

History

History
309 lines (237 loc) Β· 12.6 KB

blocks.md

File metadata and controls

309 lines (237 loc) Β· 12.6 KB

This is a reference of all blocks that are currently in Sandspiel Studio.
We're still building Sandspiel Studio! To support us, or join our early-access community, please sign up! :)

Categories

  1. Cells
  2. Comments
  3. Logic
  4. Direction
  5. Number
  6. Data
  7. Experimental

Category: Cells

Type

A type of cell.
image

When expanded: A group of types.
image

Swap

Swap places with another cell.
image

Note: This also updates the position of 'me' to be where the cell swapped to.

Copy

Copy myself into another cell.
image

Change

Change a cell into a different type.
image

Note: This also resets the Hue Rotate, Extra Data, and Color Fade of the cell.

Check

Is a cell a certain type?
image

Is a cell any of these types?
image

Touching

Am I touching a certain type of cell?
image

Am I touching any of these types of cell?
image

Note: A touching cell can be in any of the 8 surrounding cells:
🟩🟩🟩
🟩⬜🟩
🟩🟩🟩

Number Touching

How many cells am I touching that are a certain type?
image

How many cells am I touching that are any of these types?
image

Note: A touching cell can be in any of the 8 surrounding cells:
🟩🟩🟩
🟩⬜🟩
🟩🟩🟩

Cell Type

The type of a cell.
image

Category: Comments

Note

A note about your code.
image

Category: Logic

If

If a condition is true, do something.
image

For example: If I am touching Water, change into Water.
image

Chance

Randomly true with a certain chance.
image

Keyboard

Is a keyboard button held down?
image

Note: You can choose from any of these keys.

space bar
➑ right arrow
β¬… left arrow
⬆ up arrow
⬇ down arrow

Compare

Is a value equal to another value?
image

Is a value bigger/smaller than another value?
image
image

For example: Am I touching more than 3 Water cells?
image

And / Or

Are both things true?
image

Is either thing true?
image

For example: Am I touching Water, and also above Sand?
image

True / False

True.
image

False (not true).
image

Not

Is a thing not true?
image

For example: Am I not touching Water?
image

Category: Direction

Vector

A position or direction.
image
image

Note: These are the vectors that you can choose from.

me
➑ right
β¬… left
⬆ up
⬇ down
β†— NE
β†˜ SE
↙ SW
β†– NW
? Neighbor
Arrow Keys_

Note: 'me' is the position of this cell.
Note: '? Neighbor' chooses a random direction.
Note: 'Arrow Keys' direction is controlled by what arrow keys you are pressing.

Note: Behind-the-scenes, vectors are represented with an 'x' and 'y' value.
For example, 'me' is (0,0) and 'NE' is (1,-1).

Arrow Keys Direction

The direction that the arrow keys are pressed.
image

For example: If you press the right arrow, it will be the 'right' direction.

Note: You can also do diagonal directions by pressing more than one key.
For example: You press the right arrow and the up arrow, it will be the 'NE' direction.

Random Transformation

Do something in a random rotation or reflection.
image

For example: Swap positions in a random direction.
image

Note: 'rotation' picks from eight possible 45Β° rotations.
Note: These are all the transformations you can choose from.

↻ rotation
βœ₯ reflection
⟷ horizontal reflection
↕ vertical reflection

For Each Transformation

Repeat something in each rotation or reflection.
image

For example: Copy myself in all directions.
image

Note: 'rotation' cycles through eight possible 45Β° rotations.
Note: These are all the transformations you can choose from.

↻ rotation
βœ₯ reflection
⟷ horizontal reflection
↕ vertical reflection

Rotated

Do something, rotated by a certain number of 45Β° rotations.
image

Note: Positive numbers rotate clockwise. Negative numbers rotate anti-clockwise.
For example: Swap positions with the cell to my left (down rotated by 45Β° two times, clockwise).
image

Category: Number

Number

A number.
image

Note: Can be any number from -100 to 100.

Operation

A math operation between two numbers.
image

Note: These are all the operations you can do with numbers:

Operator Description Example Result
+ Add two numbers together 3 + 2 5
- Subtract a number from another 5 - 3 2
Γ— Multiply two numbers together 3 Γ— 2 6
Γ· Divide a number by another 6 Γ· 2 3
% Find the remainder when you divide one number by another 5 % 2 1
difference Find the difference between two numbers 3 difference 5 2

You can also do operations with two vectors.
image

Note: When you use two vectors in this block, the operation happens to each co-ordinate.
For example, if you add 'right' (1, 0) to 'SE' (1, 1), it does (1+1, 0+1). This results in (2, 1).

You can also combine numbers and vectors in operations.
image

Note: There are some special interactions when you combine numbers and vectors:

Operation Description
Vector + Number Rotate the vector by a number of 45Β° rotations, clockwise
Vector - Number Rotate the vector by a number of 45Β° rotations, anti-clockwise

Note: All other number and vector operations apply the number to each co-ordinate of the vector.
For example: When you multiply 'right' (1, 0) by 2, it does (1Γ—2, 0Γ—2). This results in (2, 0).

Random Number

A random number between a minimum and maximum number.
image

Category: Data

All cells store four different pieces of data.

Name Description Range Default
Type How the cell behaves (eg: Sand) n/a n/a
Color Fade How much the cell is faded from its primary color to its secondary color 0 to 100 A random number
Hue Rotate How much the cell's color is changed through the hue wheel. 0 to 100 (wraps around) 0
Extra Data Does nothing 0 to 100 0

Get Data

My data.
image

When expanded: The data of a cell.
image

Modify Data

Increase my data by a certain amount.
image

When expanded: Increase the data of a cell by a certain amount.
image

Set Data

Set my data.
image

When expanded: Set the data of a cell.
image

Category: Experimental

These are some experimental blocks that have been added recently.

Repeat

Repeat something a certain number of times.
image

For example: Swap downwards 2 times.
image

Every

Do something occasionally.
image

For example: Every three frames, swap downwards.
image

End of Frame

Queue something to happen at the end of the frame (after every cell else has behaved).
image

For example: After every cell has behaved, change into Air.
image