diff --git a/assets/ships/battleship.png b/assets/ships/battleship.png new file mode 100644 index 0000000..1cd81fe Binary files /dev/null and b/assets/ships/battleship.png differ diff --git a/assets/ships/battleship.png.import b/assets/ships/battleship.png.import new file mode 100644 index 0000000..98130f9 --- /dev/null +++ b/assets/ships/battleship.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dkgbcea27iuoi" +path="res://.godot/imported/battleship.png-0b4ca2bba4bff217263932adecea270f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ships/battleship.png" +dest_files=["res://.godot/imported/battleship.png-0b4ca2bba4bff217263932adecea270f.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/assets/ships/colony.png b/assets/ships/colony.png new file mode 100644 index 0000000..39e4774 Binary files /dev/null and b/assets/ships/colony.png differ diff --git a/assets/ships/colony.png.import b/assets/ships/colony.png.import new file mode 100644 index 0000000..6994a80 --- /dev/null +++ b/assets/ships/colony.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://duq723fh3pdjl" +path="res://.godot/imported/colony.png-a0f6d88eab11ff197efa1fedf1fa528a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ships/colony.png" +dest_files=["res://.godot/imported/colony.png-a0f6d88eab11ff197efa1fedf1fa528a.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/assets/ships/destroyer.png b/assets/ships/destroyer.png new file mode 100644 index 0000000..810fc9d Binary files /dev/null and b/assets/ships/destroyer.png differ diff --git a/assets/ships/destroyer.png.import b/assets/ships/destroyer.png.import new file mode 100644 index 0000000..8a1306f --- /dev/null +++ b/assets/ships/destroyer.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cjma6wqxe1b1n" +path="res://.godot/imported/destroyer.png-830682585e99de22637408bc2e4f47bd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ships/destroyer.png" +dest_files=["res://.godot/imported/destroyer.png-830682585e99de22637408bc2e4f47bd.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/assets/ships/fighter.png b/assets/ships/fighter.png new file mode 100644 index 0000000..e92beeb Binary files /dev/null and b/assets/ships/fighter.png differ diff --git a/assets/ships/fighter.png.import b/assets/ships/fighter.png.import new file mode 100644 index 0000000..d4bfa01 --- /dev/null +++ b/assets/ships/fighter.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b60jj5nmjky5s" +path="res://.godot/imported/fighter.png-f36dd3833282936b03c4acda3b43ba11.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ships/fighter.png" +dest_files=["res://.godot/imported/fighter.png-f36dd3833282936b03c4acda3b43ba11.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/assets/ships/miner.png b/assets/ships/miner.png new file mode 100644 index 0000000..2f6bda3 Binary files /dev/null and b/assets/ships/miner.png differ diff --git a/assets/ships/miner.png.import b/assets/ships/miner.png.import new file mode 100644 index 0000000..f78b5a4 --- /dev/null +++ b/assets/ships/miner.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d4ayclmbqiogn" +path="res://.godot/imported/miner.png-57380b1b2778c6bcc88bb3ba5d5a3251.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ships/miner.png" +dest_files=["res://.godot/imported/miner.png-57380b1b2778c6bcc88bb3ba5d5a3251.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/assets/ships/science.png b/assets/ships/science.png new file mode 100644 index 0000000..2ab281d Binary files /dev/null and b/assets/ships/science.png differ diff --git a/assets/ships/science.png.import b/assets/ships/science.png.import new file mode 100644 index 0000000..a512e9b --- /dev/null +++ b/assets/ships/science.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://8ww8o6bo4d4b" +path="res://.godot/imported/science.png-9a81d98d7ee09f2b7b9ca471b8ff3f91.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ships/science.png" +dest_files=["res://.godot/imported/science.png-9a81d98d7ee09f2b7b9ca471b8ff3f91.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/assets/ships/scout.png b/assets/ships/scout.png new file mode 100644 index 0000000..61280be Binary files /dev/null and b/assets/ships/scout.png differ diff --git a/assets/ships/scout.png.import b/assets/ships/scout.png.import new file mode 100644 index 0000000..c9ec676 --- /dev/null +++ b/assets/ships/scout.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bvhe0u6gcbplv" +path="res://.godot/imported/scout.png-a0d0a247c7438d367f596f56c9c800e2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ships/scout.png" +dest_files=["res://.godot/imported/scout.png-a0d0a247c7438d367f596f56c9c800e2.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/station_panel.tscn b/scenes/station_panel.tscn index a1af120..e30185b 100644 --- a/scenes/station_panel.tscn +++ b/scenes/station_panel.tscn @@ -28,22 +28,6 @@ offset_bottom = 35.0 text = "Nazwa stacji" horizontal_alignment = 1 -[node name="Button" type="Button" parent="."] -layout_mode = 0 -offset_left = 40.0 -offset_top = 100.0 -offset_right = 221.0 -offset_bottom = 140.0 -text = "Zbuduj fregatę" - -[node name="Button3" type="Button" parent="."] -layout_mode = 0 -offset_left = 38.0 -offset_top = 152.0 -offset_right = 195.0 -offset_bottom = 192.0 -text = "Zbuduj transportowiec" - [node name="Button2" type="Button" parent="."] layout_mode = 0 offset_left = 770.0 @@ -52,6 +36,9 @@ offset_right = 799.0 offset_bottom = 39.0 text = "X" -[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] -[connection signal="pressed" from="Button3" to="." method="_on_button_3_pressed"] +[node name="ShipContainer" type="VBoxContainer" parent="."] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + [connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"] diff --git a/scripts/ship.gd b/scripts/ship.gd index ac6071f..b8e8494 100644 --- a/scripts/ship.gd +++ b/scripts/ship.gd @@ -16,5 +16,5 @@ func setup(type): $Sprite2D.texture = texture func _process(delta: float) -> void: - #position += direction * speed * delta + position += direction * speed * delta pass diff --git a/scripts/ships_type.gd b/scripts/ships_type.gd index cf173fa..c5b2638 100644 --- a/scripts/ships_type.gd +++ b/scripts/ships_type.gd @@ -8,6 +8,7 @@ const SHIP_TYPES = { "required_tech": null, "texture": "res://assets/ships/transport.png" }, + "frigate": { "name": "Frigate", "cost": {"iron": 10, "copper": 10}, @@ -16,5 +17,84 @@ const SHIP_TYPES = { "hp": 50, "required_tech": null, "texture": "res://assets/ships/fregata.png" + }, + + # 1. Destroyer + "destroyer": { + "name": "Destroyer", + "cost": {"iron": 20, "copper": 15}, + "speed": 2, + "attack": 20, + "hp": 70, + "required_tech": null, + "texture": "res://assets/ships/destroyer.png" + }, + + + + # 3. Battleship + "battleship": { + "name": "Battleship", + "cost": {"iron": 80, "copper": 40, "uranium": 20}, + "speed": 2, + "attack": 80, + "hp": 400, + "required_tech": null, + "texture": "res://assets/ships/battleship.png" + }, + + # 4. Colony Ship + "colony_ship": { + "name": "Colony Ship", + "cost": {"iron": 30}, + "speed": 9, + "cargo_capacity": 200, + "required_tech": null, + "texture": "res://assets/ships/colony.png" + }, + + # 5. Scout + "scout": { + "name": "Scout", + "cost": {"iron": 5}, + "speed": 20, + "attack": 2, + "hp": 10, + "required_tech": null, + "texture": "res://assets/ships/scout.png" + }, + + # 6. Miner + "miner": { + "name": "Mining Ship", + "cost": {"iron": 12, "copper": 5}, + "speed": 3, + "cargo_capacity": 100, + "mining_power": 5, + "required_tech": null, + "texture": "res://assets/ships/miner.png" + }, + + + + # 8. Fighter + "fighter": { + "name": "Fighter", + "cost": {"iron": 3, "copper": 1}, + "speed": 14, + "attack": 8, + "hp": 15, + "required_tech": null, + "texture": "res://assets/ships/fighter.png" + }, + + # 9. Science Ship + "science_ship": { + "name": "Science Ship", + "cost": {"iron": 15}, + "speed": 11, + "research_bonus": 10, + "required_tech": null, + "texture": "res://assets/ships/science.png" } } diff --git a/scripts/station_panel.gd b/scripts/station_panel.gd index dcc69ff..ad2fa9e 100644 --- a/scripts/station_panel.gd +++ b/scripts/station_panel.gd @@ -20,6 +20,40 @@ func _gui_input(event): var current_station = null +@onready var ships_container = $ShipContainer + +func _ready(): + generate_ship_buttons() + +func generate_ship_buttons(): + # Usuwamy stare guziki + for c in ships_container.get_children(): + c.queue_free() + + # Pobieramy statki z autoloadu + var all_ships = ShipsType.SHIP_TYPES + + # Pobieramy odblokowane technologie gracza + var unlocked = PlayerData.unlocked_techs + + for ship_id in all_ships.keys(): + var data = all_ships[ship_id] + + # 1. Sprawdzenie technologii + if data.required_tech != null and not unlocked.has(data.required_tech): + continue + + # 2. Tworzymy guzik + var btn = Button.new() + btn.text = data.name + + # 3. Podpinamy akcję + btn.pressed.connect(func(): + build_ship(ship_id) + ) + + # 4. Dodajemy do UI + ships_container.add_child(btn) func show_for_station(station): self.visible = true @@ -30,11 +64,11 @@ func _on_button_2_pressed() -> void: self.visible = false -func _on_button_pressed() -> void: - build_ship("frigate") - -func _on_button_3_pressed() -> void: - build_ship("transport") +#func _on_button_pressed() -> void: + #build_ship("frigate") + # +#func _on_button_3_pressed() -> void: + #build_ship("transport")