Complete Blockly Blocks Reference
Game
Controls
Check key press
Returns true if the specified key is currently pressed. Supports arrow keys and A/B/X/Y buttons. Can be used for continuous movement while holding a key.
Check key press (once)
Returns true only at the moment the key is first pressed, not while holding. Ideal for single actions like jumping or shooting.
Get joystick axis value
Returns a value (-1.0 to 1.0) for the specified controller axis (0-3). Axes 0 and 1 are typically the left stick, 2 and 3 are the right stick.
Vibration
Activates vibration on supported devices. Can be configured as simple vibration (specifying duration) or complex patterns.
Timers
Set interval
Executes the specified code at regular intervals (in milliseconds). Returns an interval ID that can be used to stop it.
Clear interval
Stops the execution of an interval by its ID. Important to clear intervals when they're no longer needed to prevent memory leaks.
Set timer
Executes code once after the specified time (in milliseconds). Useful for delays and deferred actions.
Sound and Music
Music editor
Visual editor for creating musical sequences. Allows combining notes of different durations and pitches.
Play music
Plays music created in the editor at the specified tempo (BPM). Can be used for background music and sound effects.
Sound editor
Sound wave generator for creating simple sound effects. Supports different wave forms (sine, square, sawtooth).
Play sound
Plays sound created in the editor. Optimized for short sounds (shots, jumps, collecting items).
Data Management
Save variables
Saves current values of specified variables to browser's local storage. Data persists between sessions.
Load variables
Restores variable values from local storage. Automatically detects types of saved data.
Multiline JS input
Allows inserting pure JavaScript code for complex logic that can't be expressed with blocks. Supports ES5 syntax.
Game loop
Main game loop that runs every frame. Contains game state update and rendering logic.
Pause/Resume
Pauses or resumes game execution. Can be used to create pause menus.
Check pause
Returns true if the game is in paused state.
Set background
Sets background image for the game. Can choose display mode: stretch or tile.
Set background position
Sets background image offset on X and Y axes.
↑ Back to top
Objects
Object Creation
New object prototype
Creates a template (class) for objects with specified parameters (size, sprite). Prototypes allow creating multiple similar objects.
New object
Creates an object instance with specified coordinates, dimensions and sprite. Can add initialization code in onCreate event.
New object from prototype
Creates an object based on a previously defined prototype, copying all its properties. Saves time when creating similar objects.
Clone object
Creates an exact copy of an existing object with all current property values. Useful for enemy spawning or creating copies.
Copy state
Copies all properties (except position) from one object to another. Can be used to reset state or synchronize objects.
Object Management
Change object parameter
Sets new value for specified object property (x, y, speed, visibility etc.). Supports different object types.
Add to parameter
Increases (or decreases) object property value by specified amount. Convenient for gradual changes in speed, size etc.
Get object parameter
Returns current value of object property. Can be used for state checking or mathematical calculations.
Delete object
Completely removes object from game, freeing resources. Important to delete unused objects for performance optimization.
Iterate objects
Executes specified code for each object in the game. Can filter objects by name or other properties inside the loop.
Get object
Returns reference to object by its type (current, collided, random etc.).
Set collision bounds
Configures collision area shape and size for object (rectangle, circle or automatic calculation).
Object Events
On every frame
Code executes every game cycle (typically 60 times per second). Ideal for continuous movement and checks.
On collision
Code executes when object collides with another object. Inside the block, 'object' variable is available - reference to the second object.
Object animation
Configures sprite animation for object: frame list, playback speed and looping.
Sprite editor
Visual editor for creating and editing object sprites.
↑ Back to top
Movement
Physics
Set gravity
Sets gravity force affecting all objects in the game. Positive values pull down, negative - up.
Control object
Configures object control with keyboard or gamepad. Supports several control schemes (platformer, top-down shooter).
Movement
Set velocity
Sets object movement speed on X and Y axes. Can be used for impulse movement or sudden direction change.
Teleport
Instantly moves object to specified coordinates or to another object. Doesn't account for collisions during movement.
Move to point
Smoothly moves object to specified coordinates at given speed.
Distance to point
Calculates distance between two objects or between object and point. Returns value in pixels.
Camera follow
Makes game camera smoothly follow specified object. Can configure camera smoothness and offset.
Positioning
Get window position
Returns current game camera coordinates (visible area). Useful for UI elements and visibility checks.
Set screen position
Moves game camera to specified coordinates. Can be used for cutscenes or static cameras.
Check collision
Checks intersection of two rectangular areas. Returns true if areas intersect. Doesn't account for rotation.
↑ Back to top
Logic
Conditions
If-else
Standard conditional statement. Executes code based on condition truthiness. Can add any number of "else if" branches.
Comparison
Compares two values with selected operator (==, !=, >, <, >=, <=). Returns true or false.
Logical operations
Performs AND/OR logic between two conditions. Useful for complex checks.
Negation
Inverts boolean value (true becomes false and vice versa). Convenient for "if condition is not met" checks.
Check object name
Compares object name with string. Useful for filtering collisions between specific object types.
Special Checks
Object off screen
Checks if object has completely left game screen boundaries. Can be used for bullet removal or enemy spawning.
Object touch
Checks if player has touched specified object (tap/click). Accounts for object rotation and scale.
Collision with tile
Checks if object collides with tile of specific type. Useful for determining "dangerous" or "passable" tiles.
Get tile info
Returns information about tile the object collided with (coordinates, ID and other parameters).
↑ Back to top
Loops
Basic Loops
Repeat
Executes code specified number of times. Can set exact count or use variable.
While
Executes code while condition is true. Important to ensure condition eventually becomes false to prevent infinite loops.
For loop
Classic loop with counter. Allows setting initial value, end condition and counter step.
For each
Iterates through all list items. Inside loop, variable with current list item is available.
Loop Control
Break
Immediately exits current loop, even if continuation condition is still true. Useful when searching for item in list.
Continue
Skips current loop iteration and moves to next one. Convenient for filtering items in loop.
↑ Back to top
Math
Basic Operations
Number
Numeric constant. Can enter integer or decimal number, including negative.
Arithmetic
Performs basic arithmetic operations: addition, subtraction, multiplication, division and exponentiation.
Rounding
Rounds number by selected rule: up, down, to nearest integer or simply drops fractional part.
Modulo
Returns remainder of division of one number by another. Useful for creating cyclic effects and value limiting.
Random number
Generates random number in specified range. Can return both integer and decimal values.
Trigonometry
Sin/Cos/Tan
Trigonometric functions. Accept angle in degrees. Useful for circular motion and oscillating effects.
Constants
Basic mathematical constants: π (pi), e (natural logarithm base), √2, φ (golden ratio) and others.
Limitations
Limit range
Ensures value stays between specified minimum and maximum. If value goes beyond boundaries, it's set to nearest boundary.
Number properties
Checks various number properties: even, positive, finite (not NaN and not Infinity), divisibility by another number.
↑ Back to top
Text
String Operations
Text
String constant. Can enter any text including spaces and special characters.
Concatenate
Joins several strings into one. Can specify any number of items and separator between them.
Length
Returns number of characters in string. Returns 0 for empty string.
Empty string?
Checks if string is empty (contains no characters, not even spaces).
Change case
Converts string to upper or lower case. Accounts for locale with special characters.
Search and Extraction
Find position
Searches for substring in string and returns position of first match (starting from 0). Returns -1 if substring not found.
Character at index
Returns character at specified position in string. Positions are numbered from 0.
Substring
Extracts part of string between specified positions. Can set only start position to get string to end.
Trim whitespace
Removes spaces and other whitespace characters from start and end of string. Doesn't change spaces inside string.
Output
Display text
Shows text on game screen at specified coordinates. Can set size, color and text itself.
Request input
Shows dialog box requesting text input from user. Returns entered string.
↑ Back to top
Lists
List Creation
Empty list
Creates new empty array. Can be used for subsequent filling with elements.
Create list
Creates list with specified elements. Can add any number of elements of different types.
Repeat item
Creates list filled with same item specified number of times. Useful for array initialization.
List Operations
List length
Returns number of elements in list. Returns 0 for empty list.
Empty list?
Checks if list contains at least one element. Returns true if list is empty.
Find position
Searches for element in list and returns its index (starting from 0). Returns -1 if element not found.
Get item
Returns list element at specified index. Can get element from end using negative indices.
Set item
Replaces list element at specified position with new value. Can use negative indices for counting from end.
Sublist
Extracts part of list between specified indices. Can set only start index to get list to end.
List Modification
Split string
Splits string into list of substrings using specified separator. If no separator, splits by characters.
Add item
Adds new item to end of list. Equivalent to push() method in JavaScript.
Remove last
Removes and returns last item in list. Equivalent to pop() method in JavaScript.
↑ Back to top
Drawing
Primitives
Color
Color palette with preset options. Returns string with hex color code (#RRGGBB).
Point
Draws point (pixel) of specified color at given coordinates. Can be used for creating simple images.
Line
Draws line between two points with specified color. Useful for debugging and UI elements.
Rectangle
Draws rectangle with fill option. Can be used for backgrounds, panels and other elements.
Triangle
Draws triangle by three points with fill option. Useful for creating complex shapes.
Text
Outputs text to screen with specified parameters: position, size, color. Supports multiline text.
Image
Displays image (sprite) from image editor at specified coordinates and dimensions.
Clear screen
Fills entire screen with specified color. Typically called at start of each frame for clearing previous frame.
Animation and Effects
Object animation
Configures sprite animation for object: frame list, playback speed and looping.
Create particles
Generates particle system with configurable parameters: count, color, size, speed, direction, lifetime.
Particle effects
Preset particle effects: explosion, fire, smoke, rain, stars, magic. Can configure main effect color.
Clear particles
Removes all active particles from screen. Useful when changing levels or restarting game.
↑ Back to top
Variables
Global Variables
Create variable
Declares new global variable and assigns initial value. Accessible from anywhere in program.
Get variable
Returns value of previously created variable. If variable doesn't exist, returns undefined.
Change variable
Sets new value for existing variable. Can be used for counters, flags and other mutable data.
Local Variables
Create local
Creates variable bound to specific object. Accessible only inside this object via this.local.
Add to local
Increases value of object's local variable by specified amount. Useful for counters inside objects.
Get local
Returns value of object's local variable. If variable doesn't exist, returns undefined.
↑ Back to top
Procedures
Functions
Create procedure
Defines new function with name and set of parameters. Function body is composed of other blocks.
Call procedure
Executes previously created function. Can pass arguments matching function parameters.
Parameters
Defines parameters for function. Each parameter has name and can be used inside function.
Return value
Ends function execution and returns specified value. If not specified, function returns undefined.
↑ Back to top