From eef7ce0677f534de9223b96e129b2d223d611bad Mon Sep 17 00:00:00 2001 From: Tomasz Boruc Date: Mon, 10 Nov 2025 20:45:40 +0100 Subject: [PATCH] Drag panel, occupy ssytem --- assets/tech/terraforming.png | Bin 0 -> 8475 bytes assets/tech/terraforming.png.import | 40 +++++++++++++++ scenes/galaxy.tscn | 13 +++-- scenes/star.tscn | 10 +++- scenes/station.tscn | 9 ++++ scenes/tech_panel.tscn25828147014.tmp | 67 ++++++++++++++++++++++++++ scenes/top_panel.tscn | 5 +- scenes/top_panel.tscn22481600950.tmp | 43 +++++++++++++++++ scripts/BuildingsList.gd | 13 ++++- scripts/GameData.gd | 1 + scripts/galaxy.gd | 2 +- scripts/planet_panel.gd | 16 ++++++ scripts/settings.gd | 2 +- scripts/star.gd | 24 ++++++++- scripts/tech_panel.gd | 17 +++++++ scripts/technologies.gd | 15 ++++++ scripts/top_panel.gd | 20 ++++++-- 17 files changed, 279 insertions(+), 18 deletions(-) create mode 100644 assets/tech/terraforming.png create mode 100644 assets/tech/terraforming.png.import create mode 100644 scenes/station.tscn create mode 100644 scenes/tech_panel.tscn25828147014.tmp create mode 100644 scenes/top_panel.tscn22481600950.tmp diff --git a/assets/tech/terraforming.png b/assets/tech/terraforming.png new file mode 100644 index 0000000000000000000000000000000000000000..c64fb3f7ba5738dcdb7bd328a892b3d2697911f4 GIT binary patch literal 8475 zcmV+$A>`hPP)z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(E&0000<=P#20000SaNLh0L01m?d01m?e$8V@)00007 zbV*G`2k8q65*Q+_E1x_703ZNKL_t(&-c_4dlVsU-oxgp~xh`F0mT%uZJsuc`0Volo z5d~2UMerX;KL&qBp$EO{g_I}~APfT_fEmmT#&=J<>T+4>uRBf;H+x8C#f{9Uh|IX> z?tS)NYp-?W?!A{|+qSHhYl06z03sp+fFP)-Kxu;L?p-NFDWX=O1SJNe6EF(V3S|@t zp2V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ovXxK(;J2#7GPPzN-ZRqE?7bNb>?U+~?r_ z%e?;XJFI3KzWn$LHtQMHYE4^jy7K50k%&QLigoZbWrdC&(_F1^O~Z1z#9vJD zCMWcJP~^0&C$=4&v_Z28iiP!jwOH`_?toYC-y%P`PJ)f` z+msI5vlQ}gE8P~Yb&o?S1&KjSiev?Y!z1p#`8Jbl*Ld{!3FXzCajUuZPS4o+ahn>xDkUE8V_wy zr~rAMqqhYEgrEhlgb=#6k&4jj49Rl9GD;%7G{rWSYO!FoTy)+dmE0q$Jpz@T#?u7C6JB)XCX{~2d*0`#ssY`6z5ZZ=dE#CVrsp(o-H=yZA z49?=MBL>%T_7IT!$JZiTsPAKkgtXEalfa7#n`olagzfnyEeWXZ#7oqj^}#4bN_WKn z|3F0m002`-L_t&rB2{at>IT2PsSrFacsw1nj9&4=x{T4JS;1&$m%(^MI_M**!Fs5x z8dtZtwk0^*Su&g>*lpzwuH)ErW8|=9UMhHk@9Y~fyg+o3{|`b@Il)y|T;%`&002ov JPDHLkV1ntb{*M3v literal 0 HcmV?d00001 diff --git a/assets/tech/terraforming.png.import b/assets/tech/terraforming.png.import new file mode 100644 index 0000000..9ba5824 --- /dev/null +++ b/assets/tech/terraforming.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://w5towk2sfjfo" +path="res://.godot/imported/terraforming.png-1954eff5d8d95abd1e9b21927440fa2d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/tech/terraforming.png" +dest_files=["res://.godot/imported/terraforming.png-1954eff5d8d95abd1e9b21927440fa2d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/galaxy.tscn b/scenes/galaxy.tscn index d859a81..dc88a3d 100644 --- a/scenes/galaxy.tscn +++ b/scenes/galaxy.tscn @@ -77,13 +77,12 @@ offset_bottom = -1384.0 [node name="TopPanel" parent="UI" instance=ExtResource("8_0pfb5")] offset_left = -18.0 offset_top = -26.0 -offset_right = 2022.0 -offset_bottom = 78.0 +offset_right = 1574.0 +offset_bottom = 142.0 size_flags_horizontal = 0 [node name="TechPanel" parent="UI" instance=ExtResource("9_lwv00")] -visible = false -offset_left = -1023.44006 -offset_top = -507.12006 -offset_right = -367.44006 -offset_bottom = -331.12006 +offset_left = -1031.4401 +offset_top = -379.12006 +offset_right = -375.44006 +offset_bottom = -203.12006 diff --git a/scenes/star.tscn b/scenes/star.tscn index 821ae5e..19ec1fa 100644 --- a/scenes/star.tscn +++ b/scenes/star.tscn @@ -1,10 +1,13 @@ -[gd_scene load_steps=5 format=3 uid="uid://cvc0brcqh2rhu"] +[gd_scene load_steps=6 format=3 uid="uid://cvc0brcqh2rhu"] [ext_resource type="Script" uid="uid://c7l387xor12hx" path="res://scripts/star.gd" id="1_mcqwg"] [ext_resource type="Texture2D" uid="uid://dsfxgajg3jodv" path="res://assets/stars/s3.png" id="2_8d8bx"] [ext_resource type="Script" uid="uid://bgghdcbxp6o0k" path="res://scripts/star_sprite.gd" id="3_ef0hr"] [ext_resource type="FontFile" uid="uid://chk8jrn2ighpx" path="res://assets/fonts/main_font.ttf" id="4_8d8bx"] +[sub_resource type="CircleShape2D" id="CircleShape2D_8d8bx"] +radius = 614.64 + [node name="Star" type="Node2D"] script = ExtResource("1_mcqwg") @@ -13,6 +16,11 @@ scale = Vector2(0.0371471, 0.0371471) texture = ExtResource("2_8d8bx") script = ExtResource("3_ef0hr") +[node name="Area2D" type="Area2D" parent="Sprite2D"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite2D/Area2D"] +shape = SubResource("CircleShape2D_8d8bx") + [node name="Label" type="Label" parent="."] offset_left = -53.0 offset_top = 34.0 diff --git a/scenes/station.tscn b/scenes/station.tscn new file mode 100644 index 0000000..31457c4 --- /dev/null +++ b/scenes/station.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://bhuvrdvcm6exi"] + +[ext_resource type="Texture2D" uid="uid://c1npf2gngyyxp" path="res://assets/buildings/starbase.png" id="1_rod8h"] + +[node name="Station" type="Node2D"] + +[node name="Sprite2D" type="Sprite2D" parent="."] +scale = Vector2(0.023437498, 0.023437498) +texture = ExtResource("1_rod8h") diff --git a/scenes/tech_panel.tscn25828147014.tmp b/scenes/tech_panel.tscn25828147014.tmp new file mode 100644 index 0000000..69382f8 --- /dev/null +++ b/scenes/tech_panel.tscn25828147014.tmp @@ -0,0 +1,67 @@ +[gd_scene load_steps=4 format=3 uid="uid://bitiuqh8lb0ga"] + +[ext_resource type="Script" uid="uid://bsdypct22eu23" path="res://scripts/tech_panel.gd" id="1_qc7t1"] +[ext_resource type="FontFile" uid="uid://chk8jrn2ighpx" path="res://assets/fonts/main_font.ttf" id="2_5new4"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sqypy"] +bg_color = Color(0.69411767, 0.32156864, 0.08235294, 0.37254903) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.7988825, 0.55350196, 0.19976625, 1) +corner_radius_top_left = 2 +corner_radius_top_right = 2 +corner_radius_bottom_right = 2 +corner_radius_bottom_left = 2 + +[node name="TechPanel" type="Panel"] +anchors_preset = -1 +anchor_left = 0.499 +anchor_top = 0.37300003 +anchor_right = 0.499 +anchor_bottom = 0.37300003 +offset_left = -612.44006 +offset_top = -241.70401 +offset_right = 47.559937 +offset_bottom = 259.88 +grow_vertical = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +theme_override_styles/panel = SubResource("StyleBoxFlat_sqypy") +script = ExtResource("1_qc7t1") + +[node name="Tech_Label" type="Label" parent="."] +layout_mode = 0 +offset_left = 5.0 +offset_top = 3.0 +offset_right = 393.0 +offset_bottom = 24.0 +theme_override_fonts/font = ExtResource("2_5new4") +theme_override_font_sizes/font_size = 16 +text = "Technologie" +horizontal_alignment = 1 + +[node name="Technologies" type="GridContainer" parent="."] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 15.0 +offset_top = -56.0 +offset_right = -11.0 +offset_bottom = -8.0 +grow_horizontal = 2 +grow_vertical = 0 +columns = 4 + +[node name="Button" type="Button" parent="."] +layout_mode = 0 +offset_left = 614.0 +offset_top = 6.583954 +offset_right = 653.0 +offset_bottom = 39.167908 +text = "X" + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] diff --git a/scenes/top_panel.tscn b/scenes/top_panel.tscn index fe5d9ea..55689f2 100644 --- a/scenes/top_panel.tscn +++ b/scenes/top_panel.tscn @@ -19,15 +19,17 @@ theme_override_constants/separation = 10 layout_mode = 2 text = "Player name" -[node name="IronLabel" type="Label" parent="HBoxContainer"] +[node name="ResLabel" type="Label" parent="HBoxContainer"] layout_mode = 2 text = "ddfdf" [node name="WaterLabel" type="Label" parent="HBoxContainer"] +visible = false layout_mode = 2 text = "ddfdf" [node name="CopperLabel" type="Label" parent="HBoxContainer"] +visible = false layout_mode = 2 text = "ddfdf" @@ -36,5 +38,6 @@ layout_mode = 2 text = "Technologies" [node name="SinceLabel" type="Label" parent="HBoxContainer"] +visible = false layout_mode = 2 text = "ddfdf" diff --git a/scenes/top_panel.tscn22481600950.tmp b/scenes/top_panel.tscn22481600950.tmp new file mode 100644 index 0000000..55689f2 --- /dev/null +++ b/scenes/top_panel.tscn22481600950.tmp @@ -0,0 +1,43 @@ +[gd_scene load_steps=2 format=3 uid="uid://c405r414rsut2"] + +[ext_resource type="Script" uid="uid://c5s1b0ctj8pvl" path="res://scripts/top_panel.gd" id="1_85l1y"] + +[node name="TopPanel" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 +script = ExtResource("1_85l1y") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +theme_override_constants/separation = 10 + +[node name="PlayerName" type="Label" parent="HBoxContainer"] +layout_mode = 2 +text = "Player name" + +[node name="ResLabel" type="Label" parent="HBoxContainer"] +layout_mode = 2 +text = "ddfdf" + +[node name="WaterLabel" type="Label" parent="HBoxContainer"] +visible = false +layout_mode = 2 +text = "ddfdf" + +[node name="CopperLabel" type="Label" parent="HBoxContainer"] +visible = false +layout_mode = 2 +text = "ddfdf" + +[node name="Technologies" type="Button" parent="HBoxContainer"] +layout_mode = 2 +text = "Technologies" + +[node name="SinceLabel" type="Label" parent="HBoxContainer"] +visible = false +layout_mode = 2 +text = "ddfdf" diff --git a/scripts/BuildingsList.gd b/scripts/BuildingsList.gd index 3564953..e8ceb31 100644 --- a/scripts/BuildingsList.gd +++ b/scripts/BuildingsList.gd @@ -71,7 +71,7 @@ var BUILDINGS = { "cost": {"iron": 10}, "build_time": 5.0, "texture": "res://assets/buildings/terraforming_center.png", - "required_tech": null + "required_tech": "terraforming" }, "laboratory": { "name": "Laboratory", @@ -84,6 +84,17 @@ var BUILDINGS = { "build_time": 5.0, "texture": "res://assets/buildings/labolatory.png", "required_tech": null + }, + + "aluminium_ore_mine": { + "name": "Aluminium ore mine", + "description": "Wydobywa boksyt.", + "resource": "aluminium", + "cost": {"iron": 100, "copper": 100}, + "bonuses": {"biosfere": 0.1}, + "build_time": 15.0, + "texture": "res://assets/buildings/aluminium_ore_mine.png", + "required_tech": "advanced_mining" } } diff --git a/scripts/GameData.gd b/scripts/GameData.gd index 4641bea..2ee52ca 100644 --- a/scripts/GameData.gd +++ b/scripts/GameData.gd @@ -24,3 +24,4 @@ func format_number(num: int) -> String: if count % 3 == 0 and i != 0: result = "." + result return result + diff --git a/scripts/galaxy.gd b/scripts/galaxy.gd index f729496..bdf154c 100644 --- a/scripts/galaxy.gd +++ b/scripts/galaxy.gd @@ -60,7 +60,7 @@ func _generate_galaxy(count: int): for j in range(star.planet_count): var planet = PlanetScene.instantiate() planet.pname = Names.planet_names[randi() % Names.planet_names.size()] - planet.orbit_radius = 55 + j * 40 + planet.orbit_radius = 65 + j * 40 planet.orbit_speed = randf_range(0.004, 0.01) planet.since_potential = 0.1 + (2.0 - 0.1) * pow(randf(), 4.0) planet.size = randi_range(1, 3) diff --git a/scripts/planet_panel.gd b/scripts/planet_panel.gd index 47162eb..80d211a 100644 --- a/scripts/planet_panel.gd +++ b/scripts/planet_panel.gd @@ -5,6 +5,22 @@ extends Panel @onready var buildings_container = $Buildings @onready var send_button = $SendButton +var dragging := false +var drag_offset := Vector2.ZERO + +func _gui_input(event): + if event is InputEventMouseButton: + if event.button_index == MOUSE_BUTTON_LEFT: + if event.pressed: + # Kliknięto na panel → zaczynamy drag + dragging = true + drag_offset = get_local_mouse_position() + else: + # Zwolniono przycisk → kończymy drag + dragging = false + elif event is InputEventMouseMotion and dragging: + # Przesuwamy panel względem pozycji myszy + position += event.relative func _ready(): send_button.connect("pressed", Callable(self, "_on_send_resources_pressed")) diff --git a/scripts/settings.gd b/scripts/settings.gd index d7f3c2d..33b0c1b 100644 --- a/scripts/settings.gd +++ b/scripts/settings.gd @@ -15,7 +15,7 @@ const MARGIN: float = 50.0 var NUMBER_OF_SYSTEMS: int = 100 #Ilosc systemów var min_planet = 1 -var max_planet = 7 +var max_planet = 5 #Zmiana upływu czasu #var TIME_SCALE = 1 diff --git a/scripts/star.gd b/scripts/star.gd index 229243a..2237f1a 100644 --- a/scripts/star.gd +++ b/scripts/star.gd @@ -6,6 +6,11 @@ class_name Star @export var thickness: float = 0.5 # Grubość linii konturu @export var segments: int = 64 @onready var label = $Label +@onready var system_owner = "" +@onready var station_scene = preload("res://scenes/Station.tscn") # scena stacji kosmicznej +var has_station: bool = false +var station_sprite: Sprite2D = null + @export var star_name: String = "" @export var planet_count: int = 0 var planets: Array = [] @@ -14,7 +19,8 @@ var texture: Texture2D func _ready(): #print("Gwiazda %s z %d planetami" % [star_name, planet_count]) label.text = star_name - + var area = $Sprite2D/Area2D + area.connect("input_event", Callable(self, "_on_area_input")) # Stała do rysowania pełnego okręgu const TAU = 6.2831853 # 2 * PI @@ -31,3 +37,19 @@ func _draw(): color, thickness ) + +func _on_area_input(viewport, event, shape_idx): + if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed: + capture_system(PlayerData.PlayerName) + print("System przejęty przez:", system_owner) + +func capture_system(player_name: String) -> void: + if system_owner != "": + return # już przejęty + system_owner = player_name + + # Dodaj stację kosmiczną obok gwiazdy + var station = station_scene.instantiate() + station.position = position + Vector2(35, 0) # obok gwiazdy + label.add_theme_color_override("font_color", Color(0.788, 0.332, 0.196, 1.0)) + get_parent().add_child(station) diff --git a/scripts/tech_panel.gd b/scripts/tech_panel.gd index e1d5053..945eb66 100644 --- a/scripts/tech_panel.gd +++ b/scripts/tech_panel.gd @@ -7,6 +7,23 @@ extends Panel # Ścieżka do tekstur technologii (tu możesz dać swoje grafiki) const DEFAULT_ICON = preload("res://assets/tech/Mining_Drill.png") +var dragging := false +var drag_offset := Vector2.ZERO + +func _gui_input(event): + if event is InputEventMouseButton: + if event.button_index == MOUSE_BUTTON_LEFT: + if event.pressed: + # Kliknięto na panel → zaczynamy drag + dragging = true + drag_offset = get_local_mouse_position() + else: + # Zwolniono przycisk → kończymy drag + dragging = false + elif event is InputEventMouseMotion and dragging: + # Przesuwamy panel względem pozycji myszy + position += event.relative + func _ready(): _create_technology_buttons() diff --git a/scripts/technologies.gd b/scripts/technologies.gd index 961ba4d..87dc014 100644 --- a/scripts/technologies.gd +++ b/scripts/technologies.gd @@ -28,5 +28,20 @@ const TECHNOLOGIES = { "water_efficiency": 1.15 }, "requires": ["advanced_mining"] + }, + "terraforming": { + "name": "Terraforming", + "description": "Allow terreforming planet", + "time": 10, + "cost": { + "science": 10, + "iron": 5, + "aluminium":10 + }, + "texture": "res://assets/tech/terraforming.png", + "unlock_effects": { + "water_efficiency": 1.15 + }, + "requires": ["hydro_engineering"] } } diff --git a/scripts/top_panel.gd b/scripts/top_panel.gd index 20e1f06..6affe05 100644 --- a/scripts/top_panel.gd +++ b/scripts/top_panel.gd @@ -2,7 +2,7 @@ extends Control @onready var label_player_name = $HBoxContainer/PlayerName #@onready var label_science = $HBoxContainer/LabelScience -@onready var label_iron = $HBoxContainer/IronLabel +@onready var ResLabel = $HBoxContainer/ResLabel @onready var label_water = $HBoxContainer/WaterLabel @onready var label_copper = $HBoxContainer/CopperLabel @onready var label_since = $HBoxContainer/SinceLabel @@ -13,10 +13,20 @@ func update_info(): label_player_name.text = "Gracz: %s" % PlayerData.PlayerName #label_science.text = "🔬 Nauka: %s" % player.science - label_iron.text = "%s: %.2f" % [tr("iron"), PlayerData.resources.iron] - label_water.text = "%s: %.2f" % [tr("water"), PlayerData.resources.water] - label_copper.text = "%s: %.2f" % [tr("copper"), PlayerData.resources.copper] - label_since.text = "%s: %.2f" % [tr("since"), PlayerData.since_doc] + var text = "" + + for res_name in PlayerData.resources.keys(): + var amount = PlayerData.resources[res_name] + # Pomiń surowce zerowe jeśli chcesz + if amount == 0: + continue + text += "%s: %.2f " % [tr(res_name.capitalize()), amount] + + # Dodaj też since_doc + text += "\n%s: %.2f" % [tr("since"), PlayerData.since_doc] + + # Przypisz do jednego labelka + ResLabel.text = text #label_population.text = "👥 Populacja: %s" % GameData.format_number(player.total_population)