Stick to Edge Node – Buildbox 3 Manual

By |

Stick to Edge Node

This advanced node maintains an asset’s position and size in relation to the screen size.

This node only works with  UI Screens assets and will overwrite the current the asset’s position in the UI Editor.

This node automatically enabled when the asset is created or spawned in the game.

After you add this node to a UI asset, you need to specify the following:

  • Select the Side attribute to specify which side of the screen you want to place the asset, then specify the Horizontal and Vertical Distance depending on which side you chose.
  • The following lists each Side option as well as the Distance attributes you need to specify.
    • Bottom—Vertical
    • BottomLeft—Horizontal & Vertical
    • BottomRight—Horizontal & Vertical
    • Left—Horizontal
    • Right—Horizontal
    • Top—Vertical
    • TopLeft—Horizontal Dist. & Vertical
    • TopRight—Horizontal & Vertical

Node Attributes

Option Description
Name Type a custom name for this node, if needed.
Horizontal Dist. The distance measured from the right or left side of the screen to the asset’s center.
Vertical Dist. The distance measured from the top or bottom side of the screen to the asset’s center.
Side Select the side of the screen that the distance attributes will be measured from.

If needed, you can also customize this node. For details, see Customizing Nodes.

Set UI Text Node – Buildbox 3 Manual

By |

Set UI Text Node

This action node changes the text on a specified UI Label.

The New Text input receives information from a connected node and displays it on the UI Label specified by the UI Text Name.

Currently, this node only functions with the Speedometer node.

The following is an example of a Set UI Text node displaying the asset’s movement speed on the UI Label located in a UI Screen node.

  • On the Speedometer node, the Speed Value output keeps track of the asset’s movement speed and sends it as a numeric value to the connected Set UI Text node.
  • The New Text input receives the Speed Value and displays it on the Speed UI label located on a UI Screen node.
  • The image below displays the asset moving across the scene at a speed value of 10.

Node Attributes

Option Description
Name Type a custom name for this node, if needed.
UI Text Name Enter the name of a UI Label as it appears on the UI Screen node.

Sound – API Reference

By |

Sound

The Sound Node plays an mp3 file.

Function Description
isPlaying()

Returns true if the sound is currently playing, false if not.

setVolume(value)

Sets the volume of the sound, from 0-1. The sound must already be playing before you set the sound with this function, and must be looped or non-overlapping.

volume()

Returns the volume of the sound if it is playing, from 0-1.


isPlaying()

Returns true if the sound is currently playing, false if not.

Returns

boolean – true if the sound is playing, false if not

↑ Back to top


setVolume(value)

Sets the volume of the sound, from 0-1. The sound must already be playing before you set the sound with this function, and must be looped or non-overlapping.

Parameters

number value – the volume of the sound

↑ Back to top

let fadein = false;
let mySound;
let volume = 0;

function start() {
	// start the fade in at the start of the scene
	fadein = true;
	mySound = this.entity().component("My Sound");
}

function update(dt) {
	// stops adjusting volume once volume goes over 1
	if (fadein && volume <= 1) {
		// check if the sound is playing
		if (mySound.isPlaying()) {
			// set the volume, and then increase the volume for the next update loop
			mySound.setVolume(volume);
			volume += 0.001;
		}
	}
}

volume()

Returns the volume of the sound if it is playing, from 0-1.

Returns

number - the volume of the sound

↑ Back to top

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?

LevelSector – API Reference

By |

LevelSector

The LevelSector class represents a Scene Selector “level” at the bottom of the screen in a 3D World. You can get the LevelSector that an Entity exists in with this.entity().level().

Function Description
isRemoved()

Returns true if the level has been removed, false if not. This can be used to make sure you’re not accessing a level that has been unloaded before you try using it (which would cause errors).

name()

Returns the name of the level.


isRemoved()

Returns true if the level has been removed, false if not. This can be used to make sure you’re not accessing a level that has been unloaded before you try using it (which would cause errors).

Returns

boolean true if the level is removed, false if not

↑ Back to top


name()

Returns the name of the level.

Returns

string the name of the level

↑ Back to top

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?

Keyboard Shortcuts – Buildbox 3 Manual

