How do I script?
Some blocks have wires sticking out of them. These are script
blocks and you script by connecting their wires to other script
When you tap Play, script blocks execute and do their
thing. E.g. Set Score sets the current score,
so if we wire the Number 3 to it, the score is
set to 3:
Blocks execute top-to-bottom, left-to-right. But you can plug in the
yellow control wires to change the execution order. This is
especially useful when you want to execute a block only some of the
time. E.g. here I've wired a Button
to If to Win, so when the player
moves onto the button, then the game is won:
That's the basics! Now, I could go on, talking about every little detail
and nuance. But you'll probably learn a lot more by looking at some
example scripts that show how to do useful game stuff. So start the app
and look on the Build tab to find a game called
"Tutorial". It's fully editable, so you'll be able to see and play
around with each example script.
What do the wire colors mean?
- Blue is a number
- Green is an X,Y,Z vector (such as a position)
- Orange is a rotation
- Red is either True or False
- Pink is an object
- Gray is a constraint
- Yellow is for execution control
Which direction is X,Y,Z?
There are two white arrows on the floor. The one that points up/right is
X, up/left is Z, and Y goes straight up. The point where the arrows
start is 0,0,0. Blocks have size 1 and consist of 8x8x8 voxels, which
means each voxel is 1 / 8 = 0.125.
How do I get physics?
The inventory's Gadget folder has a Box and a Ball block with physics.
You can make new custom blocks based on them, and any object that has at
least one physics block will get physics as soon as you tap Play.
In addition, physics script blocks will add physics to the object, if it
wasn't already physical. You can use this to make an object physical
even after the game already started
playing. E.g. Add Force with an object and a
0,0,0 Force input will make that object physical while having no other
Can I copy/paste blocks between levels and games?
Not directly, but here's a workaround. Make a new custom block and place
the blocks you want to copy inside it. In the destination level or game,
fetch the custom block from the inventory, open it, and drag the copied
What does each script block do?
- It's just a number.
- Three numbers in one wire! You'll use this for X,Y,Z positions and directions.
- A rotation with X,Y,Z degree angles (applied in Y,X,Z order).
- Output True.
- Output False.
- Set Variable
- Remembers the input value. Change the variables name to something descriptive.
- Gets the value that was previously remembered by a Set Variable with the same name.
- Set Reference
- Like Set Variable, but with an additional input for the variable to store the value in. This enables you to store a variable in a List Element, or make custom script blocks that modify variables.
- List Element
- Gets a value stored in a list, with index starting from 0 (max 1,048,575). The output can also wired to Set Reference to store a value in a list.
- Negates a number.
- If the input rotates 45 degrees around X then the output will rotate -45 degrees.
- Add (Vectors)
- Sums each vector component individually.
- Subtract (Vectors)
- Subtracts each vector component individually.
- Multiplies two numbers.
- Multiply (Vector + Number)
- Scales vector by a number.
- Multiply (Vector + Rotation)
- Rotates vector by a rotation.
- Multiply (Rotation + Rotation)
- Combines two rotations into one.
- Divides two numbers.
- Raise a number to the power of an exponent.
- Outputs True if the two inputs are equal.
- Less Than
- Outputs True if the first number is smaller than the second.
- Greater Than
- Outputs True if the first number is greater than the second.
- Outputs True if both inputs are True.
- Outputs True if either input is True.
- Turns True into False, and vice versa.
- Outputs a random number in-between Min and Max (inclusive).
- Random Seed
- Set the random seed. (Use this if you want the same random numbers each time.)
- Outputs the smaller input.
- Outputs the bigger input.
- Compute sine of an angle in degrees.
- Compute cosine of an angle in degrees.
- Rounds number to the closest integer.
- Outputs the closest smaller integer.
- Outputs the closest larger integer.
- Remove the negation sign of the input number.
- Computes the division remainder.
- Make Vector
- Converts three numbers into one vector.
- Break Vector
- Converts one vector into three numbers.
- Make Rotation
- Combines X,Y,Z angles (in degrees) into one rotation (applied in Y,X,Z order).
- Break Rotation
- Extracts X,Y,Z angles (in degrees) from one rotation.
- Computes the distance between two points.
- Linearly interpolates between two rotations.
- Axis Angle
- Outputs a rotation of some degrees around a vector axis.
- Look Rotation
- Outputs a rotation as if you were standing at one point and looking at another (given up as 0,1,0).
- Screen To World
- Given a screen coordinate, outputs the start and end points of a line going through that point. That might sound weird, but usually you'll just wire those points into a Raycast to find the object the user tapped!
- World To Screen
- Given a world coordinate, outputs its screen coordinates.
- Line vs Plane
- Finds the point at which a line intersects a plane.
- Checks whether the input is True or False and executes the corresponding output.
- Play Sensor
- Executes the output only once, when the user taps Play.
- Box Art Sensor
- Executes the output only when generating the screenshot you see on the game's box.
- Touch Sensor
- Executes the output when user touches the screen. It'll also output the screen coordinates of that tap. And there's a setting to toggle whether to trigger throughout the touch, or only at the start or end of it.
- Swipe Sensor
- Executes the output when user performs a swipe gesture. Also, outputs a vector of the swipe direction in the floor plane. (You can implement other custom swipe gestures using the Touch Sensor.)
- Outputs which way the device is tilting.
- Traces a line between two points and outputs the first object it finds.
- Triggers the win animation and dialog.
- Triggers the lose animation and dialog.
- Set Score
- Sets the score. Its setting determines which type of highscore is saved.
- Set Camera
- Changes how you view the game.
- Set Light
- Changes the direction that light falls onto your blocks.
- Play Sound
- Plays a sound effect, with optional volume and pitch inputs. Use its settings to choose which sound to play. You can also loop the sound, in which case it'll just keep on playing.
- Stop Sound
- Stops that sound you just played in an endless loop! Just pass in the same Channel as Play Sound outputted.
- Volume Pitch
- Sets volume and pitch-shifts a playing sound.
- Screen Size
- Outputs the pixel width and height of the user's phone's screen.
- Set Gravity
- Sets the direction in which any physics objects falls. (Imagine if you could do this IRL!)
- Get Position
- Given an object, outputs its position. Or, if you leave the input un-wired, outputs the position of the block itself, which is very useful if you place it inside another block!
- Set Position
- Given an object, sets its position and rotation.
- Get Size
- Given an object, outputs its max and min bounds (relative its center of mass). Or, if you leave the input un-wired, outputs the world bounds (ignoring script blocks).
- Add Force
- Adds force and/or torque to an object.
- Get Velocity
- Outputs a physical object's current speed and angular speed.
- Set Velocity
- Instantaneously sets a physical object's speed (units/second) and angular speed (degrees/second). This should be used sparingly. No real object can instantaneously change its velocity, and simulated objects may behave weirdly when forced to do so.
- Set Visible
- Turns any object invisible.
- Set Locked
- Restricts a physical object's movement. 0 means completely locked and 1 means free-to-move. E.g. passing 1,0,1 to the Position input will lock an object in the X/Z plane, and passing 0,0,1 to the Rotation input will only allow it to rotate around the Z axis.
- Create Object
- Creates a copy of the input object. Note that the object's scripts will not be copied, as I have yet to figure out how to do that.
- Destroy Object
- Destroys an object. Note that this only works for objects you've previously created!
- Set Mass
- Changes the weight of a physics object.
- Set Friction
- Changes the friction of a physics object.
- Set Bounciness
- Changes how much momentum a physics object looses when bouncing. Use 0 for a complete stop and 1 for a perfect bounce.
- Triggers whenever a physics object collides with another object.
- Add Constraint
- Creates a new constraint between two physics objects. You probably only want to do this once, on Play.
- Linear Limits
- Changes a constraint's linear limits. Set the lower limit higher than the upper limit for completely un-limited movement.
- Angular Limits
- Changes a constraint's angular limits. Set the lower limit higher than the upper limit for completely un-limited movement.
- Linear Spring
- Makes the constraint springy, like a car's suspension.
- Angular Spring
- Linear Spring but for rotational movement.
- Linear Motor
- Makes the constraint move. Use Force 0,0,0 to disable the motor again.
- Angular Motor
- Makes the constraint rotate. Use Force 0,0,0 to disable the motor again.
- Displays the current input value. Very useful for debugging!
- Documents your scripts! Be brief, you have 15 characters. (I know, it's ridiculous, but better than nothing.)