DreamBall/index.tscn

277 lines
8.7 KiB
Text
Raw Normal View History

2025-02-23 00:46:23 +01:00
[gd_scene load_steps=9 format=3 uid="uid://ccgnnif026wb4"]
[sub_resource type="GDScript" id="GDScript_8n212"]
script/source = "extends Node
var seconds_spent: float = 0.0
var base = preload(\"res://levels/base/level.tscn\")
var forest = preload(\"res://levels/forest/level.tscn\")
func start_level(level_scene: PackedScene) -> void:
if level_scene and level_scene.can_instantiate():
AudioServer.set_bus_volume_db(0, 0)
var level = level_scene.instantiate()
$Levels.add_child(level)
$Timer.paused = false
else:
assert(false, \"NO LEVEL AAAA\")
func stop_level() -> void:
$Timer.paused = true
AudioServer.set_bus_volume_db(0, -5)
await get_tree().create_timer(0.5).timeout
AudioServer.set_bus_volume_db(0, -10)
await get_tree().create_timer(0.5).timeout
AudioServer.set_bus_volume_db(0, -30)
await get_tree().create_timer(0.5).timeout
AudioServer.set_bus_volume_db(0, -50)
await get_tree().create_timer(0.5).timeout
var current_levels = $Levels.get_children(true)
var current_level = current_levels[0]
var next_level: PackedScene
if current_level.name == \"Base\":
next_level = forest
for level in current_levels:
level.queue_free()
start_level(next_level)
func _on_btn_fullscreen_pressed() -> void:
var fs = DisplayServer.window_get_mode()
if fs != DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED)
func _on_btn_start_pressed() -> void:
$StartMenu/AnimationPlayer.play(\"fadeout\")
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
start_level(base)
$Timer.start()
func _on_animation_player_animation_finished(_anim_name: StringName) -> void:
$StartMenu.hide()
func _on_timer_timeout() -> void:
seconds_spent = snapped(seconds_spent + 0.10, 0.01)
var minutes = floor(seconds_spent / 60)
$TimerDisplay.text = (\"%0*d\" % [2, minutes]) + \":\" + (\"%0*.1f\" % [4, seconds_spent - (minutes * 60)])
"
[sub_resource type="LabelSettings" id="LabelSettings_0jegv"]
font_size = 32
shadow_size = 2
shadow_color = Color(0, 0, 0, 1)
shadow_offset = Vector2(0, 0)
[sub_resource type="LabelSettings" id="LabelSettings_nbp4i"]
font_size = 24
shadow_size = 2
shadow_color = Color(0, 0, 0, 1)
shadow_offset = Vector2(0, 0)
[sub_resource type="LabelSettings" id="LabelSettings_5jdmh"]
font_size = 20
shadow_size = 2
shadow_color = Color(0, 0, 0, 1)
shadow_offset = Vector2(0, 0)
[sub_resource type="Animation" id="Animation_75r06"]
resource_name = "fadeout"
step = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_glb01"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5cb2g"]
_data = {
"RESET": SubResource("Animation_glb01"),
"fadeout": SubResource("Animation_75r06")
}
[sub_resource type="LabelSettings" id="LabelSettings_0s07t"]
font_size = 64
outline_size = 10
outline_color = Color(0, 0, 0, 1)
2025-02-21 21:47:35 +01:00
2025-02-22 00:19:28 +01:00
[node name="Game" type="Node"]
2025-02-23 00:46:23 +01:00
script = SubResource("GDScript_8n212")
[node name="StartMenu" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="StartMenu"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.546428, 0.471262, 0.491244, 1)
[node name="VBoxContainer" type="VBoxContainer" parent="StartMenu"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Presentation" type="MarginContainer" parent="StartMenu/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="StartMenu/VBoxContainer/Presentation"]
layout_mode = 2
[node name="Title" type="Label" parent="StartMenu/VBoxContainer/Presentation/VBoxContainer"]
layout_mode = 2
text = "DreamBall"
label_settings = SubResource("LabelSettings_0jegv")
horizontal_alignment = 1
[node name="Title2" type="Label" parent="StartMenu/VBoxContainer/Presentation/VBoxContainer"]
layout_mode = 2
text = "A game about changing gravity to make a ball fly through the air"
label_settings = SubResource("LabelSettings_nbp4i")
horizontal_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="StartMenu/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="HBoxContainer" type="HBoxContainer" parent="StartMenu/VBoxContainer/MarginContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Rules" type="VBoxContainer" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
alignment = 2
[node name="Label" type="Label" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Rules"]
layout_mode = 2
text = "- Change the direction of the gravity with the ARROW KEYS"
[node name="Label2" type="Label" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Rules"]
layout_mode = 2
text = "- Keep LEFT SHIFT pressed to make the gravity stronger"
[node name="Label3" type="Label" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Rules"]
layout_mode = 2
text = "- Press ESCAPE to pause and unpause the game at any point"
[node name="Label4" type="Label" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Rules"]
layout_mode = 2
text = "- Press R to restart the current level from the beginning
(note that it won't reset the timer!)"
[node name="Buttons" type="VBoxContainer" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
alignment = 2
[node name="Label5" type="Label" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Buttons"]
layout_mode = 2
text = "Do your best to make the ball go through all the rings!"
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Buttons"]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 1
[node name="Btn_Fullscreen" type="Button" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Buttons/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
action_mode = 0
text = "Toggle FULLSCREEN"
[node name="Btn_Start" type="Button" parent="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Buttons/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
text = "START the game!"
[node name="Notice" type="MarginContainer" parent="StartMenu/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="Title3" type="Label" parent="StartMenu/VBoxContainer/Notice"]
layout_mode = 2
text = "Made during the 21st edition of Alakajam!"
label_settings = SubResource("LabelSettings_5jdmh")
horizontal_alignment = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="StartMenu"]
libraries = {
"": SubResource("AnimationLibrary_5cb2g")
}
[node name="Levels" type="Node" parent="."]
[node name="TimerDisplay" type="Label" parent="."]
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -88.0
offset_right = 246.0
grow_vertical = 0
text = "00:00.0"
label_settings = SubResource("LabelSettings_0s07t")
horizontal_alignment = 1
vertical_alignment = 2
[node name="Timer" type="Timer" parent="."]
wait_time = 0.1
[connection signal="pressed" from="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Buttons/HBoxContainer/Btn_Fullscreen" to="." method="_on_btn_fullscreen_pressed"]
[connection signal="pressed" from="StartMenu/VBoxContainer/MarginContainer/HBoxContainer/Buttons/HBoxContainer/Btn_Start" to="." method="_on_btn_start_pressed"]
[connection signal="animation_finished" from="StartMenu/AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]