diff --git a/assets/fonts/main_font.ttf b/assets/fonts/main_font.ttf new file mode 100644 index 0000000..03979d1 Binary files /dev/null and b/assets/fonts/main_font.ttf differ diff --git a/assets/fonts/main_font.ttf.import b/assets/fonts/main_font.ttf.import new file mode 100644 index 0000000..ea3414d --- /dev/null +++ b/assets/fonts/main_font.ttf.import @@ -0,0 +1,36 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://chk8jrn2ighpx" +path="res://.godot/imported/main_font.ttf-36d79ba454878c9b3ab34b1c4d76239a.fontdata" + +[deps] + +source_file="res://assets/fonts/main_font.ttf" +dest_files=["res://.godot/imported/main_font.ttf-36d79ba454878c9b3ab34b1c4d76239a.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 +modulate_color_glyphs=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={} diff --git a/project.godot b/project.godot index 48a4dda..3170964 100644 --- a/project.godot +++ b/project.godot @@ -17,6 +17,7 @@ config/icon="res://icon.svg" [autoload] +Names="*res://scripts/dictionary.gd" MusicManager="*res://music_manager.gd" ObjectNames="*res://scripts/ObjectNames.gd" Settings="*res://scripts/settings.gd" diff --git a/scenes/galaxy.tscn b/scenes/galaxy.tscn index 4c68082..97026c1 100644 --- a/scenes/galaxy.tscn +++ b/scenes/galaxy.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=5 format=3 uid="uid://b1vxl6rs5odt1"] +[gd_scene load_steps=6 format=3 uid="uid://b1vxl6rs5odt1"] [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="PackedScene" uid="uid://bbgymc0drqpbx" path="res://scenes/ui/time_display.tscn" id="3_fmtwf"] [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"] @@ -13,10 +14,15 @@ layer = -1 [node name="Background" type="Sprite2D" parent="CanvasLayer"] z_index = -10 -position = Vector2(580, 332) -scale = Vector2(0.30208334, 0.32222223) +position = Vector2(580.00006, 340.00003) +scale = Vector2(0.30208334, 0.3148148) texture = ExtResource("1_n7ltq") +[node name="TimeDisplay" parent="CanvasLayer" instance=ExtResource("3_fmtwf")] +offset_left = 896.0 +offset_top = 8.0 +offset_bottom = -616.0 + [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("3_mlxib") autoplay = true diff --git a/scenes/menu.tscn b/scenes/menu.tscn index dcbdde0..0441446 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -7,7 +7,7 @@ [ext_resource type="Texture2D" uid="uid://da6hb1mill5yn" path="res://assets/icons/buttons/button_blue.png" id="3_v86rl"] [ext_resource type="Texture2D" uid="uid://t2pwtja7yfa4" path="res://assets/icons/buttons/button_red.png" id="4_13sgg"] [ext_resource type="Texture2D" uid="uid://dssoa5bxs2h4r" path="res://assets/icons/logo_game.png" id="5_4ytvr"] -[ext_resource type="FontFile" uid="uid://bytgiothu0eoy" path="res://assets/fonts/Chopsic.otf" id="5_13sgg"] +[ext_resource type="FontFile" uid="uid://chk8jrn2ighpx" path="res://assets/fonts/main_font.ttf" id="6_i6lef"] [ext_resource type="Texture2D" uid="uid://cm376wgq8l0n4" path="res://assets/stars/small_star.png" id="7_i6lef"] [sub_resource type="Animation" id="Animation_mj5lg"] @@ -137,7 +137,7 @@ theme_override_colors/font_color = Color(3.008172e-09, 0.06855638, 0.14010939, 1 theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611, 0) theme_override_colors/font_outline_color = Color(0.9954526, 0.93959796, 0.9103491, 1) theme_override_constants/outline_size = 23 -theme_override_fonts/font = ExtResource("5_13sgg") +theme_override_fonts/font = ExtResource("6_i6lef") theme_override_font_sizes/font_size = 120 text = "menu_exit" horizontal_alignment = 1 @@ -164,7 +164,7 @@ theme_override_colors/font_color = Color(3.008172e-09, 0.06855638, 0.14010939, 1 theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611, 0) theme_override_colors/font_outline_color = Color(0.9954526, 0.93959796, 0.9103491, 1) theme_override_constants/outline_size = 23 -theme_override_fonts/font = ExtResource("5_13sgg") +theme_override_fonts/font = ExtResource("6_i6lef") theme_override_font_sizes/font_size = 120 text = "menu_options" horizontal_alignment = 1 @@ -198,7 +198,7 @@ theme_override_colors/font_color = Color(3.008172e-09, 0.06855638, 0.14010939, 1 theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611, 0) theme_override_colors/font_outline_color = Color(0.9954526, 0.93959796, 0.9103491, 1) theme_override_constants/outline_size = 23 -theme_override_fonts/font = ExtResource("5_13sgg") +theme_override_fonts/font = ExtResource("6_i6lef") theme_override_font_sizes/font_size = 120 text = "menu_start" horizontal_alignment = 1 @@ -232,7 +232,7 @@ theme_override_colors/font_color = Color(3.008172e-09, 0.06855638, 0.14010939, 1 theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611, 0) theme_override_colors/font_outline_color = Color(0.9954526, 0.93959796, 0.9103491, 1) theme_override_constants/outline_size = 23 -theme_override_fonts/font = ExtResource("5_13sgg") +theme_override_fonts/font = ExtResource("6_i6lef") theme_override_font_sizes/font_size = 120 text = "menu_back" horizontal_alignment = 1 @@ -266,7 +266,7 @@ theme_override_colors/font_color = Color(3.008172e-09, 0.06855638, 0.14010939, 1 theme_override_colors/font_shadow_color = Color(0.7570387, 0.75415635, 0.7885611, 0) theme_override_colors/font_outline_color = Color(0.9954526, 0.93959796, 0.9103491, 1) theme_override_constants/outline_size = 23 -theme_override_fonts/font = ExtResource("5_13sgg") +theme_override_fonts/font = ExtResource("6_i6lef") theme_override_font_sizes/font_size = 120 text = "menu_load" horizontal_alignment = 1 diff --git a/scenes/ui/time_display.tscn b/scenes/ui/time_display.tscn new file mode 100644 index 0000000..54713b6 --- /dev/null +++ b/scenes/ui/time_display.tscn @@ -0,0 +1,67 @@ +[gd_scene load_steps=4 format=3 uid="uid://bbgymc0drqpbx"] + +[ext_resource type="Script" uid="uid://dxky82mepun1j" path="res://scripts/time_label.gd" id="1_3uj10"] +[ext_resource type="FontFile" uid="uid://chk8jrn2ighpx" path="res://assets/fonts/main_font.ttf" id="2_742oq"] +[ext_resource type="FontFile" uid="uid://drp85tpfncq5m" path="res://assets/fonts/font2.ttf" id="3_aosp1"] + +[node name="TimeDisplay" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_3uj10") + +[node name="TimeLabel" type="Label" parent="."] +layout_mode = 0 +offset_left = 39.0 +offset_right = 164.0 +offset_bottom = 20.0 +theme_override_fonts/font = ExtResource("2_742oq") +text = "time_display" + +[node name="pause" type="Button" parent="."] +layout_mode = 0 +offset_left = 12.0 +offset_top = 2.0 +offset_right = 32.0 +offset_bottom = 24.0 +scale = Vector2(0.5, 0.5) +theme_override_colors/font_color = Color(0.80287457, 0.40096578, 0.15050122, 1) +theme_override_fonts/font = ExtResource("3_aosp1") +theme_override_font_sizes/font_size = 16 +text = "II" + +[node name="faster" type="Button" parent="."] +layout_mode = 0 +offset_left = 23.0 +offset_top = 2.0 +offset_right = 41.0 +offset_bottom = 24.0 +scale = Vector2(0.5, 0.5) +theme_override_colors/font_color = Color(0.80287457, 0.40096578, 0.15050122, 1) +theme_override_fonts/font = ExtResource("3_aosp1") +theme_override_font_sizes/font_size = 16 +text = ">" + +[node name="slower" type="Button" parent="."] +layout_mode = 0 +offset_left = 2.0 +offset_top = 2.0 +offset_right = 20.0 +offset_bottom = 24.0 +scale = Vector2(0.5, 0.5) +theme_override_colors/font_color = Color(0.80287457, 0.40096578, 0.15050122, 1) +theme_override_fonts/font = ExtResource("3_aosp1") +theme_override_font_sizes/font_size = 16 +text = "<" + +[node name="MenuButton" type="Button" parent="."] +layout_mode = 0 +offset_left = 198.0 +offset_right = 246.0 +offset_bottom = 23.0 +theme_override_fonts/font = ExtResource("2_742oq") +theme_override_font_sizes/font_size = 11 +text = "Menu" diff --git a/scripts/GameClasses.gd b/scripts/GameClasses.gd deleted file mode 100644 index af1faec..0000000 --- a/scripts/GameClasses.gd +++ /dev/null @@ -1,38 +0,0 @@ -# Plik: res://data/GameClasses.gd -extends Resource -class_name GameClasses # Użyjemy go do globalnego dostępu (jak Singleton dla klas) - -# ========================================================================= -# === 1. KLASA DANYCH PLANETY ============================================= -# ========================================================================= -class PlanetData extends Resource: - @export var name: String = "" - @export var size: int = 1 - @export var orbit_radius: float = 0.0 - @export var angle: float = 0.0 - @export var rotation_speed: float = 0.0 - @export var texture_path: String = "" - - func randomize_properties(): - size = randi_range(1, 5) - rotation_speed = randf_range(0.0001, 0.001) - var tex_id = randi_range(1, 18) - texture_path = "res://assets/planets/p%d.png" % tex_id - - -# ========================================================================= -# === 2. KLASA DANYCH GWIAZDY/SEKTORA ==================================== -# ========================================================================= -class StarData extends Resource: - @export var name: String = "" - @export var position: Vector2 = Vector2.ZERO - @export var type: String = "G2V" - @export var texture_path: String = "" - @export var planets: Array = [] # Lista obiektów PlanetData - - func randomize_properties(): - var types = ["O", "B", "A", "F", "G", "K", "M"] - type = types[randi() % types.size()] - var tex_id = randi_range(1, 3) - texture_path = "res://assets/stars/s%d.png" % tex_id - name = "Ziemia" diff --git a/scripts/GameClasses.gd.uid b/scripts/GameClasses.gd.uid deleted file mode 100644 index 0a76476..0000000 --- a/scripts/GameClasses.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://knplo8og2w4a diff --git a/scripts/GameData.gd b/scripts/GameData.gd index fd28616..615bbfb 100644 --- a/scripts/GameData.gd +++ b/scripts/GameData.gd @@ -1,3 +1,15 @@ extends Node var game_lunched = false +var game_time := 0.0 +var update_timer := 0.0 +func _ready(): + TranslationServer.set_locale(Settings.LANGUAGE) + +func _process(delta): + + game_time += delta * Settings.TIME_SCALE + #print(game_time) + update_timer += delta * Settings.TIME_SCALE + if update_timer >= Settings.UPDATE_INTERVAL: + update_timer = 0.0 diff --git a/scripts/camera_2d.gd b/scripts/camera_2d.gd index ce6216b..07e4ef4 100644 --- a/scripts/camera_2d.gd +++ b/scripts/camera_2d.gd @@ -1,7 +1,7 @@ extends Camera2D @export var speed := 500 # prędkość przesuwania -@export var zoom_speed := 0.1 # prędkość zoomu +@export var zoom_speed := 0.5 # prędkość zoomu func _process(delta): var move = Vector2.ZERO diff --git a/scripts/dictionary.gd b/scripts/dictionary.gd new file mode 100644 index 0000000..ef57b08 --- /dev/null +++ b/scripts/dictionary.gd @@ -0,0 +1,66 @@ +extends Node +const sector_names = [ + "Aetherion", "Altaris", "Andur System", "Artemis Reach", "Astrion", + "Azura Prime", "Borealis Expanse", "Caldris Belt", "Canthar System", "Celion Verge", + "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 = [ + "Aurion", "Belthar", "Cynos", "Dravus", "Elyth", "Farnor", "Glyria", "Hathor", "Ilyon", "Jovara", + "Klyss", "Lunaris", "Myrr", "Nethra", "Orionis", "Penthra", "Quaron", "Ravon", "Siriath", "Thalen", + "Urrax", "Veyra", "Worath", "Xynar", "Yllith", "Zorvan", "Aqmar", "Brenth", "Caelia", "Draxion", + "Enyra", "Falun", "Gravon", "Helior", "Iridra", "Jareth", "Karnis", "Lythra", "Mornis", "Neyra", + "Orryx", "Phaedon", "Quyra", "Rynor", "Sylen", "Taran", "Ulthor", "Vynath", "Wenor", "Xalun", + "Yndra", "Zerath", "Alyon", "Beryth", "Clyra", "Dornis", "Eryon", "Feyra", "Gornis", "Hyron", + "Ithra", "Joryn", "Kavon", "Lornis", "Meyra", "Nornis", "Olyth", "Pryon", "Qalor", "Rytha", + "Sornis", "Teyra", "Ulyth", "Vornis", "Weyra", "Xirra", "Yornis", "Zeyra", "Arax", "Blyth", + "Cerion", "Delyth", "Eron", "Fynor", "Geyra", "Hiron", "Ismar", "Jynar", "Koryth", "Lynor", + "Mythra", "Neyth", "Orryn", "Pynar", "Qorath", "Ryneth", "Syron", "Tynor", "Uryth", "Vylar", + "Woryn", "Xyneth", "Ylar", "Zyron", "Aethra", "Balor", "Cyneth", "Doryn", "Elyra", "Fylar", + "Gyron", "Hynis", "Ithos", "Jalor", "Kynis", "Lyra", "Maron", "Nytha", "Oryth", "Pheron", + "Qynis", "Ralon", "Synor", "Thyra", "Ulor", "Vanys", "Wyron", "Xynis", "Ythor", "Zynor", + "Aevra", "Boran", "Ceryn", "Dyrra", "Eranis", "Fynis", "Golar", "Hyrris", "Iryon", "Jovra", + "Kyrra", "Lyneth", "Myrra", "Norrin", "Orvra", "Pyneth", "Qyron", "Ryvra", "Syrrin", "Toryn", + "Ulyra", "Vynor", "Waryn", "Xyrris", "Yvra", "Zaryn", "Arion", "Belra", "Calon", "Delthar", + "Elyon", "Fornar", "Geyon", "Helra", "Irion", "Jelth", "Koryn", "Lunth", "Meyon", "Noryth", + "Olyra", "Pheon", "Quyron", "Rionis", "Seyth", "Torys", "Ulthar", "Veyron", "Wynor", "Xalon", + "Ythra", "Zynis", "Akris", "Byron", "Cyrron", "Deyra", "Ethon", "Fynar", "Gorrin", "Hyra", + "Irris", "Jorion", "Kavris", "Loryn", "Myrion", "Neyon", "Orris", "Pynor", "Qyrris", "Rheon", + "Sylon", "Tyrron", "Urris", "Vyrris", "Wyra", "Xynon", "Yvron", "Zyrra", "Aenor", "Beyra", + "Cynor", "Dyrion", "Eryth", "Fynon", "Garnis", "Heryth", "Ithion", "Jynor", "Keryn", "Lynis", + "Myron", "Neris", "Oryn", "Peyra", "Qyron", "Rynis", "Seyron", "Teryn", "Uryn", "Veyth", + "Wynis", "Xeron", "Yronis", "Zeyth", "Aoryn", "Boryth", "Cyrra", "Doryn", "Eryn", "Foryn", + "Geryth", "Horyn", "Ioryth", "Jeryn", "Koryth", "Leryn", "Moryn", "Noryn", "Oeryth", "Poryn", + "Qoryn", "Roryn", "Soryn", "Toryn", "Uoryn", "Voryn", "Woryn", "Xoryn", "Yoryn", "Zoryn", + "Altara", "Brionis", "Calyra", "Drethon", "Eonix", "Ferya", "Garnor", "Helyra", "Ionis", "Jarnis", + "Kalith", "Lyros", "Mythra", "Nelyon", "Orion", "Phalor", "Qeyra", "Rynon", "Saryn", "Talon", + "Ulyon", "Vorn", "Weyra", "Xylon", "Ylith", "Zarion", "Althos", "Beyon", "Cynis", "Deyon", + "Elyth", "Fornis", "Geyth", "Hynor", "Ilyon", "Jeyra", "Kynor", "Lorn", "Mynis", "Neyth", + "Orynth", "Pynis", "Qynor", "Rynith", "Sorn", "Tynis", "Urynth", "Vynis", "Wynis", "Xynor", + "Ynis", "Zynis", "Alyth", "Boryn", "Ceryth", "Dyrth", "Elyra", "Foryth", "Gynis", "Heryon", + "Iryth", "Jynis", "Keryth", "Loryth", "Mynith", "Neryth", "Olyth", "Peryth", "Qynith", "Roryth", + "Seryth", "Toryth", "Ulyth", "Veryth", "Woryth", "Xeryth", "Yeryth", "Zeryth", "Aenith", "Benor", + "Cynith", "Denor", "Enith", "Fenor", "Genith", "Henor", "Inith", "Jenor", "Kenith", "Lenor", + "Menith", "Nenor", "Oenith", "Penor", "Qenith", "Renor", "Senith", "Tenor", "Uenith", "Venor", + "Wenith", "Xenor", "Yenith", "Zenor", "Aelor", "Belor", "Celor", "Delor", "Elor", "Felor", + "Gelor", "Helor", "Ielor", "Jelor", "Kelon", "Lelor", "Melor", "Nelon", "Oelor", "Pelon", + "Qelor", "Relor", "Selor", "Telor", "Uelor", "Velor", "Welor", "Xelor", "Yelor", "Zelor" +] diff --git a/scripts/dictionary.gd.uid b/scripts/dictionary.gd.uid new file mode 100644 index 0000000..60e6a12 --- /dev/null +++ b/scripts/dictionary.gd.uid @@ -0,0 +1 @@ +uid://b28os2n0kielx diff --git a/scripts/galaxy.gd b/scripts/galaxy.gd index d9375ba..338a273 100644 --- a/scripts/galaxy.gd +++ b/scripts/galaxy.gd @@ -13,7 +13,7 @@ func _ready(): func _generate_galaxy(count: int): for i in range(count): var star = StarScene.instantiate() - star.star_name = "Star_" + str(i) + star.star_name = Names.sector_names[randi() % Names.sector_names.size()] 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)) @@ -22,7 +22,7 @@ func _generate_galaxy(count: int): # generowanie planet dla danej gwiazdy for j in range(star.planet_count): var planet = PlanetScene.instantiate() - planet.pname = "Planet_" + str(i) + "_" + str(j) + planet.pname = Names.planet_names[randi() % Names.planet_names.size()] planet.orbit_radius = 30 + j * 20 planet.orbit_speed = randf_range(0.01, 0.04) generate_planet_resources(planet) # <-- tu losujemy surowce diff --git a/scripts/planet.gd b/scripts/planet.gd index 5e22082..7705b6d 100644 --- a/scripts/planet.gd +++ b/scripts/planet.gd @@ -10,17 +10,17 @@ var resources := {} var texture: Texture2D var angle = randf() * TAU func _ready(): - print("Planeta: %s, surowiec: %s" % [pname, resources]) + #str(round(biosfere * 100) / 100.0) _update_position() func _process(delta): - angle += orbit_speed * delta # obrót w czasie + angle += orbit_speed * delta * Settings.TIME_SCALE # obrót w czasie angle = fmod(angle, TAU) # utrzymanie kąta w 0..2π _update_position() - print(pname, angle) - label.text = str(round(position * 100) / 100.0) + + label.text = str(pname) func _update_position(): # pozycja lokalna względem gwiazdy diff --git a/scripts/settings.gd b/scripts/settings.gd index 1db08a1..e75a4b0 100644 --- a/scripts/settings.gd +++ b/scripts/settings.gd @@ -1,15 +1,20 @@ extends Node -var language = 'pl' +const LANGUAGE = 'pl' var number_of_players = 1 + # Liczba sektorów w galaktyce -var NUMBER_OF_SYSTEMS: int = 14 +var NUMBER_OF_SYSTEMS: int = 44 const RESOURCE_TYPES = ["Iron", "Uran", "Titan", "Water"] #pozycja systemów -var x = 1900 -var y = 1000 +var x = 4000 +var y = 4000 #Ilosc systemów var min_planet = 1 var max_planet = 5 + +#Zmienen upływu czasu +var TIME_SCALE = 1 +const UPDATE_INTERVAL := 10.0 #Cykl w sekundach diff --git a/scripts/star.gd b/scripts/star.gd index 0715f66..2a9b2db 100644 --- a/scripts/star.gd +++ b/scripts/star.gd @@ -7,5 +7,5 @@ var planets: Array = [] var texture: Texture2D func _ready(): - print("Gwiazda %s z %d planetami" % [star_name, planet_count]) + #print("Gwiazda %s z %d planetami" % [star_name, planet_count]) label.text = star_name diff --git a/scripts/time_label.gd b/scripts/time_label.gd new file mode 100644 index 0000000..9462032 --- /dev/null +++ b/scripts/time_label.gd @@ -0,0 +1,39 @@ +extends Control + +@onready var time_label: Label = $TimeLabel +@onready var faster = $faster +@onready var slower = $slower +@onready var pause = $pause + +func _ready(): + faster.pressed.connect(_on_faster_pressed) + slower.pressed.connect(_on_slower_pressed) + pause.pressed.connect(_on_pause_pressed) + $MenuButton.pressed.connect(_on_menu_button_pressed) + +func _process(delta): + var total_days = int(GameData.game_time) + var numer_roku = 3980 + total_days / 365 + var day_of_year = total_days % 365 + var dzien_cykliczny: int + + if day_of_year == 0: + dzien_cykliczny = 0 + if total_days > 0: + numer_roku -= 1 + else: + dzien_cykliczny = day_of_year + var full_date = tr("time_display") + ": " + str(numer_roku) + "." + str(dzien_cykliczny) + time_label.text = full_date + +func _on_faster_pressed(): + if Settings.TIME_SCALE < 10: + Settings.TIME_SCALE +=1 +func _on_slower_pressed(): + if Settings.TIME_SCALE > 0: + Settings.TIME_SCALE -=1 +func _on_pause_pressed(): + Settings.TIME_SCALE = 0 + +func _on_menu_button_pressed(): + get_tree().change_scene_to_file("res://scenes/menu.tscn") diff --git a/scripts/time_label.gd.uid b/scripts/time_label.gd.uid new file mode 100644 index 0000000..956bf2a --- /dev/null +++ b/scripts/time_label.gd.uid @@ -0,0 +1 @@ +uid://dxky82mepun1j