Skip to content

Blockly

SittingFox edited this page Feb 25, 2015 · 19 revisions

Blockly

CodeSpells makes use of Google's block-based coding language called Blockly. The blocks represent pieces of Javascript.

Example Blockly spell.

Control

Main page: Control Blocks

These blocks manage the flow of control in a spell.

On Create What happens at the point of the orb's creation.
On Activate What happens when the activate button is hit.
Call Function Call a function with a delay before the call.
Repeat Function Repeat a function with a delay between calls.
Destroy Orb Destroys the orb.

Orb Movement

Main page: Orb Movement Blocks

Movement of the orb is controlled here, from the orb's speed to whether or not the orb should orbit around the player.

Set Orb Speed Choose how fast the orb moves.
Orbit Player Make the orb circle around the player.
Orbit Creator Make the orb circle around the spell caster
Break Orbit Make the orb stop circling around something.
Lock Orb to Player Rotation Makes the orb stay in the player's viewpoint.
Unlock Orb from Player Rotation Frees the orb from the player's viewpoint.
Turn Orb Turns the orb by the given amount.
Set Orb Rotation Make the orb face a certain direction.
Look At Make the orb face the player or spell create.

Orb Properties

Main page: Orb Properties Blocks

The blocks here mostly fetch data on the orb.

Lifetime The time since the spell started.
Orb Distance to Player How far the orb is from the player.
Remaining Mana How much mana the orb has left.
Set Orb Color Change the color of the orb.

Orb Powers

Main page: Orb Powers Blocks

Elemental orb power blocks are located here.

Earth Orb

Lower Sand Lower the sand below the orb.
Lift Sand Lift the sand below the orb.
Elastic Connection Grab another object with the orb, pulling it along.
Break Elastic Connection Makes the orb let go of an object attached to it.
Cast Orb with Spell Cast another spell during the spell.

OnHit

Main page: OnHit Blocks

These blocks deal with the orb colliding with other objects.

On Hit What happens when the orb hits something.
Is Hit Object Moveable Can the object hit by the orb move?

Communication

Main page: Communication Blocks

Certain interactions between orbs can be done with these blocks, allowing communication between spells.

Broadcast Message 20m Send a short-range message to another orb.
Broadcast Message 75m Send a mid-range message to another orb.
Broadcast Message 150m Send a long-range message to another orb.
On Message Received What to do when the orb receives a message.
Received message The message from the other orb.

Logic

Main page: Logic Blocks

Blocks that are used for if conditions and boolean values are of this type.

If

If If conditional block.
If, Else Conditional block with if and else.
If, Else If, Else Conditional block with if, else if, and else.

Boolean

Comparator Compares two values.
And/Or Checks multiple conditions.
Not Not the value.
True/False For the values true or false.
Null The value that means 'nothing'.
Inline If Conditional block for a simple if and else.

Loops

Main page: Loops Blocks

These blocks allow for creating loops of repeating code.

Repeat Number of Times Repeat code as many times given.
Repeat While/Until Repeat code if the given variable is true or false.

Math

Main page: Math Blocks

Various number and math options, from random numbers to pi, are possible with these blocks.

Debug

Main page: Debug Blocks

These blocks allow for writing Javascript code into your spells by hand.

Eval Allows you to use code written by hand.
String For using letters and words.

Variables

Main page: Variables Blocks

The blocks here are for creating and using variables within a spell.

Set Variable Setup a variable.
Variable Make use of a variable.

Functions

Main page: Functions Blocks

With these blocks, you can create functions and use them.

Function Setup a function.
Returning Function Setup a function that returns a value.
Early Return End the function early and return a value.
Function Call Call a function.
Returning Function Call Call a returning function and use what it gives you.

Clone this wiki locally