In Depth Behavior Explanation

Flowlab uses a unique way of creating games through things called Behaviors. These can be tricky to understand at times, but this will give an in depth explanation in how all the Behaviors work.

(This resource was created by Expert Flowlab user CodeAlpaca with pieces from the Behavior Handbook)

(This resource is unfinished. When completed it will contain a detailed list of how each behavior works and an example of how to use the behavior in a practical manner)

### Things to know

The white circle(s) on the left (Surrounded by red) will be referred to as "Input(s)".

The white circle(s) on the right (Surrounded by blue) will be referred to as "Output(s)".

The word in the top left (Surrounded by green) is the Behaviors name.

The word(s) on the left side (Surrounded by yellow) is the Input name.

The word(s) on the right side (Surrounded by yellow) is the Output name.

Behavior refers to the the grey square that the above features are apart of.

## Triggers

Triggers are Behaviors that start without any other behaviors to activate them. What this means is that you will use these to start off your code.

(Note: Excluding the Timer Behavior, Triggers have no Inputs)

#### **Once**

The Once behavior Outputs once when the game starts. This means that as the game runs it will only Output at the start of the game, or when Object is added to the level.

The option "Reset on level start" is only available when the Object containing the Behavior has the "Keep between levels" or "Keep on level restart" option selected. When "Reset on level start" is selected, whenever the Object enters a new level or the level restarts, the Once Behavior will Output again. If "Reset on level start" is not selected, the Once Behavior will not Output when the Object enters a new level or restarts the current one.

The value the Output gives is equal to "1".

This Behavior is useful for things that need to happen right when the game starts, like music playing.

#### **Always**

The Always Behavior gives an Output ever frame the game is running. That means that if your game is running at 30 FPS (Frames per second) then the Behavior will be sending out a value of "1" 30 times a second.

If the game is running slow that means that the Behavior may Output less times a second.

This Behavior is useful for things that need to continue to happen every frame like increasing/decreasing a value.

#### **Timer**

The Timer Behavior activates after a specific amount of delay. The number you set the delay as is equal to 0.1 seconds, so if the delay property is set to 50 it will give you an Output after 5 seconds.

Repeat Forever will cause the Behavior to Output after the set amount of time forever (If the delay is set to 10 the timer will output once every second forever)

Repeats are the number of times you want the Timer to Output before stopping. (Cannot be selected if "Repeat Forever" is selected)

The Timer behavior has 3 Inputs.

The Start Input will activate the Timer (If the Timer is connected to another Behavior and has nothing in its Start Input then the Timer will start automatically)

The Reset Input will stop the timer, and set its repeated count back to zero. For example: if the timer’s repeat count property is set to "10" but it has already activated 5 times, then it has only 5 loops left before it will stop running. If the Reset input is activated, then the timer is stopped, and the next time it starts it will run 10 times.

The Delay Input will set the Timers Delay to whatever the Input value is.

(Note: The Timer Behavior will still activate even if the game is paused. The Timer will also always activate after the set number of time, it does not slow down if the game is lagging (If the time is set to a small number like 0.1 it will Output less due the game lagging, meaning it can only Output less)

#### **Mouse Click**

The Mouse Click Behavior is used to detect when the mouse left clicks or right clicks the screen.

If "Left Click" is selected the Down Output will activate when the Object with the Behavior is left clicked.

If "Right Click" is selected the Down Output will activate when the Object with the Behavior is right clicked.

If "Capture Clicks Anywhere" is selected the Down Output will activate whenever the game screen is clicked.

The Down Output will activate when the screen is clicked, or if the screen is touched (For mobile or other touch screen devices).

The Up Output will activate when the mouse is released, or when the screen is not longer touched (For mobile or other touch screen devices).

The Over Output will activate when the mouse pointer hovers over the object, or when the player drags their finger onto the object on mobile.

The Out Output will when the mouse pointer leaves the object, or when the player drags their finger out of the object on mobile.

#### **Mouse Move**

The Mouse Move Behavior captures the position of the mouse pointer