Poprawiony texture planet zalezny od biosfery

Troche zmian w galaxy
This commit is contained in:
Tomasz Boruc 2025-10-19 19:11:20 +02:00
parent aa4b9452d5
commit 24ec59007f
4 changed files with 50 additions and 21 deletions

View File

@ -1,8 +1,8 @@
extends Node extends Node
#class_name Manager # Autoload: Manager
# --- KONFIGURACJA --- # --- KONFIGURACJA ---
@export var SECTOR_COUNT: int = 10 @export var SECTOR_COUNT: int = 5
@export var PLANETS_PER_SECTOR_RANGE: Vector2 = Vector2(1, 5) @export var PLANETS_PER_SECTOR_RANGE: Vector2 = Vector2(1, 5)
# --- DANE --- # --- DANE ---
@ -13,9 +13,28 @@ var current_sector: int = -1
var sector_names = [ var sector_names = [
"Aetherion", "Altaris", "Andur System", "Artemis Reach", "Astrion", "Aetherion", "Altaris", "Andur System", "Artemis Reach", "Astrion",
"Azura Prime", "Borealis Expanse", "Caldris Belt", "Canthar System", "Celion Verge", "Azura Prime", "Borealis Expanse", "Caldris Belt", "Canthar System", "Celion Verge",
"Corvax Sector", "Cygnera Rift", "Daedalus Reach", "Darnis Cluster", "Dravon Expanse" "Corvax Sector", "Cygnera Rift", "Daedalus Reach", "Darnis Cluster", "Dravon Expanse",
"Eclipta Prime", "Erevos System", "Eryndor Belt", "Ethon Reach", "Epsilon Mare",
"Falcoris Rim", "Feron Cluster", "Gaelis System", "Galmar Belt", "Gryphon Reach",
"Halion Expanse", "Helios Verge", "Hespera Sector", "Hyden Reach", "Icarion System",
"Illun Belt", "Istris Cluster", "Jorath System", "Kaelor Expanse", "Kassian Reach",
"Koralis Rim", "Krynn Sector", "Lunaris Reach", "Lysara System", "Maelor Verge",
"Magnor Belt", "Mareth Cluster", "Meridian Expanse", "Morthal System", "Myrris Reach",
"Nadir Verge", "Naos Sector", "Nerath Cluster", "Norian Belt", "Nova Thal",
"Oblivis Reach", "Odessa Expanse", "Orionis Verge", "Orryx System", "Pallas Belt",
"Parallax Rim", "Perion Sector", "Pharos System", "Phoenix Reach", "Primis Expanse",
"Pyra Cluster", "Quaron Belt", "Quiris System", "Ragnar Verge", "Rathor Expanse",
"Ravenna Sector", "Regalis System", "Remora Reach", "Rydan Belt", "Saren Cluster",
"Selena Verge", "Seraphis System", "Shadow Rift", "Silvar Reach", "Solara Expanse",
"Starnis Belt", "Syrion Cluster", "Talion System", "Tarsis Verge", "Tauren Expanse",
"Tenebris Rim", "Thalassa Reach", "Tharon Belt", "Tirion Sector", "Tritonis Expanse",
"Umbra Verge", "Valis Reach", "Varon Cluster", "Velora System", "Verrin Belt",
"Veyra Expanse", "Viridis Rim", "Volnar Sector", "Vortex Reach", "Vulcaris System",
"Wraith Expanse", "Xandor Cluster", "Xerion Verge", "Ymir Belt", "Zephyra System",
"Zerath Expanse", "Zyra Prime", "Zyneth Reach", "Zorath System", "Zyphon Rim"
] ]
var planet_names = [ var planet_names = [
"Arcturus","Betelgeuse","Canopus","Deneb","Elnath", "Arcturus","Betelgeuse","Canopus","Deneb","Elnath",
"Fomalhaut","Gacrux","Hadar","Izar","Jabbah", "Fomalhaut","Gacrux","Hadar","Izar","Jabbah",
@ -55,24 +74,32 @@ func _initialize_sectors():
# Unikalna nazwa # Unikalna nazwa
var name = get_unique_sector_name() var name = get_unique_sector_name()
# Utwórz sektor # Losowa gwiazda
var scale = randf_range(0.03, 0.08) var star_texture = _random_star_texture()
var star_scale = randf_range(0.05, 0.05)
# Utwórz sektor
sectors_data[i] = { sectors_data[i] = {
"name": name, "name": name,
"position": pos, "position": pos,
"star_scale": scale,
"planets": [], "planets": [],
"star": {} "star": {
"texture_path": star_texture,
"scale": star_scale
}
} }
# Losowe planety # Losowe planety
var planet_count = randi_range(PLANETS_PER_SECTOR_RANGE.x, PLANETS_PER_SECTOR_RANGE.y) var planet_count = randi_range(PLANETS_PER_SECTOR_RANGE.x, PLANETS_PER_SECTOR_RANGE.y)
for j in range(planet_count): for j in range(planet_count):
var size = randi_range(1, 3) var size = randi_range(1, 3)
var growth_rate = randf_range(0.1, 1.0) var growth_rate = randf_range(0.1, 1.0)
var texture_planet = "res://assets/planets/p%d.png" % randi_range(1,18) var texture_planet: String
if growth_rate > 0.7:
texture_planet = "res://assets/planets/p%d.png" % randi_range(1,9)
else:
texture_planet = "res://assets/planets/p%d.png" % randi_range(10,18)
var planet = { var planet = {
"name": planet_names[randi() % planet_names.size()], "name": planet_names[randi() % planet_names.size()],
"size": size, "size": size,
@ -89,6 +116,10 @@ func _initialize_sectors():
sectors_data[i]["planets"].append(planet) sectors_data[i]["planets"].append(planet)
# --- FUNKCJE POMOCNICZE --- # --- FUNKCJE POMOCNICZE ---
func _random_star_texture() -> String:
var id = randi_range(1, 8)
return "res://assets/stars/s%d.png" % id
func get_max_population(size: int) -> int: func get_max_population(size: int) -> int:
match size: match size:
1: return 1000 1: return 1000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 450 KiB

View File

@ -1,9 +1,8 @@
[gd_scene load_steps=9 format=3 uid="uid://sxae8i12io4y"] [gd_scene load_steps=8 format=3 uid="uid://sxae8i12io4y"]
[ext_resource type="Script" uid="uid://ol6efor868gk" path="res://scripts/menu.gd" id="1_vjb58"] [ext_resource type="Script" path="res://scripts/menu.gd" id="1_vjb58"]
[ext_resource type="Texture2D" uid="uid://xuw4ki75j3fy" path="res://assets/background/menubg.png" id="1_yqeox"] [ext_resource type="Texture2D" uid="uid://xuw4ki75j3fy" path="res://assets/background/menubg.png" id="1_yqeox"]
[ext_resource type="AudioStream" uid="uid://ditln0kq3u3dm" path="res://assets/sounds/music/menu_music.mp3" id="3_con2f"] [ext_resource type="AudioStream" uid="uid://ditln0kq3u3dm" path="res://assets/sounds/music/menu_music.mp3" id="3_con2f"]
[ext_resource type="Script" path="res://scenes/button_script.gd" id="3_mhnvy"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yqeox"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yqeox"]
bg_color = Color(0.1567365, 0.410904, 0.5666233, 1) bg_color = Color(0.1567365, 0.410904, 0.5666233, 1)
@ -91,7 +90,6 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_yqeox")
theme_override_styles/pressed = SubResource("StyleBoxFlat_vjb58") theme_override_styles/pressed = SubResource("StyleBoxFlat_vjb58")
theme_override_styles/hover = SubResource("StyleBoxFlat_con2f") theme_override_styles/hover = SubResource("StyleBoxFlat_con2f")
text = "START" text = "START"
script = ExtResource("3_mhnvy")
[node name="exit" type="Button" parent="VBoxContainer"] [node name="exit" type="Button" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2

View File

@ -12,19 +12,16 @@ func _create_sector_buttons():
for child in container.get_children(): for child in container.get_children():
child.queue_free() child.queue_free()
var screen_size = get_viewport_rect().size
for i in range(Manager.SECTOR_COUNT): for i in range(Manager.SECTOR_COUNT):
var sector_info = Manager.get_sector(i) var sector_info = Manager.get_sector(i)
var button = TextureButton.new() var button = TextureButton.new()
button.texture_normal = preload("res://assets/stars/s1.png") button.texture_normal = load(sector_info["star"]["texture_path"])
button.stretch_mode = TextureButton.STRETCH_KEEP_ASPECT_CENTERED button.stretch_mode = TextureButton.STRETCH_KEEP_ASPECT_CENTERED
# 🎨 Losowy rozmiar gwiazdy # Skala zapisanej gwiazdy
var star_scale = sector_info["star"]["scale"]
button.scale = Vector2(sector_info["star_scale"], sector_info["star_scale"]) button.scale = Vector2(star_scale, star_scale)
# Pozycja z Managera # Pozycja z Managera
button.position = sector_info["position"] button.position = sector_info["position"]
@ -32,7 +29,10 @@ func _create_sector_buttons():
# Podpis sektora # Podpis sektora
var sector_label = Label.new() var sector_label = Label.new()
sector_label.text = sector_info["name"] sector_label.text = sector_info["name"]
sector_label.add_theme_font_size_override("font_size", 350) # malutki podpis sector_label.modulate = Color(0.386, 0.577, 0.778, 1.0) # czerwony
#sector_label.scale = Vector2(0.5, 0.5) # ignoruje skalę gwiazdy
sector_label.add_theme_font_size_override("font_size", 300) # malutki podpis
sector_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER sector_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
sector_label.position = Vector2(0, -450) sector_label.position = Vector2(0, -450)
button.add_child(sector_label) button.add_child(sector_label)