Line2D
Draw 2D lines with customizable width, color, gradient, and texture. Create ropes, lasers, trails, and visual connections.
2D
No shortcutBeginner8 min readQuick Reference
Line2D
Godot EngineKeyboard Shortcut
N/A
Where to Find
Scene dock — Create New Node > Node2D category
Best Used For
- ▸Create 2D game elements and environments
- ▸Build parallax scrolling backgrounds
- ▸Design UI components and HUD elements
Beginner-Friendly⏱ 15–30 minutes to master
Key Settings
Add:Width:Color:Joint mode:
Line2D draws 2D lines with customizable width, color, and texture. It supports gradients along the line, rounded or sharp joints, and can be updated dynamically for effects like lasers and trails.
Where to Find It
Found under Node2D in Create New Node dialog.
How to Use
- Add: Add Line2D and set points in the Inspector or via code.
- Width: Adjust Width for line thickness. Use Gradient to vary width.
- Color: Set default color or use Gradient for multi-color lines.
- Joint mode: Choose Sharp, Bevel, or Round for corner connections.
Pro Tips
- Update points dynamically in _process() for laser beams and grappling hooks.
- Use a Gradient with transparency at the ends for fade-out effects.