Skip to content

Instantly share code, notes, and snippets.

@BrastenXBL
Created May 3, 2025 21:57
Show Gist options
  • Save BrastenXBL/0f28bd84f46ad8c0a0bf7867915f4d1a to your computer and use it in GitHub Desktop.
Save BrastenXBL/0f28bd84f46ad8c0a0bf7867915f4d1a to your computer and use it in GitHub Desktop.
Very simple looping BoxContainer Godot 4.4.1
[gd_scene load_steps=11 format=3]
[sub_resource type="GDScript" id="GDScript_oklhg"]
script/source = "extends VBoxContainer
func _on_forward_button_pressed():
move_child(get_child(0),-1)
func _on_back_button_pressed():
move_child(get_child(-1),0)
"
[sub_resource type="Gradient" id="Gradient_oklhg"]
[sub_resource type="GradientTexture2D" id="GradientTexture2D_ouu4r"]
gradient = SubResource("Gradient_oklhg")
[sub_resource type="GradientTexture2D" id="GradientTexture2D_0rfyq"]
gradient = SubResource("Gradient_oklhg")
fill_to = Vector2(1, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_i8fb8"]
gradient = SubResource("Gradient_oklhg")
fill_from = Vector2(1, 0)
fill_to = Vector2(0, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_soocj"]
gradient = SubResource("Gradient_oklhg")
fill_from = Vector2(1, 1)
fill_to = Vector2(0, 0)
[sub_resource type="GDScript" id="GDScript_ouu4r"]
script/source = "extends HBoxContainer
func _on_forward_button_pressed():
move_child(get_child(0),-1)
func _on_back_button_pressed():
move_child(get_child(-1),0)
"
[sub_resource type="Gradient" id="Gradient_ouu4r"]
[sub_resource type="GradientTexture2D" id="GradientTexture2D_ull2c"]
gradient = SubResource("Gradient_ouu4r")
fill = 2
fill_from = Vector2(0, 0.5)
fill_to = Vector2(1, 0.5)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_7r0j2"]
gradient = SubResource("Gradient_ouu4r")
fill = 2
fill_from = Vector2(1, 0.5)
fill_to = Vector2(0, 0.5)
[node name="LoopingBoxContainers" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_lock_ = true
[node name="Panel" type="Panel" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.25
anchor_top = 0.25
anchor_right = 0.75
anchor_bottom = 0.75
grow_horizontal = 2
grow_vertical = 2
[node name="WrappingV" type="PanelContainer" parent="Panel"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.03125
anchor_top = 0.1
anchor_right = 0.331597
anchor_bottom = 0.927161
metadata/_edit_use_anchors_ = true
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/WrappingV"]
layout_mode = 2
script = SubResource("GDScript_oklhg")
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/WrappingV/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/WrappingV/VBoxContainer/HBoxContainer"]
layout_mode = 2
texture = SubResource("GradientTexture2D_ouu4r")
[node name="Label" type="Label" parent="Panel/WrappingV/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Placeholder 1"
[node name="HBoxContainer2" type="HBoxContainer" parent="Panel/WrappingV/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/WrappingV/VBoxContainer/HBoxContainer2"]
layout_mode = 2
texture = SubResource("GradientTexture2D_0rfyq")
[node name="Label" type="Label" parent="Panel/WrappingV/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Placeholder 2"
[node name="HBoxContainer3" type="HBoxContainer" parent="Panel/WrappingV/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/WrappingV/VBoxContainer/HBoxContainer3"]
layout_mode = 2
texture = SubResource("GradientTexture2D_i8fb8")
[node name="Label" type="Label" parent="Panel/WrappingV/VBoxContainer/HBoxContainer3"]
layout_mode = 2
text = "Placeholder 3"
[node name="HBoxContainer4" type="HBoxContainer" parent="Panel/WrappingV/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/WrappingV/VBoxContainer/HBoxContainer4"]
layout_mode = 2
texture = SubResource("GradientTexture2D_soocj")
[node name="Label" type="Label" parent="Panel/WrappingV/VBoxContainer/HBoxContainer4"]
layout_mode = 2
text = "Placeholder 4"
[node name="WrappingH" type="PanelContainer" parent="Panel"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.1
anchor_right = 0.9
anchor_bottom = 0.3
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/WrappingH"]
layout_mode = 2
script = SubResource("GDScript_ouu4r")
[node name="TextureRect" type="TextureRect" parent="Panel/WrappingH/HBoxContainer"]
layout_mode = 2
texture = SubResource("GradientTexture2D_ouu4r")
[node name="TextureRect2" type="TextureRect" parent="Panel/WrappingH/HBoxContainer"]
layout_mode = 2
texture = SubResource("GradientTexture2D_0rfyq")
[node name="TextureRect3" type="TextureRect" parent="Panel/WrappingH/HBoxContainer"]
layout_mode = 2
texture = SubResource("GradientTexture2D_i8fb8")
[node name="TextureRect4" type="TextureRect" parent="Panel/WrappingH/HBoxContainer"]
layout_mode = 2
texture = SubResource("GradientTexture2D_soocj")
[node name="ButtonsContainer" type="HBoxContainer" parent="Panel"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.717014
anchor_top = 0.743827
anchor_right = 0.973958
anchor_bottom = 0.966049
grow_horizontal = 0
grow_vertical = 0
metadata/_edit_use_anchors_ = true
[node name="BackButton" type="Button" parent="Panel/ButtonsContainer"]
layout_mode = 2
icon = SubResource("GradientTexture2D_ull2c")
[node name="Label" type="Label" parent="Panel/ButtonsContainer/BackButton"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -23.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/outline_size = 4
text = "Back"
horizontal_alignment = 1
[node name="ForwardButton" type="Button" parent="Panel/ButtonsContainer"]
layout_mode = 2
icon = SubResource("GradientTexture2D_7r0j2")
[node name="Label" type="Label" parent="Panel/ButtonsContainer/ForwardButton"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -23.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/outline_size = 4
text = "Forward"
horizontal_alignment = 1
[node name="ClippedWrapping" type="Control" parent="Panel"]
clip_children = 1
clip_contents = true
layout_mode = 1
anchor_left = 0.34375
anchor_top = 0.305556
anchor_right = 0.651042
anchor_bottom = 0.712963
metadata/_edit_use_anchors_ = true
[node name="Panel" type="Panel" parent="Panel/ClippedWrapping"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/ClippedWrapping"]
clip_contents = true
layout_mode = 1
anchors_preset = -1
anchor_top = -0.5
offset_right = 177.408
offset_bottom = 268.0
script = SubResource("GDScript_oklhg")
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/ClippedWrapping/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer"]
layout_mode = 2
texture = SubResource("GradientTexture2D_ouu4r")
[node name="Label" type="Label" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Placeholder 1"
[node name="HBoxContainer2" type="HBoxContainer" parent="Panel/ClippedWrapping/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer2"]
layout_mode = 2
texture = SubResource("GradientTexture2D_0rfyq")
[node name="Label" type="Label" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "Placeholder 2"
[node name="HBoxContainer3" type="HBoxContainer" parent="Panel/ClippedWrapping/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer3"]
layout_mode = 2
texture = SubResource("GradientTexture2D_i8fb8")
[node name="Label" type="Label" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer3"]
layout_mode = 2
text = "Placeholder 3"
[node name="HBoxContainer4" type="HBoxContainer" parent="Panel/ClippedWrapping/VBoxContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer4"]
layout_mode = 2
texture = SubResource("GradientTexture2D_soocj")
[node name="Label" type="Label" parent="Panel/ClippedWrapping/VBoxContainer/HBoxContainer4"]
layout_mode = 2
text = "Placeholder 4"
[connection signal="pressed" from="Panel/ButtonsContainer/BackButton" to="Panel/WrappingV/VBoxContainer" method="_on_back_button_pressed"]
[connection signal="pressed" from="Panel/ButtonsContainer/BackButton" to="Panel/WrappingH/HBoxContainer" method="_on_back_button_pressed"]
[connection signal="pressed" from="Panel/ButtonsContainer/BackButton" to="Panel/ClippedWrapping/VBoxContainer" method="_on_back_button_pressed"]
[connection signal="pressed" from="Panel/ButtonsContainer/ForwardButton" to="Panel/WrappingV/VBoxContainer" method="_on_forward_button_pressed"]
[connection signal="pressed" from="Panel/ButtonsContainer/ForwardButton" to="Panel/WrappingH/HBoxContainer" method="_on_forward_button_pressed"]
[connection signal="pressed" from="Panel/ButtonsContainer/ForwardButton" to="Panel/ClippedWrapping/VBoxContainer" method="_on_forward_button_pressed"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment