This commit is contained in:
Tomasz Boruc 2025-11-21 17:56:34 +01:00
commit 5b48950451
18 changed files with 405 additions and 24 deletions

BIN
assets/ships/battleship.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

View File

@ -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

BIN
assets/ships/colony.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

View File

@ -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

BIN
assets/ships/destroyer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

View File

@ -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

BIN
assets/ships/fighter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

View File

@ -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

BIN
assets/ships/miner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 KiB

View File

@ -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

BIN
assets/ships/science.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

View File

@ -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

BIN
assets/ships/scout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

View File

@ -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

View File

@ -28,22 +28,6 @@ offset_bottom = 35.0
text = "Nazwa stacji" text = "Nazwa stacji"
horizontal_alignment = 1 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="."] [node name="Button2" type="Button" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 770.0 offset_left = 770.0
@ -52,6 +36,9 @@ offset_right = 799.0
offset_bottom = 39.0 offset_bottom = 39.0
text = "X" text = "X"
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] [node name="ShipContainer" type="VBoxContainer" parent="."]
[connection signal="pressed" from="Button3" to="." method="_on_button_3_pressed"] layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"] [connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"]

View File

@ -16,5 +16,5 @@ func setup(type):
$Sprite2D.texture = texture $Sprite2D.texture = texture
func _process(delta: float) -> void: func _process(delta: float) -> void:
#position += direction * speed * delta position += direction * speed * delta
pass pass

View File

@ -8,6 +8,7 @@ const SHIP_TYPES = {
"required_tech": null, "required_tech": null,
"texture": "res://assets/ships/transport.png" "texture": "res://assets/ships/transport.png"
}, },
"frigate": { "frigate": {
"name": "Frigate", "name": "Frigate",
"cost": {"iron": 10, "copper": 10}, "cost": {"iron": 10, "copper": 10},
@ -16,5 +17,84 @@ const SHIP_TYPES = {
"hp": 50, "hp": 50,
"required_tech": null, "required_tech": null,
"texture": "res://assets/ships/fregata.png" "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"
} }
} }

View File

@ -20,6 +20,40 @@ func _gui_input(event):
var current_station = null 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): func show_for_station(station):
self.visible = true self.visible = true
@ -30,11 +64,11 @@ func _on_button_2_pressed() -> void:
self.visible = false self.visible = false
func _on_button_pressed() -> void: #func _on_button_pressed() -> void:
build_ship("frigate") #build_ship("frigate")
#
func _on_button_3_pressed() -> void: #func _on_button_3_pressed() -> void:
build_ship("transport") #build_ship("transport")