Compare commits
2 Commits
e5f3e8d155
...
4fb3cd0edf
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fb3cd0edf | |||
| a4842dc22e |
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
importer="csv_translation"
|
importer="csv_translation"
|
||||||
type="Translation"
|
type="Translation"
|
||||||
uid="uid://0ien22wevy7d"
|
uid="uid://cisrti2abcb3n"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,17 @@ menu={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
zoom_in={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
zoom_out={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[internationalization]
|
[internationalization]
|
||||||
|
|
||||||
locale/translations=PackedStringArray("res://localization/translation.de.translation", "res://localization/translation.en.translation", "res://localization/translation.pl.translation", "res://localization/translation.cs.translation", "res://localization/translation.es.translation")
|
locale/translations=PackedStringArray("res://localization/translation.cs.translation", "res://localization/translation.de.translation", "res://localization/translation.en.translation", "res://localization/translation.es.translation", "res://localization/translation.pl.translation")
|
||||||
|
|||||||
@ -1,21 +1,27 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://b1vxl6rs5odt1"]
|
[gd_scene load_steps=5 format=3 uid="uid://b1vxl6rs5odt1"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cts6e8xmnqsax" path="res://scripts/galaxy.gd" id="1_jxn3g"]
|
[ext_resource type="Script" uid="uid://cts6e8xmnqsax" path="res://scripts/galaxy.gd" id="1_jxn3g"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dvydsg5o77wdm" path="res://assets/background/galaxy_background.jpg" id="1_n7ltq"]
|
[ext_resource type="Texture2D" uid="uid://dvydsg5o77wdm" path="res://assets/background/galaxy_background.jpg" id="1_n7ltq"]
|
||||||
[ext_resource type="AudioStream" uid="uid://c8xg32p8lbltw" path="res://assets/sounds/music/game_music.mp3" id="3_mlxib"]
|
[ext_resource type="AudioStream" uid="uid://c8xg32p8lbltw" path="res://assets/sounds/music/game_music.mp3" id="3_mlxib"]
|
||||||
|
[ext_resource type="Script" uid="uid://b4cmg63daeo7g" path="res://scripts/camera_2d.gd" id="4_5xxpo"]
|
||||||
|
|
||||||
[node name="Galaxy" type="Node2D"]
|
[node name="Galaxy" type="Node2D"]
|
||||||
script = ExtResource("1_jxn3g")
|
script = ExtResource("1_jxn3g")
|
||||||
|
|
||||||
[node name="Background" type="Sprite2D" parent="."]
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
position = Vector2(2603.9998, 1474.0001)
|
layer = -1
|
||||||
scale = Vector2(1.3562499, 1.3685186)
|
|
||||||
|
[node name="Background" type="Sprite2D" parent="CanvasLayer"]
|
||||||
|
z_index = -10
|
||||||
|
position = Vector2(580, 332)
|
||||||
|
scale = Vector2(0.30208334, 0.32222223)
|
||||||
texture = ExtResource("1_n7ltq")
|
texture = ExtResource("1_n7ltq")
|
||||||
|
|
||||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||||
stream = ExtResource("3_mlxib")
|
stream = ExtResource("3_mlxib")
|
||||||
autoplay = true
|
autoplay = true
|
||||||
|
|
||||||
[node name="Kamera" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
position = Vector2(2632, 1472)
|
position = Vector2(904, 512)
|
||||||
zoom = Vector2(-0.22, -0.22)
|
zoom = Vector2(0.64, 0.64)
|
||||||
|
script = ExtResource("4_5xxpo")
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://cynwjsqox5eqx"]
|
[gd_scene load_steps=3 format=3 uid="uid://cynwjsqox5eqx"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bdmoi05k2qhjs" path="res://scripts/planet.gd" id="1_h8ms6"]
|
[ext_resource type="Script" uid="uid://bdmoi05k2qhjs" path="res://scripts/planet.gd" id="1_cktii"]
|
||||||
[ext_resource type="Texture2D" uid="uid://hun546m51ov8" path="res://assets/planets/p8.png" id="2_ggt7d"]
|
[ext_resource type="Texture2D" uid="uid://bmu7jwnvu7ob2" path="res://assets/planets/p5.png" id="2_h8ms6"]
|
||||||
|
|
||||||
[node name="Planet" type="Node2D"]
|
[node name="Planet" type="Node2D"]
|
||||||
script = ExtResource("1_h8ms6")
|
script = ExtResource("1_cktii")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
position = Vector2(61.5, 58)
|
scale = Vector2(0.053333335, 0.053333335)
|
||||||
scale = Vector2(0.40333334, 0.38)
|
texture = ExtResource("2_h8ms6")
|
||||||
texture = ExtResource("2_ggt7d")
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
offset_left = -16.0
|
||||||
|
offset_top = 8.0
|
||||||
|
offset_right = 8.0
|
||||||
|
offset_bottom = 21.0
|
||||||
|
theme_override_font_sizes/font_size = 8
|
||||||
|
|||||||
@ -1,12 +1,19 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://cvc0brcqh2rhu"]
|
[gd_scene load_steps=3 format=3 uid="uid://cvc0brcqh2rhu"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c7l387xor12hx" path="res://scripts/star.gd" id="1_j6vao"]
|
[ext_resource type="Script" uid="uid://c7l387xor12hx" path="res://scripts/star.gd" id="1_mcqwg"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b4iycl7xcvpkp" path="res://assets/stars/s1.png" id="2_ef0hr"]
|
[ext_resource type="Texture2D" uid="uid://b4iycl7xcvpkp" path="res://assets/stars/s1.png" id="2_j6vao"]
|
||||||
|
|
||||||
[node name="Star" type="Node2D"]
|
[node name="Star" type="Node2D"]
|
||||||
script = ExtResource("1_j6vao")
|
script = ExtResource("1_mcqwg")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
position = Vector2(48.999996, 47.000004)
|
position = Vector2(-2.3841858e-07, 0)
|
||||||
scale = Vector2(0.07206547, 0.06872218)
|
scale = Vector2(0.014858843, 0.014858842)
|
||||||
texture = ExtResource("2_ef0hr")
|
texture = ExtResource("2_j6vao")
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
offset_left = -16.0
|
||||||
|
offset_top = 16.0
|
||||||
|
offset_right = 16.0
|
||||||
|
offset_bottom = 30.0
|
||||||
|
theme_override_font_sizes/font_size = 10
|
||||||
|
|||||||
@ -1,55 +1,3 @@
|
|||||||
# Plik: res://scripts/GameData.gd
|
|
||||||
extends Node
|
extends Node
|
||||||
#class_name GameData
|
|
||||||
|
|
||||||
# Ładowanie kontenera klas danych
|
var game_lunched = false
|
||||||
const CLASSES = preload("res://scripts/GameClasses.gd")
|
|
||||||
|
|
||||||
# Ustawienie aliasów dla czytelności
|
|
||||||
const PlanetDataClass = CLASSES.PlanetData
|
|
||||||
const StarDataClass = CLASSES.StarData
|
|
||||||
|
|
||||||
# --- GLOBALNY STAN GRY ---
|
|
||||||
var sectors: Array[StarDataClass] = []
|
|
||||||
# ... (reszta kodu) ...
|
|
||||||
|
|
||||||
# === FUNKCJE GENERUJĄCE GALAKTYKĘ ===
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
# ... (logika inicjalizacji)
|
|
||||||
generate_galaxy()
|
|
||||||
print(sectors[0].planets[0].name)
|
|
||||||
|
|
||||||
func generate_galaxy():
|
|
||||||
sectors.clear() # na wszelki wypadek, żeby nie duplikować
|
|
||||||
for i in range(2):
|
|
||||||
var new_sector_data = StarDataClass.new()
|
|
||||||
|
|
||||||
# --- Pozycja gwiazdy w przestrzeni galaktyki ---
|
|
||||||
new_sector_data.position = Vector2(
|
|
||||||
randf_range(0, 400), # szerokość galaktyki
|
|
||||||
randf_range(0, 400)
|
|
||||||
)
|
|
||||||
|
|
||||||
new_sector_data.randomize_properties()
|
|
||||||
new_sector_data.planets = generate_planets_for_sector()
|
|
||||||
|
|
||||||
sectors.append(new_sector_data)
|
|
||||||
|
|
||||||
|
|
||||||
func generate_planets_for_sector() -> Array:
|
|
||||||
var planets_list: Array = []
|
|
||||||
var planet_count = randi_range(2, 2)
|
|
||||||
|
|
||||||
for i in range(planet_count):
|
|
||||||
var p = PlanetDataClass.new()
|
|
||||||
p.name = "Planeta %d" % (i + 1)
|
|
||||||
p.randomize_properties()
|
|
||||||
|
|
||||||
# --- Ustal promień orbity i kąt ---
|
|
||||||
p.orbit_radius = (i + 1) * randf_range(100.0, 200.0)
|
|
||||||
p.angle = randf_range(0.0, TAU)
|
|
||||||
|
|
||||||
planets_list.append(p)
|
|
||||||
|
|
||||||
return planets_list
|
|
||||||
|
|||||||
29
scripts/camera_2d.gd
Normal file
29
scripts/camera_2d.gd
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
extends Camera2D
|
||||||
|
|
||||||
|
@export var speed := 500 # prędkość przesuwania
|
||||||
|
@export var zoom_speed := 0.1 # prędkość zoomu
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
var move = Vector2.ZERO
|
||||||
|
|
||||||
|
# przesuwanie WSAD / strzałki
|
||||||
|
if Input.is_action_pressed("map_move_right"):
|
||||||
|
move.x += 1
|
||||||
|
if Input.is_action_pressed("map_move_left"):
|
||||||
|
move.x -= 1
|
||||||
|
if Input.is_action_pressed("map_move_down"):
|
||||||
|
move.y += 1
|
||||||
|
if Input.is_action_pressed("map_move_up"):
|
||||||
|
move.y -= 1
|
||||||
|
|
||||||
|
position += move.normalized() * speed * delta
|
||||||
|
|
||||||
|
# zoom
|
||||||
|
if Input.is_action_pressed("zoom_in"): # np. Q
|
||||||
|
zoom -= Vector2(zoom_speed, zoom_speed) * delta
|
||||||
|
if Input.is_action_pressed("zoom_out"): # np. E
|
||||||
|
zoom += Vector2(zoom_speed, zoom_speed) * delta
|
||||||
|
|
||||||
|
# ograniczenie minimalnego i maksymalnego zoomu
|
||||||
|
zoom.x = clamp(zoom.x, 0.1, 3)
|
||||||
|
zoom.y = clamp(zoom.y, 0.1, 3)
|
||||||
1
scripts/camera_2d.gd.uid
Normal file
1
scripts/camera_2d.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://b4cmg63daeo7g
|
||||||
@ -1,33 +1,65 @@
|
|||||||
# Plik: res://scripts/Galaxy.gd
|
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
const StarScene = preload("res://scenes/Star.tscn")
|
@onready var StarScene = preload("res://scenes/Star.tscn")
|
||||||
const PlanetScene = preload("res://scenes/Planet.tscn")
|
@onready var PlanetScene = preload("res://scenes/Planet.tscn")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# Jeśli nie masz autoloada GameData, zrób tak:
|
if GameData.game_lunched == false:
|
||||||
# var game_data = preload("res://scripts/GameData.gd").new()
|
_generate_galaxy(Settings.NUMBER_OF_SYSTEMS) # 5 gwiazd testowo
|
||||||
# game_data.generate_galaxy()
|
GameData.game_lunched = true
|
||||||
# display_galaxy(game_data)
|
print_all_stars_and_planets()
|
||||||
|
|
||||||
# Jeśli GameData jest autoloadem (zalecane):
|
|
||||||
if GameData.sectors.is_empty():
|
|
||||||
GameData.generate_galaxy()
|
|
||||||
_display_galaxy()
|
|
||||||
|
|
||||||
|
|
||||||
func _display_galaxy():
|
func _generate_galaxy(count: int):
|
||||||
for star_data in GameData.sectors:
|
for i in range(count):
|
||||||
var star_instance = StarScene.instantiate()
|
var star = StarScene.instantiate()
|
||||||
star_instance.data = star_data
|
star.star_name = "Star_" + str(i)
|
||||||
star_instance.position = star_data.position
|
star.planet_count = randi_range(Settings.min_planet, Settings.max_planet)
|
||||||
|
star.global_position = Vector2(randi_range(50, Settings.x), randi_range(50, Settings.y))
|
||||||
|
star.get_node("Sprite2D").texture = load("res://assets/stars/s%d.png" % randi_range(1,8))
|
||||||
|
add_child(star)
|
||||||
|
|
||||||
|
# generowanie planet dla danej gwiazdy
|
||||||
|
for j in range(star.planet_count):
|
||||||
|
var planet = PlanetScene.instantiate()
|
||||||
|
planet.pname = "Planet_" + str(i) + "_" + str(j)
|
||||||
|
planet.orbit_radius = 30 + j * 20
|
||||||
|
planet.orbit_speed = randf_range(0.01, 0.04)
|
||||||
|
generate_planet_resources(planet) # <-- tu losujemy surowce
|
||||||
|
var angle = randf() * TAU
|
||||||
|
planet.position = Vector2(cos(angle), sin(angle)) * planet.orbit_radius
|
||||||
|
planet.biosfere = randf() # float od 0 do 1
|
||||||
|
if planet.biosfere > 0.7:
|
||||||
|
planet.get_node("Sprite2D").texture = load("res://assets/planets/p%d.png" % randi_range(1,9))
|
||||||
|
else:
|
||||||
|
planet.get_node("Sprite2D").texture = load("res://assets/planets/p%d.png" % randi_range(10,18))
|
||||||
|
#planet.get_node("Sprite2D").texture = load("res://assets/planets/p16.png")
|
||||||
|
star.add_child(planet) # Planeta należy do gwiazdy!
|
||||||
|
star.planets.append(planet)
|
||||||
|
|
||||||
|
func print_all_stars_and_planets():
|
||||||
|
print("--- Lista gwiazd i planet ---")
|
||||||
|
|
||||||
# 👇 dodajemy gwiazdę bezpośrednio do Galaxy
|
for star in get_children():
|
||||||
add_child(star_instance)
|
if star is Star:
|
||||||
|
print("Gwiazda: ", star.star_name)
|
||||||
|
|
||||||
# Teraz dodaj planety jako dzieci gwiazdy
|
if star.planets.size() == 0:
|
||||||
for planet_data in star_data.planets:
|
print(" (Brak planet)")
|
||||||
var planet_instance = PlanetScene.instantiate()
|
else:
|
||||||
planet_instance.data = planet_data
|
for planet in star.planets:
|
||||||
planet_instance.orbit_center = star_instance.position
|
print("Planeta: ", planet.pname, " | Surowiec: ", planet.resource_type)
|
||||||
star_instance.add_child(planet_instance)
|
|
||||||
|
print("--- Koniec listy ---")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Lista wszystkich możliwych surowców
|
||||||
|
var RESOURCE_TYPES = Settings.RESOURCE_TYPES
|
||||||
|
|
||||||
|
func generate_planet_resources(planet):
|
||||||
|
planet.resources = {} # resetujemy słownik
|
||||||
|
for res_name in RESOURCE_TYPES:
|
||||||
|
var exists = randi() % 100 < 50 # 50% szans na wystąpienie
|
||||||
|
var amount = 0
|
||||||
|
planet.resources[res_name] = {"exist": exists, "amount": amount}
|
||||||
|
|||||||
@ -1,32 +1,27 @@
|
|||||||
# Plik: res://scripts/Planet.gd
|
|
||||||
extends Node2D
|
extends Node2D
|
||||||
class_name Planet
|
class_name Planet
|
||||||
|
@onready var label = $Label
|
||||||
|
var pname: String = ""
|
||||||
|
var orbit_radius: float = 30.0
|
||||||
|
var orbit_speed: float = 0.01
|
||||||
|
var biosfere: float = 0.1
|
||||||
|
var resources := {}
|
||||||
|
|
||||||
# Brak zagnieżdżonej klasy. Dane będą przypisane z GameData
|
var texture: Texture2D
|
||||||
var data = null
|
var angle = randf() * TAU
|
||||||
|
|
||||||
@onready var sprite: Sprite2D = $Sprite2D
|
|
||||||
|
|
||||||
# --- Właściwości ruchu (będą pobierane z 'data') ---
|
|
||||||
var orbit_center: Vector2 = Vector2.ZERO
|
|
||||||
var angle: float = 0.0
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
_apply_visuals()
|
print("Planeta: %s, surowiec: %s" % [pname, resources])
|
||||||
# Tutaj w _ready synchronizujemy dane orbitalne
|
#str(round(biosfere * 100) / 100.0)
|
||||||
|
_update_position()
|
||||||
|
|
||||||
func _apply_visuals():
|
|
||||||
# Sprawdza, czy 'data' jest obiektem i ma ścieżkę do tekstury
|
|
||||||
if is_instance_valid(data) and data.texture_path != "":
|
|
||||||
var planet_texture = load(data.texture_path)
|
|
||||||
if planet_texture and sprite:
|
|
||||||
sprite.texture = planet_texture
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
# Logika ruchu orbitalnego, używająca danych z 'data'
|
angle += orbit_speed * delta # obrót w czasie
|
||||||
if is_instance_valid(data) and data.orbit_radius > 0:
|
angle = fmod(angle, TAU) # utrzymanie kąta w 0..2π
|
||||||
|
_update_position()
|
||||||
data.angle += data.rotation_speed * delta
|
print(pname, angle)
|
||||||
|
label.text = str(round(position * 100) / 100.0)
|
||||||
var offset = Vector2(cos(data.angle), sin(data.angle)) * data.orbit_radius
|
|
||||||
self.position = orbit_center + offset
|
func _update_position():
|
||||||
|
# pozycja lokalna względem gwiazdy
|
||||||
|
position = Vector2(cos(angle), sin(angle)) * orbit_radius
|
||||||
|
|||||||
@ -1,34 +1,15 @@
|
|||||||
extends Node
|
extends Node
|
||||||
var language = 'pl'
|
var language = 'pl'
|
||||||
var number_of_players = 3
|
var number_of_players = 1
|
||||||
# Liczba sektorów w galaktyce
|
# Liczba sektorów w galaktyce
|
||||||
var sector_count: int = 4
|
var NUMBER_OF_SYSTEMS: int = 14
|
||||||
|
|
||||||
# Minimalna i maksymalna liczba planet w sektorze
|
const RESOURCE_TYPES = ["Iron", "Uran", "Titan", "Water"]
|
||||||
var min_planets_per_sector: int = 1
|
|
||||||
var max_planets_per_sector: int = 3
|
|
||||||
|
|
||||||
# Minimalna i maksymalna wielkość planety
|
#pozycja systemów
|
||||||
var min_planet_size: int = 1
|
var x = 1900
|
||||||
var max_planet_size: int = 3
|
var y = 1000
|
||||||
|
|
||||||
# Minimalna i maksymalna prędkość obrotu planety
|
#Ilosc systemów
|
||||||
var min_rotation_speed: float = 0.1
|
var min_planet = 1
|
||||||
var max_rotation_speed: float = 1.0
|
var max_planet = 5
|
||||||
|
|
||||||
# Minimalna i maksymalna odległość planety od gwiazdy
|
|
||||||
var min_orbit_radius: float = 50
|
|
||||||
var max_orbit_radius: float = 250
|
|
||||||
|
|
||||||
# Minimalna i maksymalna wartość biosfery (habitability)
|
|
||||||
var min_biosfere: float = 0.0
|
|
||||||
var max_biosfere: float = 1.0
|
|
||||||
|
|
||||||
# Minimalna i maksymalna wartość resource_rich
|
|
||||||
var min_resource_rich: float = 0.1
|
|
||||||
var max_resource_rich: float = 1.0
|
|
||||||
|
|
||||||
# Inne parametry świata możesz dodawać tutaj w miarę potrzeb
|
|
||||||
#Granice galaktyki
|
|
||||||
var x = 500
|
|
||||||
var y = 500
|
|
||||||
|
|||||||
@ -1,19 +1,11 @@
|
|||||||
# Plik: res://scripts/Star.gd
|
|
||||||
extends Node2D
|
extends Node2D
|
||||||
class_name Star
|
class_name Star
|
||||||
|
@onready var label = $Label
|
||||||
# Brak zagnieżdżonej klasy. Dane będą przypisane z GameData
|
@export var star_name: String = ""
|
||||||
var data = null
|
@export var planet_count: int = 0
|
||||||
|
var planets: Array = []
|
||||||
@onready var sprite: Sprite2D = $Sprite2D
|
var texture: Texture2D
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# Oczekujemy, że węzeł, który nas instancjonuje, przypisze 'data'
|
print("Gwiazda %s z %d planetami" % [star_name, planet_count])
|
||||||
_apply_visuals()
|
label.text = star_name
|
||||||
|
|
||||||
func _apply_visuals():
|
|
||||||
# Sprawdza, czy 'data' jest obiektem i ma ścieżkę do tekstury
|
|
||||||
if is_instance_valid(data) and data.texture_path != "":
|
|
||||||
var star_texture = load(data.texture_path)
|
|
||||||
if star_texture and sprite:
|
|
||||||
sprite.texture = star_texture
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user