Fancade

Frequently Asked Questions


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 blocks.

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?


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 effect.


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 blocks out!


What does each script block do?

Number
It's just a number.
Vector
Three numbers in one wire! You'll use this for X,Y,Z positions and directions.
Rotation
A rotation with X,Y,Z degree angles (applied in Y,X,Z order).
True
Output True.
False
Output False.
Set Variable
Remembers the input value. Change the variables name to something descriptive.
Variable
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.
Negate
Negates a number.
Inverse
If the input rotates 45 degrees around X then the output will rotate -45 degrees.
Add
Plus.
Add (Vectors)
Sums each vector component individually.
Subtract
Minus.
Subtract (Vectors)
Subtracts each vector component individually.
Multiply
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.
Divide
Divides two numbers.
Power
Raise a number to the power of an exponent.
Equal
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.
AND
Outputs True if both inputs are True.
OR
Outputs True if either input is True.
NOT
Turns True into False, and vice versa.
Random
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.)
Min
Outputs the smaller input.
Max
Outputs the bigger input.
Sin
Compute sine of an angle in degrees.
Cos
Compute cosine of an angle in degrees.
Round
Rounds number to the closest integer.
Floor
Outputs the closest smaller integer.
Ceiling
Outputs the closest larger integer.
Absolute
Remove the negation sign of the input number.
Modulo
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.
Distance
Computes the distance between two points.
LERP
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.
If
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.)
Accelerometer
Outputs which way the device is tilting.
Raycast
Traces a line between two points and outputs the first object it finds.
Win
Triggers the win animation and dialog.
Lose
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.
Collision
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.
Inspect
Displays the current input value. Very useful for debugging!
Comment
Documents your scripts! Be brief, you have 15 characters. (I know, it's ridiculous, but better than nothing.)