From 8c07dc7dd1ce03aa89bad5ce34e75c9451823285 Mon Sep 17 00:00:00 2001 From: Tirith Date: Wed, 22 Oct 2025 17:42:46 +0200 Subject: [PATCH] 001-0007 Poprawki w skalowaniu --- Manager.gd | 2 +- project.godot | 5 ++--- scenes/galaxy.tscn | 6 +++++- scenes/menu.tscn | 18 ++++++++---------- scenes/options.tscn | 2 +- scenes/sector.tscn | 1 + scripts/galaxy.gd | 6 ++++-- scripts/planet.gd | 8 ++++---- scripts/sector.gd | 10 ++++++---- 9 files changed, 32 insertions(+), 26 deletions(-) diff --git a/Manager.gd b/Manager.gd index 19f8cdf..d96e1a9 100644 --- a/Manager.gd +++ b/Manager.gd @@ -2,7 +2,7 @@ extends Node # Autoload: Manager # --- KONFIGURACJA --- -@export var SECTOR_COUNT: int = 15 +@export var SECTOR_COUNT: int = 3 @export var PLANETS_PER_SECTOR_RANGE: Vector2 = Vector2(1, 5) const UPDATE_INTERVAL := 2.0 diff --git a/project.godot b/project.godot index eebd96f..6af424c 100644 --- a/project.godot +++ b/project.godot @@ -22,6 +22,5 @@ MusicManager="*res://music_manager.gd" [display] -window/size/viewport_width=2560 -window/size/viewport_height=1440 -window/stretch/mode="viewport" +window/size/mode=3 +window/stretch/mode="canvas_items" diff --git a/scenes/galaxy.tscn b/scenes/galaxy.tscn index b5bbf44..804e434 100644 --- a/scenes/galaxy.tscn +++ b/scenes/galaxy.tscn @@ -4,7 +4,11 @@ [node name="galaxy" type="Control"] layout_mode = 3 -anchors_preset = 0 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 script = ExtResource("1_n7ltq") [node name="VBoxContainer" type="Control" parent="."] diff --git a/scenes/menu.tscn b/scenes/menu.tscn index 157a0d5..cacfa99 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -23,30 +23,28 @@ layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +offset_bottom = -1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_yqeox") expand_mode = 1 -stretch_mode = 6 [node name="Sprite2D" type="Sprite2D" parent="TextureRect"] -position = Vector2(911, 403) -scale = Vector2(0.45898455, 0.43310553) +position = Vector2(554.375, 371.65625) +scale = Vector2(0.2, 0.2) texture = ExtResource("5_4ytvr") -centered = false [node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 1 anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 -offset_left = 14.000004 -offset_top = -393.0 -offset_right = 464.0 -offset_bottom = 263.0 +offset_left = 23.999998 +offset_top = -238.00006 +offset_right = 474.0 +offset_bottom = 388.0 grow_vertical = 0 -scale = Vector2(0.6, 0.6) -theme_override_constants/separation = 20 +scale = Vector2(0.4, 0.4) [node name="start" type="TextureButton" parent="VBoxContainer"] layout_mode = 2 diff --git a/scenes/options.tscn b/scenes/options.tscn index 24388b3..2ab17b2 100644 --- a/scenes/options.tscn +++ b/scenes/options.tscn @@ -1,4 +1,4 @@ -[gd_scene format=3 uid="uid://t6cx3pwnhodp"] +[gd_scene load_steps=0 format=3 uid="uid://t6cx3pwnhodp"] [node name="Control" type="Control"] layout_mode = 3 diff --git a/scenes/sector.tscn b/scenes/sector.tscn index 75333e9..a921f56 100644 --- a/scenes/sector.tscn +++ b/scenes/sector.tscn @@ -58,6 +58,7 @@ offset_left = 2337.0 offset_top = 1199.0 offset_right = 2407.0 offset_bottom = 1269.0 +scale = Vector2(0.7, 0.7) size_flags_horizontal = 8 size_flags_vertical = 8 texture_normal = ExtResource("2_c2nvg") diff --git a/scripts/galaxy.gd b/scripts/galaxy.gd index 3f7311b..68b595c 100644 --- a/scripts/galaxy.gd +++ b/scripts/galaxy.gd @@ -8,6 +8,7 @@ func _ready(): _create_sector_buttons() # --- TWORZENIE GWIAZD SEKTORÓW --- +const GLOBAL_STAR_REDUCTION = 0.45 # Zmniejsza gwiazdy do 65% oryginalnego rozmiaru func _create_sector_buttons(): for child in container.get_children(): child.queue_free() @@ -21,7 +22,8 @@ func _create_sector_buttons(): # Skala zapisanej gwiazdy var star_scale = sector_info["star"]["scale"] - button.scale = Vector2(star_scale, star_scale) + var final_scale = star_scale #* GLOBAL_STAR_REDUCTION + button.scale = Vector2(final_scale, final_scale) # Pozycja z Managera button.position = sector_info["position"] @@ -65,7 +67,7 @@ func _init_background(): var screen_size = get_viewport_rect().size var tex_size = background.texture.get_size() var scale_factor = max(screen_size.x / tex_size.x, screen_size.y / tex_size.y) - background.scale = screen_size / tex_size + background.scale = Vector2(scale_factor, scale_factor) add_child(background) background.z_index = -10 diff --git a/scripts/planet.gd b/scripts/planet.gd index 6d7a475..bff60c0 100644 --- a/scripts/planet.gd +++ b/scripts/planet.gd @@ -73,10 +73,10 @@ func set_texture(tex: Texture2D): func get_scale_for_size(size: int) -> Vector2: match size: - 1: return Vector2(0.20, 0.20) - 2: return Vector2(0.30, 0.30) - 3: return Vector2(0.42, 0.42) - 4: return Vector2(0.60, 0.60) + 1: return Vector2(0.10, 0.10) + 2: return Vector2(0.15, 0.15) + 3: return Vector2(0.20, 0.20) + 4: return Vector2(0.25, 0.25) return Vector2(0.3, 0.3) func _on_area_input(viewport, event, shape_idx): diff --git a/scripts/sector.gd b/scripts/sector.gd index ad45403..b4df2f2 100644 --- a/scripts/sector.gd +++ b/scripts/sector.gd @@ -5,8 +5,8 @@ var PlanetScene = preload("res://scenes/planet.tscn") @onready var PlanetStatPanel = $PlanetStatPanel @onready var BackButton: TextureButton = $BackButton -var ORBIT_STEP = 130 -const FIRST_ORBIT_STEP = 160 +var ORBIT_STEP = 90 +const FIRST_ORBIT_STEP = 100 var tracked_planet: Node = null func _ready(): @@ -33,6 +33,7 @@ func _on_back_pressed(): get_tree().change_scene_to_file("res://scenes/galaxy.tscn") # --- Planet spawning --- +const GLOBAL_OBJECT_SCALE = 0.75 func spawn_planets(): var center = get_viewport_rect().size / 2 var sector_index = Manager.current_sector @@ -55,7 +56,7 @@ func spawn_planets(): var planet_data = sector_planets[i] var planet_node = PlanetScene.instantiate() add_child(planet_node) - + planet_node.data = planet_data planet_node.orbit_center = center if i == 0: @@ -97,13 +98,14 @@ func spawn_star(): var star = StarScene.instantiate() add_child(star) star.position = get_viewport_rect().size / 2 - + star.scale *= GLOBAL_OBJECT_SCALE # jeśli gwiazda ma zapisaną teksturę – użyj jej if star_data.has("texture_path"): star.set_texture(load(star_data["texture_path"])) else: var tex_path = random_star_texture_path() star.set_texture(load(tex_path)) + star.scale star_data["texture_path"] = tex_path Manager.sectors_data[sector_index]["star"] = star_data