By |

Buildbox 3 Keyboard Shortcuts

General
Operation Windows Mac
Save Ctrl + S Command + S
Open Ctrl + O Command + O
Minimize/Hide Buildbox Windows logo key + Down arrow Command + H
Quit Buildbox Alt + F4 Command + Q
Tab Navigation
Operation Windows Mac
Close Tab Ctrl + W Command + W
Next tab Ctrl + Page Down Command + Page Down
Previous tab Ctrl + Page Up Command + Page Up
Previously viewed tab Ctrl + 9 Command + 9
Go to a specific tab Ctrl + 1-8 Command + 1-8
View Navigation
All Editors
Operation Windows Mac
Move view in any direction Middle-click + Drag / Spacebar + Left-click + Drag Middle-click + Drag / Spacebar + Left-click + Drag
Zoom in Scroll up / Ctrl + + (plus) Scroll up / Command + + (plus)
Zoom out Scroll down / Ctrl + – (minus) Scroll up / Command + – (minus)
3D Worlds
Operation Shortcut
Center your view on the selected object F
Rotate view in any angle around the scene Spacebar+ Right-click + Drag
Rotate view Rick-click + Drag
Move view forward Right-click (hold) + W
Move view backward Right-click (hold) + S
Move view left Right-click (hold) + A
Move view right Right-click (hold) + D
Move view up Right-click (hold) + E
Move view down Right-click (hold) + Q
Rotate view up Numpad 8
Rotate view down Numpad 2
Rotate view counterclockwise Numpad 4
Rotate view clockwise
Numpad 6
Front view Numpad 1
Left view Numpad 3
Top view Numpad 7
Top view flipped Numpad 9
Perspective/Orthographic Numpad 5
Duplicate Selected Objects and Nodes
Operation Windows Mac
Cut Ctrl + X Command + X
Copy Ctrl + C Command + C
Paste Ctrl + P Command + P
Duplicate Up W W
Duplicate Down S S
Duplicate Right D D
Duplicate left  A A
Scene Editor and Tools
Operation Shortcut
Switch to Select tool `
Switch to Move tool 1
Switch to Rotate tool 2
Switch to Scale tool 3
Switch to Multitool 4
Maintain aspect ratio while using the Manipulator Shift (hold)
Move selected object 0.1 unit

(2d Worlds and UI Screens)

Arrow Keys
Move selected object 1 unit

(2d Worlds and UI Screens)

Shift + Arrow Keys
Solo scene S
Mute Scene M
Preview Window
Operation Windows Mac
Preview Ctrl + P Command + P
Preview Scene Ctrl + Alt + P Option + Command + P
Restart Ctrl + R Command + R
Take screenshot Ctrl + D Command + D
Node Map: JavaScript panel
Operation Windows Mac
Search Ctrl + F Command + F

Color Animation Node – Buildbox 3 Manual

By |

Color Animation Node

This action node changes the asset color over time.

After the Start input activates, the asset’s color changes over the amount of time specified by the Duration attribute. During this time, the current color of the asset will blend with the color specified by the Target Color attribute. After the Duration finishes, the Done output will activate all its connected nodes

Option Description
Name Type a custom name for this node, if needed.
Target Color To Click the field, and in the Colors window, select a color and click OK.
Duration Enter the amount of seconds it will take for the asset’s current color to change to the Target Color.
Easing Function Specifies the rate of change when the camera changes position.

  • For an ease in ease out pattern, select InOutCube.
  • For a straight and constant pattern, select linear.
Model Name To change the color on a specific mode, enter the name of a 3D Model node. Leave blank if you want to affect all models and images attached to the asset.

If needed, you can also customize this node. For details, see Customizing Nodes.

Level Selector Node – Buildbox 3 Manual

By |

Level Selector Node

This action node allows the player to advance to the next scene after the World restarts.

This node contains two inputs:

  • The Enabled input allows this node to keep track of the current scene.
  • The Next input allows the player to advance to the next scene (after the start scene) after the World restarts.

The following is an example from the Character asset in the Progression template:

The Progression template contains a single world and and utilizes scenes as game levels. The following presents how the Level Selector node advances players to the next level:

When when the game begins, the Start scene begins, followed by scene 1, as shown at the top of the screen. After the character collides with the dotted line at the end, the If Collide node activates the Next output and the Delay node. After the delay node activates the Event (Finish) node, the game moves to the complete menu where the player can advance to the next level. After players click the play button, the game restarts the world and after the start scene finishes, scene now appears.

If needed, you can also customize this node. For details, see Customizing Nodes.

Custom Nodes – API Reference

By |

Custom Nodes

A node is a piece of functionality that exists within a Node Map. If you have an idea for a custom node, you can make one yourself and share it online as a .bbnode file with JSON formatting.

To create a custom node, you need a basic understanding of JSON formatting and a text editor of your choice. To modify a pre-existing node, see Customizing Nodes.

Writing your own Custom Node

Let’s look at a simple example – the “Set Color” node. Here’s the full .bbnode file:

{
	"name" : "Set Color",
	"attributes": [
		{
			"name" : "Set",
			"type" : "Boolean",
			"connection" : "Input",
			"editable" : false		
		},
		{
			"name" : "Done",
			"type" : "Boolean",
			"connection" : "Output",
			"editable" : false		
		},
		{
			"name" : "Color",
                        "type" : "Color",
			"connection" : "None",
			"editable" : true
		}

	],
	"script":"
        function init(){
        }


        function update(dt){
        }


        function signal(name, value) {
            //Check the incoming signals
            if (name == 'Set' && value) {
                //get the node attributes
                let col = this.attribute('Color');
                
                //set the entity color
                this.entity().setColor(col.r, col.g, col.b, col.a);
                
                //Emit signal to indicate the node finished
                this.emitSignal('Done', true);
            }
        }
    "

}

This results in the following node and attributes:

Now let’s look at it line by line.


name

"name" : "Set Color",

This defines what name this node will have.


attributes

"attributes": []

This array defines what attributes the node will have in the attributes sidebar. It also details any input or output connections the node will have. Please note that the Fields and Possible Values here are all cAsE sEnSiTiVe!

Field Description Possible Values
name Required. The name of the attribute or connection. Any string
*do not give two attributes in the same node the same name!
type Required. What data type the attribute contains. Asset
Animation
Boolean
Color
Dropdown
Mesh
Number
Slider
Text
Vector2D
Vector3D
connection Required. Whether this attribute is an input or output connection. Input
Output
None
editable Required.
Attribute: Whether this attribute is visible & editable in the attribute sidebar.
Connection: Whether the name of this connection can be altered.
true
false
essential Optional (defaults to false). If this field is set to true, then this attribute will be displayed on the Entity’s attribute sidebar when clicked in the asset window. You are marking this attribute as important enough to be accessible from the world view instead of just the entity’s mind map. true
false
self Optional. If you’d like your node to be able to be referenced by other nodes without using signals, set this to true to make the purple connection circle visible. (See requested() for more information) “self”: { “visible” : true }
“self”: { “visible” : false }
value Optional field used to define a default value for the attribute. For instance, your Number type attribute could have a default value of 100 with “value”: 100.
Value is required for a Dropdown type attribute because all possible values are pre-defined.
Dropdown Example from Advanced Move node:

"value": {
    "default": "kReplace",
    "options": {
        "Replace": "kReplace",
        "Add": "kAdd",
        "Multiply": "kMultiply"
    }
}

Example for a Vector3D attribute (leaving the X and Z values blank with null):
“value”: [null, 20, null]

sliderMin
sliderMax
sliderStepSize
sliderDefaultValue
Required fields for a Slider type attribute. sliderMin and sliderMax define the range of the slider, sliderStepSize defines the increment of the slider, and sliderDefaultValue defines the initial value of the slider. Example of a Slider attribute:

{
    "name": "My Slider",
    "type": "Slider",
    "connection": "None",
    "editable": true,
    "sliderMin": 0,
    "sliderMax": 10,
    "sliderStepSize": 2,
    "sliderDefaultValue": 2
}

script

"script":"

Anything you put in this string will be inserted into the Script section of the Node. Since it’s all defined within a string, make sure to use single quotes (‘) instead of double quotes (“) to avoid terminating the string early.

If you save your .bbnode file as a .json file and use a program that has syntax highlighting (such as Visual Studio Code), this section will highlight with errors. This is because normal JSON doesn’t allow multiline strings; this is an area where the .bbnode format differs from JSON.

Here’s another script example, this time from the Jump node. This code snippet is entirely contained within the “script”: ” … ” section of the Jump.bbnode file.

    //Input Signal variables
    let _enabled = true;

    //Node attribute variables
    let _jumpLimit;
    let _jumpForce;

    //working variables
    let _physics;
    let _jumpCount = 0;

    function init(){
        //get the node attributes
        _jumpForce = this.attribute('Jump Force');
        _jumpLimit = this.attribute('Jump Limit');
    
        //Get and check the Physics status of this entity
        _physics = this.entity().physics();
        if(_physics && _physics.type() != 'kDynamic'){
            warning('Jump Node only works with [Dynamic] bodies. Enabling by default');

            _physics.setType('kDynamic');
        }
    }

    function start(){

    }

    function update(dt){

    }

    function signal(name, value){
        //Check the incoming signals
        if(name == 'Jump' && value){
            //check we have dynamic physics on the entity
            if(_physics){
                //check here if the signal to jump again is valid
                //we need to check we are with the jump limit
                if(_jumpLimit == 0 || _jumpCount < _jumpLimit){
                    //calculate the jump force to be applied
                    let vel = _physics.linearVelocity();
                    if(_jumpForce.x != null){
                        vel.x = _jumpForce.x;
                    }
                    if(_jumpForce.y != null){
                        vel.y = _jumpForce.y;
                    }
                    if(_jumpForce.z != null){
                        vel.z = _jumpForce.z;
                    }
                    
                    //apply the jump velocity
                    _physics.setLinearVelocity( vel.x, vel.y, vel.z );

                    //track the jump count
                    _jumpCount++;
                }
            }
        }
        else if(name == 'Reset' && value){
            //Signal to reset the jump so we just reset the 
            //jumpcount variable
            _jumpCount = 0;
        }
    }

Import a Node

To import a node into BuildBox, drag it from your file explorer into the mind map of the Entity you’d like to add it to. Voilà!

Troubleshooting

If you drag your .bbnode into the mind map and nothing happens, that probably means there’s a typo somewhere.

– Make sure that each attribute includes all the required fields.
– Make sure that you have no trailing commas.
– A JSON Validator will give you errors based on the Script section, because as noted above, JSON doesn’t normally allow multiline strings. You can try pasting your .bbnode contents into a JSON Validator and then deleting the script section to look for errors elsewhere.

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?

Set Visibility Node – Buildbox 3 Manual

By |

Set Visibility Node

This action node shows or hides all of the asset’s 3D models and images.

The Apply input sets the asset’s visibility as specified in the Visible attribute.

When this node makes the asset invisible, all collision shapes and other functionalities are still present in the scene.

Node Attributes

Option Description
Name Type a custom name for this node, if needed.
Visible Select to change the visibility of the asset. Clear to make the asset invisible.

If needed, you can also customize this node. For details, see Customizing Nodes.

Health Brainbox – Buildbox 3 Manual

By |

Health Brainbox

This Brainbox adds health to an asset, making it damaged when it collides with other assets. If the asset is defeated, this brainbox ends the game.

After this asset collides with another object, it subtracts 1 point from the health amount, and the damage is indicated by a white flash on its surface. After the health reaches 0, a game over event is triggered which pauses the game world. For details on creating a Game Over screen see UI Nodes.

Brainbox Attributes

After you add this Brainbox to an asset, you need to specify which asset will cause damage by changing the Affected Asset attribute.

Attribute Description
Health Enter the amount of times you want this asset to take damage before it becomes defeated.
Delay Enter the amount of seconds you want to wait after the asset is defeated before the game over event is triggered.
Affected Asset Select which asset or type of asset you want to cause damage.

Nodes in Brainbox group

After you add this Brainbox to an asset, a Collision (If Collide) node, Custom Damage node, Defeat node, Delay Defeat Animation, and Event Observer node are added to the Node Map.