Skip to content

Blockly

SittingFox edited this page Feb 17, 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 to 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.

OnHit

Main page: OnHit Blocks

These blocks deal with the orb colliding with other objects.

[OnHit] 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 20m] 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.

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.

Variables

Main page: Variables Blocks

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

Functions

Main page: Functions Blocks

With these blocks, you can create separate functions.

Clone this wiki locally