001-0007
Poprawki w skalowaniu
This commit is contained in:
parent
0a78377b14
commit
8c07dc7dd1
@ -2,7 +2,7 @@ extends Node
|
|||||||
# Autoload: Manager
|
# Autoload: Manager
|
||||||
|
|
||||||
# --- KONFIGURACJA ---
|
# --- KONFIGURACJA ---
|
||||||
@export var SECTOR_COUNT: int = 15
|
@export var SECTOR_COUNT: int = 3
|
||||||
@export var PLANETS_PER_SECTOR_RANGE: Vector2 = Vector2(1, 5)
|
@export var PLANETS_PER_SECTOR_RANGE: Vector2 = Vector2(1, 5)
|
||||||
const UPDATE_INTERVAL := 2.0
|
const UPDATE_INTERVAL := 2.0
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,5 @@ MusicManager="*res://music_manager.gd"
|
|||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=2560
|
window/size/mode=3
|
||||||
window/size/viewport_height=1440
|
window/stretch/mode="canvas_items"
|
||||||
window/stretch/mode="viewport"
|
|
||||||
|
|||||||
@ -4,7 +4,11 @@
|
|||||||
|
|
||||||
[node name="galaxy" type="Control"]
|
[node name="galaxy" type="Control"]
|
||||||
layout_mode = 3
|
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")
|
script = ExtResource("1_n7ltq")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="Control" parent="."]
|
[node name="VBoxContainer" type="Control" parent="."]
|
||||||
|
|||||||
@ -23,30 +23,28 @@ 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
|
||||||
|
offset_bottom = -1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
texture = ExtResource("1_yqeox")
|
texture = ExtResource("1_yqeox")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
stretch_mode = 6
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="TextureRect"]
|
[node name="Sprite2D" type="Sprite2D" parent="TextureRect"]
|
||||||
position = Vector2(911, 403)
|
position = Vector2(554.375, 371.65625)
|
||||||
scale = Vector2(0.45898455, 0.43310553)
|
scale = Vector2(0.2, 0.2)
|
||||||
texture = ExtResource("5_4ytvr")
|
texture = ExtResource("5_4ytvr")
|
||||||
centered = false
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 2
|
anchors_preset = 2
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
offset_left = 14.000004
|
offset_left = 23.999998
|
||||||
offset_top = -393.0
|
offset_top = -238.00006
|
||||||
offset_right = 464.0
|
offset_right = 474.0
|
||||||
offset_bottom = 263.0
|
offset_bottom = 388.0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
scale = Vector2(0.6, 0.6)
|
scale = Vector2(0.4, 0.4)
|
||||||
theme_override_constants/separation = 20
|
|
||||||
|
|
||||||
[node name="start" type="TextureButton" parent="VBoxContainer"]
|
[node name="start" type="TextureButton" parent="VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|||||||
@ -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"]
|
[node name="Control" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
|||||||
@ -58,6 +58,7 @@ offset_left = 2337.0
|
|||||||
offset_top = 1199.0
|
offset_top = 1199.0
|
||||||
offset_right = 2407.0
|
offset_right = 2407.0
|
||||||
offset_bottom = 1269.0
|
offset_bottom = 1269.0
|
||||||
|
scale = Vector2(0.7, 0.7)
|
||||||
size_flags_horizontal = 8
|
size_flags_horizontal = 8
|
||||||
size_flags_vertical = 8
|
size_flags_vertical = 8
|
||||||
texture_normal = ExtResource("2_c2nvg")
|
texture_normal = ExtResource("2_c2nvg")
|
||||||
|
|||||||
@ -8,6 +8,7 @@ func _ready():
|
|||||||
_create_sector_buttons()
|
_create_sector_buttons()
|
||||||
|
|
||||||
# --- TWORZENIE GWIAZD SEKTORÓW ---
|
# --- TWORZENIE GWIAZD SEKTORÓW ---
|
||||||
|
const GLOBAL_STAR_REDUCTION = 0.45 # Zmniejsza gwiazdy do 65% oryginalnego rozmiaru
|
||||||
func _create_sector_buttons():
|
func _create_sector_buttons():
|
||||||
for child in container.get_children():
|
for child in container.get_children():
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
@ -21,7 +22,8 @@ func _create_sector_buttons():
|
|||||||
|
|
||||||
# Skala zapisanej gwiazdy
|
# Skala zapisanej gwiazdy
|
||||||
var star_scale = sector_info["star"]["scale"]
|
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
|
# Pozycja z Managera
|
||||||
button.position = sector_info["position"]
|
button.position = sector_info["position"]
|
||||||
@ -65,7 +67,7 @@ func _init_background():
|
|||||||
var screen_size = get_viewport_rect().size
|
var screen_size = get_viewport_rect().size
|
||||||
var tex_size = background.texture.get_size()
|
var tex_size = background.texture.get_size()
|
||||||
var scale_factor = max(screen_size.x / tex_size.x, screen_size.y / tex_size.y)
|
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)
|
add_child(background)
|
||||||
background.z_index = -10
|
background.z_index = -10
|
||||||
|
|||||||
@ -73,10 +73,10 @@ func set_texture(tex: Texture2D):
|
|||||||
|
|
||||||
func get_scale_for_size(size: int) -> Vector2:
|
func get_scale_for_size(size: int) -> Vector2:
|
||||||
match size:
|
match size:
|
||||||
1: return Vector2(0.20, 0.20)
|
1: return Vector2(0.10, 0.10)
|
||||||
2: return Vector2(0.30, 0.30)
|
2: return Vector2(0.15, 0.15)
|
||||||
3: return Vector2(0.42, 0.42)
|
3: return Vector2(0.20, 0.20)
|
||||||
4: return Vector2(0.60, 0.60)
|
4: return Vector2(0.25, 0.25)
|
||||||
return Vector2(0.3, 0.3)
|
return Vector2(0.3, 0.3)
|
||||||
|
|
||||||
func _on_area_input(viewport, event, shape_idx):
|
func _on_area_input(viewport, event, shape_idx):
|
||||||
|
|||||||
@ -5,8 +5,8 @@ var PlanetScene = preload("res://scenes/planet.tscn")
|
|||||||
@onready var PlanetStatPanel = $PlanetStatPanel
|
@onready var PlanetStatPanel = $PlanetStatPanel
|
||||||
@onready var BackButton: TextureButton = $BackButton
|
@onready var BackButton: TextureButton = $BackButton
|
||||||
|
|
||||||
var ORBIT_STEP = 130
|
var ORBIT_STEP = 90
|
||||||
const FIRST_ORBIT_STEP = 160
|
const FIRST_ORBIT_STEP = 100
|
||||||
var tracked_planet: Node = null
|
var tracked_planet: Node = null
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
@ -33,6 +33,7 @@ func _on_back_pressed():
|
|||||||
get_tree().change_scene_to_file("res://scenes/galaxy.tscn")
|
get_tree().change_scene_to_file("res://scenes/galaxy.tscn")
|
||||||
|
|
||||||
# --- Planet spawning ---
|
# --- Planet spawning ---
|
||||||
|
const GLOBAL_OBJECT_SCALE = 0.75
|
||||||
func spawn_planets():
|
func spawn_planets():
|
||||||
var center = get_viewport_rect().size / 2
|
var center = get_viewport_rect().size / 2
|
||||||
var sector_index = Manager.current_sector
|
var sector_index = Manager.current_sector
|
||||||
@ -55,7 +56,7 @@ func spawn_planets():
|
|||||||
var planet_data = sector_planets[i]
|
var planet_data = sector_planets[i]
|
||||||
var planet_node = PlanetScene.instantiate()
|
var planet_node = PlanetScene.instantiate()
|
||||||
add_child(planet_node)
|
add_child(planet_node)
|
||||||
|
|
||||||
planet_node.data = planet_data
|
planet_node.data = planet_data
|
||||||
planet_node.orbit_center = center
|
planet_node.orbit_center = center
|
||||||
if i == 0:
|
if i == 0:
|
||||||
@ -97,13 +98,14 @@ func spawn_star():
|
|||||||
var star = StarScene.instantiate()
|
var star = StarScene.instantiate()
|
||||||
add_child(star)
|
add_child(star)
|
||||||
star.position = get_viewport_rect().size / 2
|
star.position = get_viewport_rect().size / 2
|
||||||
|
star.scale *= GLOBAL_OBJECT_SCALE
|
||||||
# jeśli gwiazda ma zapisaną teksturę – użyj jej
|
# jeśli gwiazda ma zapisaną teksturę – użyj jej
|
||||||
if star_data.has("texture_path"):
|
if star_data.has("texture_path"):
|
||||||
star.set_texture(load(star_data["texture_path"]))
|
star.set_texture(load(star_data["texture_path"]))
|
||||||
else:
|
else:
|
||||||
var tex_path = random_star_texture_path()
|
var tex_path = random_star_texture_path()
|
||||||
star.set_texture(load(tex_path))
|
star.set_texture(load(tex_path))
|
||||||
|
star.scale
|
||||||
star_data["texture_path"] = tex_path
|
star_data["texture_path"] = tex_path
|
||||||
Manager.sectors_data[sector_index]["star"] = star_data
|
Manager.sectors_data[sector_index]["star"] = star_data
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user