STEP 9: Connecting States with Links
Now that you’ve created the Sliding action, it currently isn’t connected to any other state, meaning it can’t be used yet.
Let’s create a link from the [Move]
state to [Sliding]
.
1. Right-click the [Move]
state and select “Add Link.”
2. A line will appear—drag it to the [Sliding]
state and left-click.
You should now see a connection line from [Move]
to [Sliding]
.
3. Let’s set a condition for the transition.
Click the link you just created and look at the [Inspector] window.
Enable the “On Input” property.
A new input box will appear. Expand the Array[InputCondition]
section and click “+ Add Input”.
4. A new entry named <Empty>
will appear.
Click it and choose “New InputCondition.”
5. The entry will now show InputCondition
.
Click it again to expand it and configure the key input as shown below.
Set the input to Button B (which corresponds to the X key on the keyboard).
Now, the transition from [Move]
to [Sliding]
will occur when B is pressed during movement.
6. At this point, the player can slide—but there’s no way to exit the Sliding state.
Without a return path, the player would remain in the sliding state forever.
Let’s create a link from [Sliding]
to [Idle]
.
Right-click the [Sliding]
state and select “Add Link,” then connect it to the [Idle]
state on the right.
Note about shortcut states:
You may notice there are two [Idle]
states visible—one on the left and one on the right.
These are the same state. The one on the right is a shortcut, indicated by the
icon.

Visual script links always flow left to right, so shortcuts help avoid messy “spaghetti” connections when linking back to earlier states.
7. Now let’s use a non-input condition for the transition.
In the Inspector for the new link from [Sliding]
to [Idle]
, expand Array[Conditions]
under “Other Conditions,” and click “+ Add Condition.”
8. In the popup window, choose “Elapsed Time” and set it to 0.3 seconds.
This condition is near the bottom, so feel free to search for it.
Click the Add button to confirm.
9. Now test your setup using the
button or F5.
If everything is set correctly:
- Pressing X during movement will trigger the Sliding state.
- After 0.3 seconds, it will return to Idle.
- If you hold the movement key, it may immediately transition back to Move.
Troubleshooting Tips
If something isn’t working:
- The transition only works from
[Move]
. Pressing X while in [Idle]
or [Jump]
won’t trigger sliding.
- If pressing X doesn’t work, double-check the link from
[Move]
to [Sliding]
.
- If the transition happens but nothing plays, check the animation and action settings in the
[Sliding]
state.
- If the player doesn’t return from sliding, verify the
[Sliding] → [Idle]
link and its condition.
Done!
You’ve successfully created a working action using visual scripting.
Now that you know the basics, feel free to:
- Adjust speed or duration for a better feel.
- Add sound effects or voice using the “Play Sound” action.
- Connect
[Idle]
→ [Sliding]
to allow sliding from a standstill.
- Try linking from
[Jump]
or [Fall]
to create aerial slides (remember to return to Landing
, not Idle
, or the character won’t land properly).
Exiting the Visual Script View
To exit the script and return to normal editing, switch to the [2D] tab at the top of the screen.
Final Tips
Action creation is all about combining transitions and conditions.
You can learn a lot by examining how other sample objects use their scripts.
Important:
When opening a visual script, make sure the correct object tab is active.
Godot allows scripts to be opened from any tab, but visual script settings like animation or variables rely on the active tab. Otherwise, some settings might not work properly.