Compare commits

..

No commits in common. "master" and "20250503.0" have entirely different histories.

38 changed files with 361 additions and 1356 deletions

View file

@ -1,3 +0,0 @@
# DreamBall
Initially a [game made for a gamejam](https://alakajam.com/21st-alakajam/1601/dreamball/), DreamBall is a video game that has seen development happening for a couple of months after the gamejam has ended to add missing features and quality of life improvements.

1
README.txt Normal file
View file

@ -0,0 +1 @@
This is the source code for a game built with Godot Engine for the 21st edition of Alakajam: https://alakajam.com/21st-alakajam

View file

@ -11,10 +11,8 @@ var velocity := 0.0:
if value != velocity: if value != velocity:
velocity_change.emit(value) velocity_change.emit(value)
velocity = value velocity = value
@onready var ball_position: Vector3 = $Sphere.position
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
ball_position = $Sphere.position
$SpotLightMain.position = $Sphere.position + Vector3(0, 5, 0) $SpotLightMain.position = $Sphere.position + Vector3(0, 5, 0)
$SpotLightTop.position = $Sphere.position $SpotLightTop.position = $Sphere.position
$SpotLightLeft.position = $Sphere.position $SpotLightLeft.position = $Sphere.position

View file

@ -82,8 +82,8 @@ application/icon_interpolation=4
application/file_version="" application/file_version=""
application/product_version="" application/product_version=""
application/company_name="" application/company_name=""
application/product_name="DreamBall" application/product_name=""
application/file_description="Manipulate the gravity to make a ball go through every ring!" application/file_description="Entry for the 21st Alakajam!"
application/copyright="" application/copyright=""
application/trademarks="" application/trademarks=""
application/export_angle=0 application/export_angle=0

Binary file not shown.

View file

@ -1,35 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://b1y3v45qjku1w"
path="res://.godot/imported/Galindo-Regular.ttf-d19a5a025e54556959a3f470847ddd23.fontdata"
[deps]
source_file="res://fonts/Galindo/Galindo-Regular.ttf"
dest_files=["res://.godot/imported/Galindo-Regular.ttf-d19a5a025e54556959a3f470847ddd23.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View file

@ -1,94 +0,0 @@
Copyright (c) 2012, Brian J. Bonislawsky DBA Astigmatic (AOETI) (astigma@astigmatic.com), with Reserved Font Names "Galindo"
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bf0odjoblnqcv"
path="res://.godot/imported/ball.png-7feb407e6aaca008dfa0a4e9547013e6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/ball.png"
dest_files=["res://.godot/imported/ball.png-7feb407e6aaca008dfa0a4e9547013e6.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bg2vn10rj02ix"
path="res://.godot/imported/indicator.png-6ddfee0e96a03af99065702c83dd54be.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/indicator.png"
dest_files=["res://.godot/imported/indicator.png-6ddfee0e96a03af99065702c83dd54be.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -1,188 +0,0 @@
[gd_scene load_steps=7 format=3 uid="uid://bcxbw6wd54ksv"]
[ext_resource type="Texture2D" uid="uid://bf0odjoblnqcv" path="res://graphics/ball.png" id="1_eqtee"]
[ext_resource type="Texture2D" uid="uid://bg2vn10rj02ix" path="res://graphics/indicator.png" id="2_oi3f3"]
[sub_resource type="GDScript" id="GDScript_r4thc"]
script/source = "extends Control
var zoom := 1.0:
get: return zoom
set(value):
zoom = value
self.scale = Vector2(value, value)
func _ready() -> void:
$TemplateRing.hide()
func display_rings(player: Node3D, rings: Array[Ring]) -> void:
$Ball.rotation += 0.1
$Indicator.rotation -= 0.05
if !$Indicator/AnimationPlayer.is_playing():
$Indicator/AnimationPlayer.play(\"shine\")
var player_position: Vector3 = player.ball_position + player.position
rings = rings.filter(func(r: Ring): return r.position.z == player.position.z)
rings.sort_custom(func(r1: Ring, r2: Ring):
var p1: float = abs(r1.position.x - player_position.x) + abs(r1.position.y - player_position.y)
var p2: float = abs(r2.position.x - player_position.x) + abs(r2.position.y - player_position.y)
return p1 > p2
)
var old_rings_display := $Rings.get_children()
var difference := len(rings) - len(old_rings_display)
# Too many displayed, free them
for i in -difference:
old_rings_display[-(1 + i)].queue_free()
# Not enough displayed, create some
for i in difference:
var new_child := $TemplateRing.duplicate()
new_child.show()
$Rings.add_child(new_child)
var rings_display := $Rings.get_children()
var center: Vector2i = get_viewport().size / 2
for i in len(rings):
rings_display[i].color = rings[i].material.albedo_color
rings_display[i].rotation = -rings[i].rotation.z
rings_display[i].position.x = center.x + rings[i].position.x - player_position.x
rings_display[i].position.y = center.y - rings[i].position.y + player_position.y
if rings[i].collected:
rings_display[i].scale = $TemplateRing.scale * 2 * min(4, max(1, rings[i].scale.x))
rings_display[i].z_index = 0
else:
rings_display[i].scale = $TemplateRing.scale * 3 * min(4, max(1, rings[i].scale.x))
rings_display[i].z_index = 1
func _on_item_rect_changed() -> void:
self.pivot_offset = self.size / 2
"
[sub_resource type="Animation" id="Animation_32con"]
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="Animation" id="Animation_oi3f3"]
resource_name = "shine"
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, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_t3jqn"]
_data = {
&"RESET": SubResource("Animation_32con"),
&"shine": SubResource("Animation_oi3f3")
}
[node name="Map" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_r4thc")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.174508, 2.12678e-05, 0.174507, 0.498039)
[node name="Rings" type="Control" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Ball" type="TextureRect" parent="."]
z_index = 2
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -10.0
offset_top = -10.0
offset_right = 10.0
offset_bottom = 10.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.5, 0.5)
pivot_offset = Vector2(10, 10)
texture = ExtResource("1_eqtee")
[node name="Indicator" type="TextureRect" parent="."]
z_index = 2
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -100.0
offset_top = -100.0
offset_right = 100.0
offset_bottom = 100.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.5, 0.5)
pivot_offset = Vector2(100, 100)
texture = ExtResource("2_oi3f3")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Indicator"]
libraries = {
&"": SubResource("AnimationLibrary_t3jqn")
}
[node name="TemplateRing" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -2.0
offset_top = -2.0
offset_right = 3.0
offset_bottom = 3.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(2.5, 2.5)
color = Color(0, 0, 0, 1)
[node name="ColorRect" type="ColorRect" parent="TemplateRing"]
layout_mode = 0
offset_left = 1.0
offset_top = 2.0
offset_right = 4.0
offset_bottom = 3.0
[connection signal="item_rect_changed" from="." to="." method="_on_item_rect_changed"]

View file

@ -1,11 +1,10 @@
[gd_scene load_steps=8 format=3 uid="uid://ccgnnif026wb4"] [gd_scene load_steps=7 format=3 uid="uid://ccgnnif026wb4"]
[ext_resource type="PackedScene" uid="uid://xd3nsiglcdfc" path="res://gui/timer.tscn" id="1_356j3"] [ext_resource type="PackedScene" uid="uid://xd3nsiglcdfc" path="res://gui/timer.tscn" id="1_356j3"]
[ext_resource type="PackedScene" uid="uid://dw0xl8644x166" path="res://gui/gravity.tscn" id="1_ir7so"] [ext_resource type="PackedScene" uid="uid://dw0xl8644x166" path="res://gui/gravity.tscn" id="1_ir7so"]
[ext_resource type="PackedScene" uid="uid://cckeamgkt8bqo" path="res://gui/speed.tscn" id="2_2gn6w"] [ext_resource type="PackedScene" uid="uid://cckeamgkt8bqo" path="res://gui/speed.tscn" id="2_2gn6w"]
[ext_resource type="PackedScene" uid="uid://bcxbw6wd54ksv" path="res://gui/map.tscn" id="2_d1yoc"]
[ext_resource type="PackedScene" uid="uid://cn55m5dqo3m6u" path="res://gui/rings.tscn" id="3_mbj17"] [ext_resource type="PackedScene" uid="uid://cn55m5dqo3m6u" path="res://gui/rings.tscn" id="3_mbj17"]
[ext_resource type="PackedScene" uid="uid://dkxtwpcy4moyo" path="res://menus/pause/pause_menu.tscn" id="4_3bfj3"] [ext_resource type="PackedScene" uid="uid://dkxtwpcy4moyo" path="res://menus/pause_menu.tscn" id="4_3bfj3"]
[sub_resource type="GDScript" id="GDScript_8n212"] [sub_resource type="GDScript" id="GDScript_8n212"]
script/source = "extends Node script/source = "extends Node
@ -20,7 +19,6 @@ var current_level_scene: PackedScene
const res_main_menu = preload(\"res://menus/main/main_menu.tscn\") const res_main_menu = preload(\"res://menus/main/main_menu.tscn\")
@onready var gui_gravity := $GUI/Gravity @onready var gui_gravity := $GUI/Gravity
@onready var gui_map := $GUI/Map
@onready var gui_timer := $GUI/TopLeft/Timer @onready var gui_timer := $GUI/TopLeft/Timer
@onready var gui_speed := $GUI/TopRight/Speed @onready var gui_speed := $GUI/TopRight/Speed
@onready var gui_rings := $GUI/BottomRight/Rings @onready var gui_rings := $GUI/BottomRight/Rings
@ -37,8 +35,8 @@ func _ready() -> void:
## Connect to necessary signals ## Connect to necessary signals
pause_menu.connect(\"request_pause\", pause_game) pause_menu.connect(\"request_pause\", pause_game)
pause_menu.connect(\"request_fullscreen\", fullscreen_game)
pause_menu.connect(\"request_restart\", restart_level) pause_menu.connect(\"request_restart\", restart_level)
pause_menu.connect(\"request_quit\", quit_current_level)
set_main_menu() set_main_menu()
@ -96,18 +94,6 @@ func finish_current_level() -> void:
set_main_menu() set_main_menu()
func quit_current_level() -> void:
gui_timer.enabled = false
PhysicsServer3D.area_set_param(get_viewport().find_world_3d().space, PhysicsServer3D.AREA_PARAM_GRAVITY, 0.5)
playing = false
changing_level = true
pause_menu.hide()
SaveFiles.change_property(\"played_for\", gui_timer.seconds_spent_total, SaveFiles.selected_file)
if is_instance_valid(current_level):
current_level.queue_free()
set_main_menu()
func restart_level() -> void: func restart_level() -> void:
gui_timer.enabled = false gui_timer.enabled = false
if !current_level or changing_level: if !current_level or changing_level:
@ -127,7 +113,6 @@ func pause_game(to_pause: bool) -> void:
current_level.process_mode = Node.PROCESS_MODE_DISABLED current_level.process_mode = Node.PROCESS_MODE_DISABLED
playing = false playing = false
pause_menu.show() pause_menu.show()
gui_map.hide()
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else: else:
current_level.process_mode = Node.PROCESS_MODE_INHERIT current_level.process_mode = Node.PROCESS_MODE_INHERIT
@ -145,14 +130,8 @@ func fullscreen_game() -> void:
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if is_instance_valid(current_level): if is_instance_valid(current_level):
gui_speed.ball_velocity = current_level.velocity gui_speed.ball_velocity = current_level.velocity
if Input.is_action_pressed(\"display_map\") and !pause_menu.visible:
gui_map.display_rings(current_level.player, current_level.rings)
func _input(_event: InputEvent) -> void: func _input(_event: InputEvent) -> void:
if Input.is_action_just_released(\"display_map\"):
gui_map.hide()
if Input.is_action_just_pressed(\"display_map\") and !pause_menu.visible:
gui_map.show()
if Input.is_action_just_pressed(\"restart_level\"): if Input.is_action_just_pressed(\"restart_level\"):
restart_level() restart_level()
@ -175,10 +154,6 @@ mouse_filter = 2
[node name="Gravity" parent="GUI" instance=ExtResource("1_ir7so")] [node name="Gravity" parent="GUI" instance=ExtResource("1_ir7so")]
layout_mode = 1 layout_mode = 1
[node name="Map" parent="GUI" instance=ExtResource("2_d1yoc")]
visible = false
layout_mode = 1
[node name="TopLeft" type="MarginContainer" parent="GUI"] [node name="TopLeft" type="MarginContainer" parent="GUI"]
layout_mode = 1 layout_mode = 1
offset_right = 160.0 offset_right = 160.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c0jw333agcvcg"
path="res://.godot/imported/default-thumbnail.png-5734ba05c279cc25b0b55148752708cc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://levels/default-thumbnail.png"
dest_files=["res://.godot/imported/default-thumbnail.png-5734ba05c279cc25b0b55148752708cc.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -17,7 +17,7 @@ func _init() -> void:
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
var moving_ring: Ring = $Rings/Ring18 var moving_ring: Ring = $Rings/Ring18
if self.has_started_playing and !moving_ring.collected: if !moving_ring.collected:
if moving_ring.position.y < 55 or moving_ring.position.y > 65: if moving_ring.position.y < 55 or moving_ring.position.y > 65:
cycle += 1 cycle += 1
moving_ring.position.y += 0.5 if cycle % 2 else -0.5 moving_ring.position.y += 0.5 if cycle % 2 else -0.5

View file

@ -12,7 +12,6 @@ const gravity_strength_strong = gravity_strength_normal * 3
## Lowercase, spaceless name of the level ## Lowercase, spaceless name of the level
var id: String var id: String
var thumbnail: CompressedTexture2D var thumbnail: CompressedTexture2D
var player: Node3D
var music: Music var music: Music
var rings: Array[Ring] = [] var rings: Array[Ring] = []
@ -40,8 +39,6 @@ func _ready() -> void:
for child in children: for child in children:
if is_instance_of(child, Music): if is_instance_of(child, Music):
music = child music = child
if child.name == "Player" and is_instance_of(child, Node3D):
player = child
assert(is_instance_valid(music), self.name + " has no music!") assert(is_instance_valid(music), self.name + " has no music!")
var rings_node = get_node("Rings") var rings_node = get_node("Rings")

BIN
levels/night.mmpz Normal file

Binary file not shown.

View file

@ -1,16 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://dys7qyy4b3gjt"] [gd_scene load_steps=2 format=3 uid="uid://dys7qyy4b3gjt"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="1_164bd"]
[sub_resource type="GDScript" id="GDScript_vfuxb"] [sub_resource type="GDScript" id="GDScript_vfuxb"]
script/source = "extends MainMenuComponent script/source = "extends Control
signal request_start signal request_start
signal request_settings signal request_settings
func _init() -> void:
self.displayed_name = \"Main menu\"
func _on_btn_start_pressed() -> void: func _on_btn_start_pressed() -> void:
request_start.emit() request_start.emit()
@ -18,7 +13,7 @@ func _on_btn_settings_pressed() -> void:
request_settings.emit() request_settings.emit()
func _on_btn_exit_pressed() -> void: func _on_btn_exit_pressed() -> void:
return_to_previous.emit() get_tree().quit()
" "
[node name="InitialMenu" type="Control"] [node name="InitialMenu" type="Control"]
@ -28,31 +23,15 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("1_164bd")
script = SubResource("GDScript_vfuxb") script = SubResource("GDScript_vfuxb")
[node name="ColorRect" type="ColorRect" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
color = Color(0, 0.405339, 0.405339, 1)
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -199.0
offset_top = -82.0
offset_right = 199.0
offset_bottom = 82.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1 alignment = 1
[node name="BtnStart" type="Button" parent="VBoxContainer"] [node name="BtnStart" type="Button" parent="VBoxContainer"]

View file

@ -1,17 +1,12 @@
[gd_scene load_steps=5 format=3 uid="uid://d3b12iqla7uh6"] [gd_scene load_steps=2 format=3 uid="uid://d3b12iqla7uh6"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="1_48hd3"]
[ext_resource type="Texture2D" uid="uid://c0jw333agcvcg" path="res://levels/default-thumbnail.png" id="2_xo3h8"]
[sub_resource type="GDScript" id="GDScript_rmgh7"] [sub_resource type="GDScript" id="GDScript_rmgh7"]
script/source = "extends MainMenuComponent script/source = "extends Control
signal request_play_level signal request_play_level
@onready var carousel := $CarouselScroll/Carousel @onready var carousel := $VBoxContainer/Selection/Carousel
@onready var label_time := $PresentationMargin/Presentation/MarginContainer/VBoxContainer/BestTime @onready var label_time := $VBoxContainer/Presentation/MarginContainer/VBoxContainer/BestTime
@onready var default_thumbnail: CompressedTexture2D = $PresentationMargin/Presentation/Thumbnail.texture
const levels = [ const levels = [
\"res://levels/base/level.tscn\", \"res://levels/base/level.tscn\",
\"res://levels/forest/level.tscn\", \"res://levels/forest/level.tscn\",
@ -21,9 +16,6 @@ var loaded_level: Level
var loaded_level_scene: PackedScene var loaded_level_scene: PackedScene
var loaded_level_path: String var loaded_level_path: String
func _init() -> void:
self.displayed_name = \"Levels\"
func _enter_tree() -> void: func _enter_tree() -> void:
if len(loaded_level_path): if len(loaded_level_path):
prepare_level(loaded_level_path) prepare_level(loaded_level_path)
@ -33,25 +25,11 @@ func _ready() -> void:
for placeholder in placeholders: for placeholder in placeholders:
placeholder.queue_free() placeholder.queue_free()
var btn_group := ButtonGroup.new()
for i in len(levels): for i in len(levels):
var button := Button.new() var btn := Button.new()
button.toggle_mode = true btn.text = \"Level \" + str(i + 1)
button.button_group = btn_group btn.connect(\"pressed\", func(): prepare_level(levels[i]))
button.text = \"Level \" + str(i + 1) carousel.add_child(btn)
button.connect(\"pressed\", func(): prepare_level(levels[i]))
if i == 0 or i == len(levels) - 1:
var margin = MarginContainer.new()
if i == 0:
margin.add_theme_constant_override(\"margin_left\", 10)
elif i == len(levels) - 1:
margin.add_theme_constant_override(\"margin_right\", 10)
margin.add_child(button)
carousel.add_child(margin)
else:
carousel.add_child(button)
super()
func prepare_level(level_scene_path: String): func prepare_level(level_scene_path: String):
if is_instance_valid(loaded_level): if is_instance_valid(loaded_level):
@ -61,9 +39,10 @@ func prepare_level(level_scene_path: String):
loaded_level_scene = ResourceLoader.load_threaded_get(level_scene_path) loaded_level_scene = ResourceLoader.load_threaded_get(level_scene_path)
loaded_level = loaded_level_scene.instantiate() loaded_level = loaded_level_scene.instantiate()
loaded_level_path = level_scene_path loaded_level_path = level_scene_path
$PresentationMargin/Presentation/Thumbnail.texture = loaded_level.thumbnail if loaded_level.thumbnail else default_thumbnail $VBoxContainer/Presentation/Thumbnail.texture = loaded_level.thumbnail
$PresentationMargin/Presentation/MarginContainer/VBoxContainer/LevelName.text = \"The \" + loaded_level.id.capitalize() $VBoxContainer/Presentation/MarginContainer/VBoxContainer/LevelName.text = \"The \" + loaded_level.id.capitalize()
$PlayButtonMargin/PlayButton.disabled = false $VBoxContainer/Presentation.show()
$VBoxContainer/MarginContainer/PlayButton.show()
display_file_data(SaveFiles.read(SaveFiles.selected_file)) display_file_data(SaveFiles.read(SaveFiles.selected_file))
func display_file_data(data: Variant) -> void: func display_file_data(data: Variant) -> void:
@ -95,9 +74,6 @@ func _notification(what: int) -> void:
loaded_level.queue_free() loaded_level.queue_free()
" "
[sub_resource type="LabelSettings" id="LabelSettings_48hd3"]
font_size = 24
[node name="LevelSelectionMenu" type="Control"] [node name="LevelSelectionMenu" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -105,103 +81,72 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("1_48hd3")
script = SubResource("GDScript_rmgh7") script = SubResource("GDScript_rmgh7")
[node name="ColorRect" type="ColorRect" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
color = Color(0.226692, 3.48346e-05, 0.22669, 1)
[node name="CarouselScroll" type="ScrollContainer" parent="."] [node name="Selection" type="ScrollContainer" parent="VBoxContainer"]
custom_minimum_size = Vector2(0, 50) custom_minimum_size = Vector2(0, 50)
layout_mode = 1 layout_mode = 2
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 52.0
grow_horizontal = 2
vertical_scroll_mode = 0
[node name="Carousel" type="HBoxContainer" parent="CarouselScroll"] [node name="Carousel" type="HBoxContainer" parent="VBoxContainer/Selection"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_constants/separation = -5 theme_override_constants/separation = 10
alignment = 1 alignment = 1
[node name="Placeholder1" type="Button" parent="CarouselScroll/Carousel"] [node name="Placeholder1" type="Button" parent="VBoxContainer/Selection/Carousel"]
layout_mode = 2 layout_mode = 2
text = "Placeholder 1" theme_override_constants/icon_max_width = 150
text = "Placeholder"
[node name="Placeholder2" type="Button" parent="CarouselScroll/Carousel"] [node name="Placeholder2" type="Button" parent="VBoxContainer/Selection/Carousel"]
layout_mode = 2 layout_mode = 2
text = "Placeholder 2" text = "Placeholder"
[node name="Placeholder3" type="Button" parent="CarouselScroll/Carousel"] [node name="Placeholder3" type="Button" parent="VBoxContainer/Selection/Carousel"]
layout_mode = 2 layout_mode = 2
text = "Placeholder 3" text = "Placeholder"
[node name="PresentationMargin" type="MarginContainer" parent="."] [node name="Presentation" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 1 visible = false
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -75.0
offset_bottom = 75.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
[node name="Presentation" type="HBoxContainer" parent="PresentationMargin"]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 4
[node name="Thumbnail" type="TextureRect" parent="PresentationMargin/Presentation"] [node name="Thumbnail" type="TextureRect" parent="VBoxContainer/Presentation"]
custom_minimum_size = Vector2(150, 150) custom_minimum_size = Vector2(150, 150)
layout_mode = 2 layout_mode = 2
texture = ExtResource("2_xo3h8")
expand_mode = 1 expand_mode = 1
stretch_mode = 4 stretch_mode = 4
[node name="MarginContainer" type="MarginContainer" parent="PresentationMargin/Presentation"] [node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Presentation"]
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_left = 20 theme_override_constants/margin_left = 5
[node name="VBoxContainer" type="VBoxContainer" parent="PresentationMargin/Presentation/MarginContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Presentation/MarginContainer"]
layout_mode = 2 layout_mode = 2
alignment = 1 alignment = 1
[node name="LevelName" type="Label" parent="PresentationMargin/Presentation/MarginContainer/VBoxContainer"] [node name="LevelName" type="Label" parent="VBoxContainer/Presentation/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "No level selected" text = "Placeholder"
[node name="BestTime" type="Label" parent="PresentationMargin/Presentation/MarginContainer/VBoxContainer"] [node name="BestTime" type="Label" parent="VBoxContainer/Presentation/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Please select a level!" text = "Best time: 00:00.000"
label_settings = SubResource("LabelSettings_48hd3")
[node name="PlayButtonMargin" type="MarginContainer" parent="."] [node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 1 layout_mode = 2
anchors_preset = 12 theme_override_constants/margin_top = 15
anchor_top = 1.0
anchor_right = 1.0 [node name="PlayButton" type="Button" parent="VBoxContainer/MarginContainer"]
anchor_bottom = 1.0 visible = false
offset_top = -52.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 30
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="PlayButton" type="Button" parent="PlayButtonMargin"]
layout_mode = 2 layout_mode = 2
disabled = true
text = "Play!" text = "Play!"
[connection signal="pressed" from="PlayButtonMargin/PlayButton" to="." method="_on_play_button_pressed"] [connection signal="pressed" from="VBoxContainer/MarginContainer/PlayButton" to="." method="_on_play_button_pressed"]

View file

@ -1,8 +1,7 @@
[gd_scene load_steps=17 format=3 uid="uid://ikeidrgprk8k"] [gd_scene load_steps=16 format=3 uid="uid://ikeidrgprk8k"]
[ext_resource type="PackedScene" uid="uid://wlhsarkeqe8r" path="res://menus/main/panel.tscn" id="1_5vmsf"] [ext_resource type="PackedScene" uid="uid://wlhsarkeqe8r" path="res://menus/main/panel.tscn" id="1_5vmsf"]
[ext_resource type="PackedScene" uid="uid://cnnvwotv33u1b" path="res://elements/player.tscn" id="2_2rexg"] [ext_resource type="PackedScene" uid="uid://cnnvwotv33u1b" path="res://elements/player.tscn" id="2_2rexg"]
[ext_resource type="PackedScene" uid="uid://da6lkdiskdh8v" path="res://elements/tree.tscn" id="3_2rexg"]
[sub_resource type="GDScript" id="GDScript_bt14i"] [sub_resource type="GDScript" id="GDScript_bt14i"]
script/source = "extends Node3D script/source = "extends Node3D
@ -17,14 +16,9 @@ func _enter_tree() -> void:
Vector3.DOWN Vector3.DOWN
) )
for child in self.find_children(\"*\", \"\", true, false):
if child is Button:
child.disabled = false
# Display on Panel 1 # Display on Panel 1
const res_initial_menu = preload(\"res://menus/main/initial_menu.tscn\") const res_initial_menu = preload(\"res://menus/main/initial_menu.tscn\")
func _ready() -> void: func _ready() -> void:
$Menus/Panel1.connect(\"request_return\", exit_game)
$Menus/Panel2.connect(\"request_return\", func(): rotate_cube_to(0)) $Menus/Panel2.connect(\"request_return\", func(): rotate_cube_to(0))
$Menus/Panel3.connect(\"request_return\", func(): rotate_cube_to(90)) $Menus/Panel3.connect(\"request_return\", func(): rotate_cube_to(90))
$Menus/Panel4.connect(\"request_return\", func(): rotate_cube_to(180)) $Menus/Panel4.connect(\"request_return\", func(): rotate_cube_to(180))
@ -34,16 +28,6 @@ func _ready() -> void:
initial_menu.connect(\"request_settings\", settings) initial_menu.connect(\"request_settings\", settings)
$Menus/Panel1.change_menu(initial_menu, false) $Menus/Panel1.change_menu(initial_menu, false)
func exit_game() -> void:
$Menus.queue_free()
$Camera3D/AnimationPlayer.play(\"camera_pan\", 0.1)
var sky_animation: Animation = $AnimationPlayer.get_animation(\"sky_brightness\")
sky_animation.track_set_key_value(0, 0, $WorldEnvironment.environment.sky.sky_material.energy_multiplier)
sky_animation.track_set_key_value(0, 1, 0)
$AnimationPlayer.play(\"sky_brightness\")
await get_tree().create_timer(1).timeout
get_tree().quit()
# Display on Panel 2 # Display on Panel 2
const res_settings_menu = preload(\"res://menus/main/settings_menu.tscn\") const res_settings_menu = preload(\"res://menus/main/settings_menu.tscn\")
func settings() -> void: func settings() -> void:
@ -63,9 +47,6 @@ const res_level_selection_menu = preload(\"res://menus/main/level_selection_menu
func level_selection() -> void: func level_selection() -> void:
var level_selection_menu := res_level_selection_menu.instantiate() var level_selection_menu := res_level_selection_menu.instantiate()
level_selection_menu.connect(\"request_play_level\", func(level: Level, scene: PackedScene): level_selection_menu.connect(\"request_play_level\", func(level: Level, scene: PackedScene):
for child in self.find_children(\"*\", \"\", true, false):
if child is Button:
child.disabled = true
$Camera3D/AnimationPlayer.play(\"camera_pan\") $Camera3D/AnimationPlayer.play(\"camera_pan\")
await get_tree().create_timer(1.5).timeout await get_tree().create_timer(1.5).timeout
request_play_level.emit(level, scene) request_play_level.emit(level, scene)
@ -194,7 +175,7 @@ tracks/1/keys = {
"times": PackedFloat32Array(0, 1.5), "times": PackedFloat32Array(0, 1.5),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector3(0, 0, 3.5), Vector3(0, 0, 15)] "values": [Vector3(0, 0, 2.5), Vector3(0, 0, 15)]
} }
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jinmx"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_jinmx"]
@ -306,27 +287,6 @@ current = false
[node name="GPUParticles3D" parent="Player/Sphere" index="2"] [node name="GPUParticles3D" parent="Player/Sphere" index="2"]
visible = false visible = false
[node name="Node3D" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.75915, -3.82674, 33.457)
[node name="Tree" parent="Node3D" instance=ExtResource("3_2rexg")]
transform = Transform3D(0.923859, 0.382732, 0, -0.382732, 0.923859, 0, 0, 0, 1, 0, 0, -26.0327)
[node name="Tree3" parent="Node3D" instance=ExtResource("3_2rexg")]
transform = Transform3D(-0.487936, -0.87288, 0, 0.87288, -0.487936, 0, 0, 0, 1, 6.35408, 0, -23.4472)
[node name="Tree5" parent="Node3D" instance=ExtResource("3_2rexg")]
transform = Transform3D(-0.372891, -0.927875, 0, 0.927875, -0.372891, 0, 0, 0, 1, -1.95029, 4.56039, -24.1333)
[node name="Tree6" parent="Node3D" instance=ExtResource("3_2rexg")]
transform = Transform3D(-0.282308, 0.959324, 0, -0.959324, -0.282308, 0, 0, 0, 1, -6.39577, 9.10044, -24.1333)
[node name="Tree2" parent="Node3D" instance=ExtResource("3_2rexg")]
transform = Transform3D(0.810829, -0.585283, 0, 0.585283, 0.810829, 0, 0, 0, 1, 9.77187, 1.4366, -28.5165)
[node name="Tree4" parent="Node3D" instance=ExtResource("3_2rexg")]
transform = Transform3D(-0.999072, -0.0430789, 0, 0.0430789, -0.999072, 0, 0, 0, 1, 13.1083, 6.84424, -26.0327)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../Camera3D/AnimationPlayer") root_node = NodePath("../Camera3D/AnimationPlayer")
libraries = { libraries = {

View file

@ -1,2 +0,0 @@
class_name MainMenuComponent
extends Menu

View file

@ -1 +0,0 @@
uid://lsdwhhitqe1x

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=8 format=3 uid="uid://wlhsarkeqe8r"] [gd_scene load_steps=7 format=3 uid="uid://wlhsarkeqe8r"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="2_xvx0p"] [ext_resource type="PackedScene" uid="uid://tasbgr10p84c" path="res://menus/menu.tscn" id="1_3roig"]
[sub_resource type="GDScript" id="GDScript_gfsnp"] [sub_resource type="GDScript" id="GDScript_gfsnp"]
script/source = "# this whole code is from \"GUI in 3D\" script/source = "# this whole code is from \"GUI in 3D\"
@ -74,19 +74,10 @@ func _mouse_input_event(_camera: Camera3D, event: InputEvent, event_position: Ve
# original code # original code
signal request_return signal request_return
@onready var node_to_add_to = $SubViewport/VBoxContainer/Menu #: ColorRect = $SubViewport/ColorRect
func change_menu(new_menu: MainMenuComponent, return_button: bool = true): func change_menu(new_menu: Control, return_button: bool = true):
$SubViewport/VBoxContainer/Label.text = new_menu.displayed_name $SubViewport/Menu.add(new_menu, return_button)
for child in node_to_add_to.get_children(): $SubViewport/Menu.connect(\"disabled\", func(): request_return.emit())
child.queue_free()
new_menu.connect(\"return_to_previous\", request_return.emit)
node_to_add_to.add_child(new_menu)
if !return_button:
$SubViewport/VBoxContainer/ReturnButton.hide()
func _on_return_button_pressed() -> void:
request_return.emit()
" "
[sub_resource type="QuadMesh" id="QuadMesh_gfsnp"] [sub_resource type="QuadMesh" id="QuadMesh_gfsnp"]
@ -94,16 +85,10 @@ func _on_return_button_pressed() -> void:
[sub_resource type="ViewportTexture" id="ViewportTexture_gfsnp"] [sub_resource type="ViewportTexture" id="ViewportTexture_gfsnp"]
viewport_path = NodePath("SubViewport") viewport_path = NodePath("SubViewport")
[sub_resource type="ViewportTexture" id="ViewportTexture_3roig"]
viewport_path = NodePath("SubViewport")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a5lkq"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a5lkq"]
resource_local_to_scene = true resource_local_to_scene = true
transparency = 1 transparency = 1
albedo_texture = SubResource("ViewportTexture_gfsnp") albedo_texture = SubResource("ViewportTexture_gfsnp")
emission_enabled = true
emission_energy_multiplier = 0.5
emission_texture = SubResource("ViewportTexture_3roig")
[sub_resource type="BoxShape3D" id="BoxShape3D_gfsnp"] [sub_resource type="BoxShape3D" id="BoxShape3D_gfsnp"]
size = Vector3(1, 1, 0.01) size = Vector3(1, 1, 0.01)
@ -127,29 +112,4 @@ shape = SubResource("BoxShape3D_gfsnp")
gui_embed_subwindows = true gui_embed_subwindows = true
render_target_update_mode = 4 render_target_update_mode = 4
[node name="VBoxContainer" type="VBoxContainer" parent="SubViewport"] [node name="Menu" parent="SubViewport" instance=ExtResource("1_3roig")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="Label" type="Label" parent="SubViewport/VBoxContainer"]
custom_minimum_size = Vector2(0.1, 0.1)
layout_mode = 2
theme = ExtResource("2_xvx0p")
theme_override_colors/font_color = Color(1, 1, 1, 1)
text = "displayed_name of the menu also it's long"
horizontal_alignment = 1
autowrap_mode = 3
[node name="Menu" type="Control" parent="SubViewport/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="ReturnButton" type="Button" parent="SubViewport/VBoxContainer"]
layout_mode = 2
text = "Return"
[connection signal="pressed" from="SubViewport/VBoxContainer/ReturnButton" to="." method="_on_return_button_pressed"]

View file

@ -1,58 +1,37 @@
[gd_scene load_steps=4 format=3 uid="uid://w5te3qujco7d"] [gd_scene load_steps=2 format=3 uid="uid://w5te3qujco7d"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="1_gc46s"]
[sub_resource type="GDScript" id="GDScript_a5kgg"] [sub_resource type="GDScript" id="GDScript_a5kgg"]
script/source = "extends MainMenuComponent script/source = "extends Control
signal request_start signal request_start
func _init() -> void: @onready var label_name = $VBoxContainer/MarginContainer/VBoxContainer/Description/Name
self.displayed_name = \"Save files\"
func _ready() -> void: func _ready() -> void:
for child in $ScrollContainer/SaveButtons.get_children(true): $VBoxContainer/MarginContainer.hide()
child.queue_free()
## Get the newest \"played_for\" when the main menu appears again ## Get the newest \"played_for\" when the main menu appears again
get_parent().connect(\"tree_entered\", func(): func _enter_tree() -> void:
if SaveFiles.selected_file: if len(SaveFiles.selected_file):
display_file_data(SaveFiles.selected_file) display_file_data(SaveFiles.selected_file)
)
var btn_group := ButtonGroup.new() func _on_save_1_pressed() -> void:
var save_file_names := SaveFiles.get_all_existing_save_file_names() label_name.text = $VBoxContainer/Save1.text
for i in len(save_file_names): display_file_data(SaveFiles.names[0])
var save_file_name := save_file_names[i]
var save_name := save_file_name.substr(0, save_file_name.rfind(\".\"))
if save_name.is_valid_int():
save_name = \"File #\" + save_name
var button := Button.new() func _on_save_2_pressed() -> void:
button.toggle_mode = true label_name.text = $VBoxContainer/Save2.text
button.button_group = btn_group display_file_data(SaveFiles.names[1])
button.connect(\"pressed\", func():
$VBoxContainer/MarginContainer/VBoxContainer/Description/Name.text = save_name
display_file_data(save_file_name)
)
button.text = save_name
if i == 0 or i == len(save_file_names) - 1: func _on_save_3_pressed() -> void:
var margin = MarginContainer.new() label_name.text = $VBoxContainer/Save3.text
if i == 0: display_file_data(SaveFiles.names[2])
margin.add_theme_constant_override(\"margin_left\", 10)
elif i == len(save_file_names) - 1:
margin.add_theme_constant_override(\"margin_right\", 10)
margin.add_child(button)
$ScrollContainer/SaveButtons.add_child(margin)
else:
$ScrollContainer/SaveButtons.add_child(button)
super()
func display_file_data(file_name: String) -> void: func display_file_data(file_name: String) -> void:
$VBoxContainer/MarginContainer.show()
var label_time := $VBoxContainer/MarginContainer/VBoxContainer/Description/Time var label_time := $VBoxContainer/MarginContainer/VBoxContainer/Description/Time
$VBoxContainer/MarginContainer/VBoxContainer/Buttons/Start.disabled = false
$VBoxContainer/MarginContainer/VBoxContainer/Buttons/Delete.disabled = false
var data = SaveFiles.read(file_name) var data = SaveFiles.read(file_name)
$VBoxContainer/MarginContainer.show()
label_time.text = \" | \" label_time.text = \" | \"
if data.has(\"played_for\") and data.played_for is float: if data.has(\"played_for\") and data.played_for is float:
var seconds: float = data.played_for var seconds: float = data.played_for
@ -69,9 +48,6 @@ func _on_delete_pressed() -> void:
display_file_data(SaveFiles.selected_file) display_file_data(SaveFiles.selected_file)
" "
[sub_resource type="LabelSettings" id="LabelSettings_gc46s"]
font_size = 24
[node name="SaveFileManager" type="Control"] [node name="SaveFileManager" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -79,65 +55,33 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("1_gc46s")
script = SubResource("GDScript_a5kgg") script = SubResource("GDScript_a5kgg")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.147731, 0.243238, 0.205466, 1)
[node name="ScrollContainer" type="ScrollContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
size_flags_vertical = 3
follow_focus = true
vertical_scroll_mode = 0
[node name="SaveButtons" type="HBoxContainer" parent="ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
alignment = 1
[node name="Placeholder1" type="Button" parent="ScrollContainer/SaveButtons"]
layout_mode = 2
toggle_mode = true
text = "Save file #1"
[node name="Placeholder2" type="Button" parent="ScrollContainer/SaveButtons"]
layout_mode = 2
toggle_mode = true
text = "Save file #2"
[node name="Placeholder3" type="Button" parent="ScrollContainer/SaveButtons"]
layout_mode = 2
toggle_mode = true
text = "Save file #3"
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = 8 anchors_preset = 14
anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 1.0
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = -243.5 offset_top = -50.5
offset_top = -157.0 offset_bottom = 50.5
offset_right = 243.5
offset_bottom = 157.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
mouse_filter = 2
alignment = 1 alignment = 1
[node name="Save1" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Save file #1"
[node name="Save2" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Save file #2"
[node name="Save3" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Save file #3"
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"] [node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_left = 30 theme_override_constants/margin_left = 30
@ -154,29 +98,28 @@ alignment = 1
[node name="Name" type="Label" parent="VBoxContainer/MarginContainer/VBoxContainer/Description"] [node name="Name" type="Label" parent="VBoxContainer/MarginContainer/VBoxContainer/Description"]
layout_mode = 2 layout_mode = 2
text = "Please select a save file!" text = "Save File"
label_settings = SubResource("LabelSettings_gc46s")
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1
[node name="Time" type="Label" parent="VBoxContainer/MarginContainer/VBoxContainer/Description"] [node name="Time" type="Label" parent="VBoxContainer/MarginContainer/VBoxContainer/Description"]
layout_mode = 2 layout_mode = 2
[node name="Buttons" type="HBoxContainer" parent="VBoxContainer/MarginContainer/VBoxContainer"] [node name="Buttons" type="HBoxContainer" parent="VBoxContainer/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 10
alignment = 1 alignment = 1
[node name="Start" type="Button" parent="VBoxContainer/MarginContainer/VBoxContainer/Buttons"] [node name="Start" type="Button" parent="VBoxContainer/MarginContainer/VBoxContainer/Buttons"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
disabled = true
text = "Start" text = "Start"
[node name="Delete" type="Button" parent="VBoxContainer/MarginContainer/VBoxContainer/Buttons"] [node name="Delete" type="Button" parent="VBoxContainer/MarginContainer/VBoxContainer/Buttons"]
layout_mode = 2 layout_mode = 2
disabled = true
text = "Delete" text = "Delete"
[connection signal="pressed" from="VBoxContainer/Save1" to="." method="_on_save_1_pressed"]
[connection signal="pressed" from="VBoxContainer/Save2" to="." method="_on_save_2_pressed"]
[connection signal="pressed" from="VBoxContainer/Save3" to="." method="_on_save_3_pressed"]
[connection signal="pressed" from="VBoxContainer/MarginContainer/VBoxContainer/Buttons/Start" to="." method="_on_start_pressed"] [connection signal="pressed" from="VBoxContainer/MarginContainer/VBoxContainer/Buttons/Start" to="." method="_on_start_pressed"]
[connection signal="pressed" from="VBoxContainer/MarginContainer/VBoxContainer/Buttons/Delete" to="." method="_on_delete_pressed"] [connection signal="pressed" from="VBoxContainer/MarginContainer/VBoxContainer/Buttons/Delete" to="." method="_on_delete_pressed"]

View file

@ -1,14 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://opwiiusu80nu"] [gd_scene load_steps=2 format=3 uid="uid://opwiiusu80nu"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="1_qe056"]
[sub_resource type="GDScript" id="GDScript_wbybg"] [sub_resource type="GDScript" id="GDScript_wbybg"]
script/source = "extends MainMenuComponent script/source = "extends Control
func _on_visibility_changed() -> void: func _ready() -> void:
if self.visible: $VBoxContainer/Fullscreen/CheckButton.button_pressed = Settings.fullscreen
$VBoxContainer/Fullscreen.button_pressed = Settings.fullscreen $VBoxContainer/SoundGravity/CheckButton.button_pressed = Settings.sound_on_gravity_change
$VBoxContainer/SoundGravity.button_pressed = Settings.sound_on_gravity_change
$VBoxContainer/VolumeMusic/HSlider.value = Settings.volume_music $VBoxContainer/VolumeMusic/HSlider.value = Settings.volume_music
$VBoxContainer/VolumeSounds/HSlider.value = Settings.volume_sounds $VBoxContainer/VolumeSounds/HSlider.value = Settings.volume_sounds
@ -32,18 +29,8 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("1_qe056")
script = SubResource("GDScript_wbybg") script = SubResource("GDScript_wbybg")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.22124, 0.161019, 0.214297, 1)
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
@ -51,24 +38,32 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_constants/separation = 0
alignment = 1 alignment = 1
[node name="Fullscreen" type="CheckButton" parent="VBoxContainer"] [node name="Fullscreen" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/Fullscreen"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 4
text = "Fullscreen" text = "Fullscreen"
[node name="SoundGravity" type="CheckButton" parent="VBoxContainer"] [node name="CheckButton" type="CheckButton" parent="VBoxContainer/Fullscreen"]
layout_mode = 2
[node name="SoundGravity" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 4
text = "Play sound on
gravity change"
alignment = 1 alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/SoundGravity"]
layout_mode = 2
text = "Play sound on gravity change"
[node name="CheckButton" type="CheckButton" parent="VBoxContainer/SoundGravity"]
layout_mode = 2
[node name="VolumeMusic" type="HBoxContainer" parent="VBoxContainer"] [node name="VolumeMusic" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 10
alignment = 1 alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/VolumeMusic"] [node name="Label" type="Label" parent="VBoxContainer/VolumeMusic"]
@ -76,14 +71,13 @@ layout_mode = 2
text = "Music volume" text = "Music volume"
[node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeMusic"] [node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeMusic"]
custom_minimum_size = Vector2(200, 56) custom_minimum_size = Vector2(200, 28)
layout_mode = 2 layout_mode = 2
min_value = -15.0 min_value = -15.0
max_value = 15.0 max_value = 15.0
[node name="VolumeSounds" type="HBoxContainer" parent="VBoxContainer"] [node name="VolumeSounds" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 10
alignment = 1 alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/VolumeSounds"] [node name="Label" type="Label" parent="VBoxContainer/VolumeSounds"]
@ -91,13 +85,12 @@ layout_mode = 2
text = "Sound volume" text = "Sound volume"
[node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeSounds"] [node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeSounds"]
custom_minimum_size = Vector2(200, 56) custom_minimum_size = Vector2(200, 28)
layout_mode = 2 layout_mode = 2
min_value = -15.0 min_value = -15.0
max_value = 15.0 max_value = 15.0
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"] [connection signal="toggled" from="VBoxContainer/Fullscreen/CheckButton" to="." method="_on_fullscreen_check_button_toggled"]
[connection signal="toggled" from="VBoxContainer/Fullscreen" to="." method="_on_fullscreen_check_button_toggled"] [connection signal="toggled" from="VBoxContainer/SoundGravity/CheckButton" to="." method="_on_soundgravity_check_button_toggled"]
[connection signal="toggled" from="VBoxContainer/SoundGravity" to="." method="_on_soundgravity_check_button_toggled"]
[connection signal="value_changed" from="VBoxContainer/VolumeMusic/HSlider" to="." method="_on_volumemusic_h_slider_value_changed"] [connection signal="value_changed" from="VBoxContainer/VolumeMusic/HSlider" to="." method="_on_volumemusic_h_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/VolumeSounds/HSlider" to="." method="_on_volumesounds_h_slider_value_changed"] [connection signal="value_changed" from="VBoxContainer/VolumeSounds/HSlider" to="." method="_on_volumesounds_h_slider_value_changed"]

View file

@ -1,35 +0,0 @@
class_name Menu
extends Control
@warning_ignore("unused_signal")
signal return_to_previous
const select_resource = preload("res://menus/sound_players/select.tscn")
const confirm_resource = preload("res://menus/sound_players/confirm.tscn")
var displayed_name: String = "Menu"
func _ready() -> void:
var children := self.find_children("*", "", true, false)
for child in children:
if is_instance_of(child, Menu):
for second_menu_child in child.find_children("*", "", true, false):
children.erase(second_menu_child)
var select := select_resource.instantiate()
var confirm := confirm_resource.instantiate()
self.add_child(select)
self.add_child(confirm)
var buttons := children.filter(func(child): return is_instance_of(child, Button))
for button in buttons as Array[Button]:
button.mouse_entered.connect(func():
if !button.disabled:
select.play()
)
button.pressed.connect(confirm.play)
var sliders := children.filter(func(child): return is_instance_of(child, HSlider))
for slider in sliders as Array[HSlider]:
slider.mouse_entered.connect(select.play)
slider.drag_ended.connect(func(_value): confirm.play()) # drag_ended() and play() have 1 argument

View file

@ -1 +0,0 @@
uid://dunkiembuld4y

View file

@ -1,162 +0,0 @@
[gd_resource type="Theme" load_steps=12 format=3 uid="uid://c6ceauyc42c33"]
[ext_resource type="FontFile" uid="uid://b1y3v45qjku1w" path="res://fonts/Galindo/Galindo-Regular.ttf" id="2_fg72k"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kavms"]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color(0.328466, 0.245609, 0.29308, 1)
skew = Vector2(0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
shadow_size = 2
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_udy6f"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_udy6f"]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color(0.443029, 0.566882, 1, 1)
skew = Vector2(0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
shadow_size = 2
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ryjg5"]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color(0.820204, 0.452768, 0.716911, 1)
skew = Vector2(0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
shadow_size = 2
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fg72k"]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color(1, 1, 1, 1)
skew = Vector2(0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
shadow_size = 2
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ryjg5"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qi7qm"]
bg_color = Color(3.27289e-06, 0.697602, 0.601869, 1)
skew = Vector2(-0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
expand_margin_left = 10.0
expand_margin_right = 10.0
shadow_size = 2
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_iwc3v"]
bg_color = Color(3.27289e-06, 0.697602, 0.601869, 1)
skew = Vector2(-0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
expand_margin_left = 10.0
expand_margin_right = 10.0
shadow_size = 2
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cq8do"]
bg_color = Color(0.630949, 0.539791, 0.840276, 1)
skew = Vector2(-0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
expand_margin_left = 10.0
expand_margin_right = 10.0
shadow_size = 2
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8lbit"]
bg_color = Color(0.374451, 0.600068, 0.944077, 1)
skew = Vector2(-0.3, 0)
border_width_left = 4
border_width_top = 2
border_width_right = 2
border_width_bottom = 4
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
expand_margin_left = 10.0
expand_margin_right = 10.0
shadow_size = 2
[resource]
default_font = ExtResource("2_fg72k")
default_font_size = 32
Button/colors/font_hover_pressed_color = Color(0, 0, 0, 1)
Button/colors/font_pressed_color = Color(0, 0, 0, 1)
Button/styles/disabled = SubResource("StyleBoxFlat_kavms")
Button/styles/focus = SubResource("StyleBoxEmpty_udy6f")
Button/styles/hover = SubResource("StyleBoxFlat_udy6f")
Button/styles/normal = SubResource("StyleBoxFlat_ryjg5")
Button/styles/pressed = SubResource("StyleBoxFlat_fg72k")
CheckButton/colors/font_pressed_color = Color(1, 1, 1, 1)
CheckButton/styles/focus = SubResource("StyleBoxEmpty_ryjg5")
CheckButton/styles/hover = SubResource("StyleBoxFlat_qi7qm")
CheckButton/styles/hover_pressed = SubResource("StyleBoxFlat_iwc3v")
CheckButton/styles/normal = SubResource("StyleBoxFlat_cq8do")
CheckButton/styles/pressed = SubResource("StyleBoxFlat_8lbit")
HBoxContainer/constants/separation = 0
VBoxContainer/constants/separation = 0

139
menus/menu.tscn Normal file
View file

@ -0,0 +1,139 @@
[gd_scene load_steps=8 format=3 uid="uid://tasbgr10p84c"]
[ext_resource type="AudioStream" uid="uid://bnbf1nfaxuagi" path="res://sounds/select.ogg" id="1_y8e4h"]
[ext_resource type="AudioStream" uid="uid://bq3tw55s0ud55" path="res://sounds/confirm.ogg" id="2_hl3ms"]
[sub_resource type="GDScript" id="GDScript_18a3y"]
script/source = "extends MarginContainer
signal disabled
func add(node: Control, return_button: bool):
var add_to := $VSplitContainer/MarginContainer/ColorRect
var children := add_to.get_children(true)
for child in children:
child.queue_free()
var regex := RegEx.new()
regex.compile(\"([A-Z])\")
var menu_name := regex.sub(node.name, \" $1\", true, 1)
$VSplitContainer/Label.text = menu_name
add_to.add_child(node)
$VSplitContainer/AnimationPlayer.play(\"split_offset\")
if return_button:
var button = Button.new()
button.text = \"Return\"
button.anchor_top = 1.0
button.anchor_bottom = 1.0
button.grow_vertical = Control.GROW_DIRECTION_BEGIN
button.connect(\"pressed\", disable)
node.add_child(button)
link_to_sounds(node)
func link_to_sounds(node: Control):
var children := node.find_children(\"*\", \"\", true, false)
var buttons := children.filter(func(child): return is_instance_of(child, Button))
for button in buttons as Array[Button]:
button.mouse_entered.connect(func(): $Select.play())
button.pressed.connect(func(): $Confirm.play())
var sliders := children.filter(func(child): return is_instance_of(child, HSlider))
for slider in sliders as Array[HSlider]:
slider.mouse_entered.connect(func(): $Select.play())
slider.drag_ended.connect(func(_value): $Confirm.play())
func disable():
$VSplitContainer/AnimationPlayer.play_backwards(\"split_offset\")
disabled.emit()
"
[sub_resource type="Animation" id="Animation_y8e4h"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:split_offset")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [500]
}
[sub_resource type="Animation" id="Animation_85u52"]
resource_name = "split_offset"
length = 0.5
step = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:split_offset")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [500, 0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hl3ms"]
_data = {
&"RESET": SubResource("Animation_y8e4h"),
&"split_offset": SubResource("Animation_85u52")
}
[sub_resource type="LabelSettings" id="LabelSettings_2d4ws"]
font_size = 48
[node name="Menu" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 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
script = SubResource("GDScript_18a3y")
[node name="VSplitContainer" type="VSplitContainer" parent="."]
layout_mode = 2
split_offset = 500
dragger_visibility = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="VSplitContainer"]
libraries = {
&"": SubResource("AnimationLibrary_hl3ms")
}
[node name="Label" type="Label" parent="VSplitContainer"]
custom_minimum_size = Vector2(1, 1)
layout_mode = 2
text = "MENU NAME"
label_settings = SubResource("LabelSettings_2d4ws")
horizontal_alignment = 1
autowrap_mode = 3
uppercase = true
[node name="MarginContainer" type="MarginContainer" parent="VSplitContainer"]
layout_mode = 2
theme_override_constants/margin_top = 20
[node name="ColorRect" type="ColorRect" parent="VSplitContainer/MarginContainer"]
layout_mode = 2
color = Color(0, 0, 0, 1)
[node name="Select" type="AudioStreamPlayer" parent="."]
stream = ExtResource("1_y8e4h")
bus = &"Sounds"
[node name="Confirm" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_hl3ms")
bus = &"Sounds"

View file

@ -1,140 +0,0 @@
[gd_scene load_steps=6 format=3 uid="uid://dkxtwpcy4moyo"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="1_s0u37"]
[ext_resource type="PackedScene" uid="uid://325sqcgcrf2r" path="res://menus/pause/settings_menu.tscn" id="2_p1qj3"]
[sub_resource type="GDScript" id="GDScript_s0u37"]
script/source = "extends Menu
signal request_pause
signal request_restart
signal request_quit
func _init() -> void:
var os_name = OS.get_name()
if os_name == \"Web\": ## you can't quit the game on web (you're stuck here forever :))
$VBoxContainer/Btn_Quit.hide()
func _ready() -> void:
super()
$SettingsMenu.connect(\"return_to_previous\", $SettingsMenu.hide)
func _input(_event: InputEvent) -> void:
if Input.is_action_just_pressed(\"pause_game\"):
request_pause.emit(!self.visible)
func _on_btn_resume_pressed() -> void:
request_pause.emit(false)
func _on_btn_restart_pressed() -> void:
request_restart.emit()
func _on_btn_settings_pressed() -> void:
$SettingsMenu.show()
func _on_btn_quit_pressed() -> void:
request_quit.emit()
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_s0u37"]
bg_color = Color(0.268015, 0.649122, 0.807649, 1)
skew = Vector2(-0.1, 0.05)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
expand_margin_left = 20.0
expand_margin_top = 8.0
expand_margin_right = 20.0
[sub_resource type="LabelSettings" id="LabelSettings_s0u37"]
font_size = 48
outline_size = 8
outline_color = Color(0, 0, 0, 1)
[node name="PauseMenu" type="Control"]
z_index = 2
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 1
theme = ExtResource("1_s0u37")
script = SubResource("GDScript_s0u37")
metadata/_custom_type_script = "uid://dunkiembuld4y"
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(1, 1, 0.666667, 0.0784314)
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -171.5
offset_top = -155.0
offset_right = 171.5
offset_bottom = 155.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 10
alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_bottom = 40
[node name="Notice" type="Label" parent="VBoxContainer/MarginContainer"]
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_s0u37")
text = "Paused!"
label_settings = SubResource("LabelSettings_s0u37")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Btn_Resume" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
mouse_default_cursor_shape = 2
text = "Resume the game!"
[node name="Btn_Settings" type="Button" parent="VBoxContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Show the settings menu!"
[node name="Btn_Restart" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
mouse_default_cursor_shape = 2
text = "Restart the level!"
[node name="Btn_Quit" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
mouse_default_cursor_shape = 2
text = "Quit to the main menu!"
[node name="SettingsMenu" parent="." instance=ExtResource("2_p1qj3")]
visible = false
layout_mode = 1
[connection signal="pressed" from="VBoxContainer/Btn_Resume" to="." method="_on_btn_resume_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Settings" to="." method="_on_btn_settings_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Restart" to="." method="_on_btn_restart_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Quit" to="." method="_on_btn_quit_pressed"]

View file

@ -1,161 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://325sqcgcrf2r"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="1_337ca"]
[sub_resource type="GDScript" id="GDScript_wbybg"]
script/source = "extends Menu
func _on_visibility_changed() -> void:
if self.visible:
$VBoxContainer/Fullscreen/CheckButton.button_pressed = Settings.fullscreen
$VBoxContainer/SoundGravity/CheckButton.button_pressed = Settings.sound_on_gravity_change
$VBoxContainer/VolumeMusic/HSlider.value = Settings.volume_music
$VBoxContainer/VolumeSounds/HSlider.value = Settings.volume_sounds
func _on_fullscreen_check_button_toggled(toggled_on: bool) -> void:
Settings.fullscreen = toggled_on
func _on_soundgravity_check_button_toggled(toggled_on: bool) -> void:
Settings.sound_on_gravity_change = toggled_on
func _on_volumemusic_h_slider_value_changed(value: float) -> void:
Settings.volume_music = int(value)
func _on_volumesounds_h_slider_value_changed(value: float) -> void:
Settings.volume_sounds = int(value)
func _on_return_pressed() -> void:
return_to_previous.emit()
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_83qjl"]
bg_color = Color(1, 0.350068, 0.204326, 1)
skew = Vector2(0.1, -0.05)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
expand_margin_left = 20.0
expand_margin_top = 8.0
expand_margin_right = 20.0
[sub_resource type="LabelSettings" id="LabelSettings_v0bl3"]
font_size = 48
outline_size = 8
outline_color = Color(0, 0, 0, 1)
[node name="SettingsMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_337ca")
script = SubResource("GDScript_wbybg")
metadata/_custom_type_script = "uid://dunkiembuld4y"
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.207843, 0.207843, 0.207843, 0.784314)
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
theme_override_constants/margin_bottom = 40
[node name="Notice" type="Label" parent="VBoxContainer/MarginContainer"]
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_83qjl")
text = "Settings"
label_settings = SubResource("LabelSettings_v0bl3")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Fullscreen" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
alignment = 1
[node name="CheckButton" type="CheckButton" parent="VBoxContainer/Fullscreen"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Fullscreen"
[node name="SoundGravity" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
alignment = 1
[node name="CheckButton" type="CheckButton" parent="VBoxContainer/SoundGravity"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Play sound on gravity change"
[node name="VolumeMusic" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/VolumeMusic"]
layout_mode = 2
text = "Music volume"
[node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeMusic"]
custom_minimum_size = Vector2(200, 48)
layout_mode = 2
mouse_default_cursor_shape = 2
min_value = -15.0
max_value = 15.0
[node name="VolumeSounds" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/VolumeSounds"]
layout_mode = 2
text = "Sound volume"
[node name="HSlider" type="HSlider" parent="VBoxContainer/VolumeSounds"]
custom_minimum_size = Vector2(200, 48)
layout_mode = 2
mouse_default_cursor_shape = 2
min_value = -15.0
max_value = 15.0
[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
theme_override_constants/margin_top = 80
[node name="Return" type="Button" parent="VBoxContainer/MarginContainer2"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Return to the pause menu!"
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="toggled" from="VBoxContainer/Fullscreen/CheckButton" to="." method="_on_fullscreen_check_button_toggled"]
[connection signal="toggled" from="VBoxContainer/SoundGravity/CheckButton" to="." method="_on_soundgravity_check_button_toggled"]
[connection signal="value_changed" from="VBoxContainer/VolumeMusic/HSlider" to="." method="_on_volumemusic_h_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/VolumeSounds/HSlider" to="." method="_on_volumesounds_h_slider_value_changed"]
[connection signal="pressed" from="VBoxContainer/MarginContainer2/Return" to="." method="_on_return_pressed"]

78
menus/pause_menu.tscn Normal file
View file

@ -0,0 +1,78 @@
[gd_scene load_steps=2 format=3 uid="uid://dkxtwpcy4moyo"]
[sub_resource type="GDScript" id="GDScript_d8v8v"]
script/source = "extends Control
signal request_pause
signal request_fullscreen
signal request_restart
func _ready() -> void:
var os_name = OS.get_name()
if os_name == \"Web\": ## you can't quit the game on web (you're stuck here forever :))
$VBoxContainer/Btn_Quit.hide()
func _input(_event: InputEvent) -> void:
if Input.is_action_just_pressed(\"pause_game\"):
request_pause.emit(!self.visible)
func _on_btn_resume_pressed() -> void:
request_pause.emit(false)
func _on_btn_fullscreen_pressed() -> void:
request_fullscreen.emit()
func _on_btn_restart_pressed() -> void:
request_restart.emit()
func _on_btn_quit_pressed() -> void:
get_tree().quit()
"
[node name="PauseMenu" type="Control"]
z_index = 2
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 1
script = SubResource("GDScript_d8v8v")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -50.5
offset_bottom = 50.5
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 10
[node name="Btn_Resume" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
text = "RESUME game"
[node name="Btn_Fullscreen" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
text = "Toggle FULLSCREEN"
[node name="Btn_Restart" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
text = "RESTART the level"
[node name="Btn_Quit" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
text = "QUIT game"
[connection signal="pressed" from="VBoxContainer/Btn_Resume" to="." method="_on_btn_resume_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Fullscreen" to="." method="_on_btn_fullscreen_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Restart" to="." method="_on_btn_restart_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Quit" to="." method="_on_btn_quit_pressed"]

View file

@ -1,7 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://slcl1v0u6s58"]
[ext_resource type="AudioStream" uid="uid://bq3tw55s0ud55" path="res://sounds/confirm.ogg" id="1_mji4d"]
[node name="Confirm" type="AudioStreamPlayer"]
stream = ExtResource("1_mji4d")
bus = &"Sounds"

View file

@ -1,7 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://bdvafteuohd6h"]
[ext_resource type="AudioStream" uid="uid://bnbf1nfaxuagi" path="res://sounds/select.ogg" id="1_pmn6p"]
[node name="Select" type="AudioStreamPlayer"]
stream = ExtResource("1_pmn6p")
bus = &"Sounds"

View file

@ -12,15 +12,13 @@ config_version=5
config/name="DreamBall" config/name="DreamBall"
config/description="Manipulate the gravity to make a ball go through every ring! config/description="Manipulate the gravity to make a ball go through every ring!
https://kitsunes.dev/Taevas/DreamBall"
Git repository: https://kitsunes.dev/Taevas/DreamBall" config/version="20250503.0"
config/version="20250510.0"
run/main_scene="res://index.tscn" run/main_scene="res://index.tscn"
config/features=PackedStringArray("4.4", "GL Compatibility") config/features=PackedStringArray("4.4", "GL Compatibility")
boot_splash/show_image=false boot_splash/show_image=false
config/icon="res://icon.png" config/icon="res://icon.png"
config/windows_native_icon="res://icon.ico" config/windows_native_icon="res://icon.ico"
config/enabled=false
[autoload] [autoload]
@ -80,24 +78,18 @@ restart_level={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
] ]
} }
display_map={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
]
}
[physics] [physics]
3d/run_on_separate_thread=true 3d/run_on_separate_thread=true
common/physics_ticks_per_second=120 common/physics_ticks_per_second=120
common/max_physics_steps_per_frame=30 common/max_physics_steps_per_frame=20
3d/physics_engine="GodotPhysics3D" 3d/physics_engine="GodotPhysics3D"
3d/default_gravity=1.0 3d/default_gravity=1.0
3d/default_gravity_vector=Vector3(0, -0.5, 0) 3d/default_gravity_vector=Vector3(0, -0.5, 0)
3d/solver/solver_iterations=40 3d/solver/solver_iterations=40
3d/solver/default_contact_bias=1.0 3d/solver/default_contact_bias=1.0
common/physics_interpolation=true
[rendering] [rendering]

View file

@ -1,35 +1,19 @@
extends Node extends Node
const directory := "user://saves/" const names := [
const number_of_default_files := 3 "user://save_file_1.save",
"user://save_file_2.save",
"user://save_file_3.save",
]
var selected_file: String var selected_file: String
func _ready() -> void: func _ready() -> void:
for i in number_of_default_files: for save_file_name in names:
var save_file_name := str(i + 1) + ".save"
ensure_existence(save_file_name) ensure_existence(save_file_name)
func get_all_existing_save_file_names() -> Array[String]:
var arr: Array[String] = []
ensure_existence_of_directory()
var saves_dir := DirAccess.open(directory)
var packed_saves := saves_dir.get_files()
for save in packed_saves:
if save.ends_with(".save"):
arr.push_back(save)
return arr
func ensure_existence_of_directory() -> void:
var dir := DirAccess.open("user://")
if !dir.dir_exists(directory):
print("Saves directory ", directory, " not found, creating it")
dir.make_dir(directory)
func ensure_existence(save_file_name: String) -> void: func ensure_existence(save_file_name: String) -> void:
ensure_existence_of_directory() if save_file_name in names and not FileAccess.file_exists(save_file_name):
var full_path := directory + save_file_name
if !FileAccess.file_exists(full_path):
print("Save file ", save_file_name, " not found, creating it") print("Save file ", save_file_name, " not found, creating it")
empty(save_file_name) empty(save_file_name)
@ -42,7 +26,7 @@ func read(save_file_name: String) -> Variant:
ensure_existence(save_file_name) ensure_existence(save_file_name)
selected_file = save_file_name selected_file = save_file_name
var save_file := FileAccess.open(directory + save_file_name, FileAccess.READ) var save_file := FileAccess.open(save_file_name, FileAccess.READ)
var json := JSON.new() var json := JSON.new()
var json_string := save_file.get_line() var json_string := save_file.get_line()
@ -53,7 +37,7 @@ func read(save_file_name: String) -> Variant:
return json.data return json.data
func write(json_string: String, save_file_name: String) -> void: func write(json_string: String, save_file_name: String) -> void:
var save_file := FileAccess.open(directory + save_file_name, FileAccess.WRITE) var save_file := FileAccess.open(save_file_name, FileAccess.WRITE)
save_file.store_line(json_string) save_file.store_line(json_string)
save_file.store_line("FOR YOUR SAFETY, ALWAYS CHECK IF THE DATA OF THE FILES YOU DOWNLOAD LOOKS OKAY") save_file.store_line("FOR YOUR SAFETY, ALWAYS CHECK IF THE DATA OF THE FILES YOU DOWNLOAD LOOKS OKAY")

View file

@ -76,4 +76,3 @@ func save_settings() -> void:
}) })
settings_file.store_line(json_string) settings_file.store_line(json_string)
settings_file.store_line("FOR YOUR SAFETY, ALWAYS CHECK IF THE DATA OF THE FILES YOU DOWNLOAD LOOKS OKAY") settings_file.store_line("FOR YOUR SAFETY, ALWAYS CHECK IF THE DATA OF THE FILES YOU DOWNLOAD LOOKS OKAY")
print("Saved settings!")