HUD ekwipunku
This commit is contained in:
parent
ee06adbbf4
commit
d5a214d325
@ -43,7 +43,7 @@ Statek operuje na trzech głównych zasobach kontrolowanych przez dedykowane kom
|
|||||||
- Tarcza (Shield): Pierwsza linia obrony. Pochłania obrażenia przed kadłubem. Odnawia się
|
- Tarcza (Shield): Pierwsza linia obrony. Pochłania obrażenia przed kadłubem. Odnawia się
|
||||||
automatycznie po krótkim czasie bez przyjmowania obrażeń (modyfikowane przez moduły).
|
automatycznie po krótkim czasie bez przyjmowania obrażeń (modyfikowane przez moduły).
|
||||||
- Energia (Energy): Zasób zużywany podczas strzału z broni (LPM / PPM) oraz aktywacji
|
- Energia (Energy): Zasób zużywany podczas strzału z broni (LPM / PPM) oraz aktywacji
|
||||||
modułów (klawisze 1-5). Wyczyszczenie paska energii do 0 blokuje możliwość ataku
|
modułów (klawisze 1-6). Wyczyszczenie paska energii do 0 blokuje możliwość ataku
|
||||||
i używania umiejętności do momentu podregenerowania. Odnawiana głównie przez generatory
|
i używania umiejętności do momentu podregenerowania. Odnawiana głównie przez generatory
|
||||||
i moduły pasywne.
|
i moduły pasywne.
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ Statek operuje na trzech głównych zasobach kontrolowanych przez dedykowane kom
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Sloty Statku:
|
Sloty Statku:
|
||||||
- 2 Sloty Broni: Przypisane do LPM (Broń 1) oraz PPM (Broń 2).
|
- 2 Sloty Broni: Przypisane do LPM (Broń 1) oraz PPM (Broń 2).
|
||||||
- 5 Slotów Modułów: Przypisane do klawiszy 1, 2, 3, 4, 5. Pozwalają na montaż modułów
|
- 6 Slotów Modułów: Przypisane do klawiszy 1, 2, 3, 4, 5, 6. Pozwalają na montaż modułów
|
||||||
pasywnych lub aktywnych umiejętności.
|
pasywnych lub aktywnych umiejętności.
|
||||||
- Ładownia (Cargo): Siatka 20 slotów na nieużywane przedmioty.
|
- Ładownia (Cargo): Siatka 20 slotów na nieużywane przedmioty.
|
||||||
- Obsługa UI: Przenoszenie przedmiotów pomiędzy ładownią a slotami wyposażenia odbywa się
|
- Obsługa UI: Przenoszenie przedmiotów pomiędzy ładownią a slotami wyposażenia odbywa się
|
||||||
@ -254,7 +254,7 @@ PODSUMOWANIE MOCOWE BRONI (POZIOM 1)
|
|||||||
X. ROZSZERZENIA (EXTENSIONS) - MODUŁY PASYWNE I SKILLOWE
|
X. ROZSZERZENIA (EXTENSIONS) - MODUŁY PASYWNE I SKILLOWE
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Moduły z kategorii Rozszerzenie (Extension) montowane są w slotach 1–5.
|
Moduły z kategorii Rozszerzenie (Extension) montowane są w slotach 1–6.
|
||||||
Dzielą się na dwa typy:
|
Dzielą się na dwa typy:
|
||||||
- Pasywne: Dają stały bonus do statystyk statku lub broni.
|
- Pasywne: Dają stały bonus do statystyk statku lub broni.
|
||||||
- Aktywne (Umiejętności): Wymagają aktywacji klawiszem (1-5), zużywają energię
|
- Aktywne (Umiejętności): Wymagają aktywacji klawiszem (1-5), zużywają energię
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=9 format=3]
|
[gd_scene load_steps=10 format=3]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/game/game.gd" id="1_game"]
|
[ext_resource type="Script" path="res://scripts/game/game.gd" id="1_game"]
|
||||||
[ext_resource type="Script" path="res://scripts/game/space_level_background.gd" id="2_background"]
|
[ext_resource type="Script" path="res://scripts/game/space_level_background.gd" id="2_background"]
|
||||||
[ext_resource type="PackedScene" path="res://scenes/game/player_ship.tscn" id="3_player"]
|
[ext_resource type="PackedScene" path="res://scenes/game/player_ship.tscn" id="3_player"]
|
||||||
[ext_resource type="Script" path="res://scripts/game/flight_hud.gd" id="4_hud"]
|
[ext_resource type="Script" path="res://scripts/game/flight_hud.gd" id="4_hud"]
|
||||||
|
[ext_resource type="PackedScene" path="res://scenes/ui/ship_equipment_panel.tscn" id="5_equipment"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="TopWall"]
|
[sub_resource type="RectangleShape2D" id="TopWall"]
|
||||||
size = Vector2(5200, 40)
|
size = Vector2(5200, 40)
|
||||||
@ -57,18 +58,22 @@ anchor_bottom = 1.0
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="ReadoutBackground" type="ColorRect" parent="HUD/HUDRoot"]
|
[node name="DebugToggle" type="Button" parent="HUD/HUDRoot"]
|
||||||
offset_left = 18.0
|
offset_left = 18.0
|
||||||
offset_top = 18.0
|
offset_top = 16.0
|
||||||
offset_right = 292.0
|
offset_right = 120.0
|
||||||
offset_bottom = 166.0
|
offset_bottom = 44.0
|
||||||
color = Color(0.018, 0.045, 0.085, 0.86)
|
flat = true
|
||||||
|
|
||||||
[node name="Readout" type="Label" parent="HUD/HUDRoot"]
|
|
||||||
offset_left = 32.0
|
|
||||||
offset_top = 28.0
|
|
||||||
offset_right = 278.0
|
|
||||||
offset_bottom = 156.0
|
|
||||||
theme_override_colors/font_color = Color(0.72, 0.88, 0.98, 1)
|
theme_override_colors/font_color = Color(0.72, 0.88, 0.98, 1)
|
||||||
theme_override_font_sizes/font_size = 17
|
text = "DEBUG [−]"
|
||||||
text = "W — ciąg S — hamulec\nA / D — płynny obrót\n\nPRĘDKOŚĆ 000 px/s\nPOZYCJA 0, 0"
|
|
||||||
|
[node name="DebugInfo" type="Label" parent="HUD/HUDRoot"]
|
||||||
|
offset_left = 22.0
|
||||||
|
offset_top = 48.0
|
||||||
|
offset_right = 340.0
|
||||||
|
offset_bottom = 470.0
|
||||||
|
theme_override_colors/font_color = Color(0.72, 0.88, 0.98, 1)
|
||||||
|
theme_override_font_sizes/font_size = 15
|
||||||
|
text = "STATEK\nKADŁUB: 100 / 100\nTARCZE: 100 / 100\nENERGIA: 100 / 100"
|
||||||
|
|
||||||
|
[node name="ShipEquipmentPanel" parent="HUD/HUDRoot" instance=ExtResource("5_equipment")]
|
||||||
|
|||||||
155
scenes/ui/ship_equipment_panel.tscn
Normal file
155
scenes/ui/ship_equipment_panel.tscn
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
[gd_scene load_steps=3 format=3]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/ui/ship_schematic.gd" id="1_schematic"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="EquipmentPanelStyle"]
|
||||||
|
bg_color = Color(0.018, 0.045, 0.085, 0.88)
|
||||||
|
border_width_left = 1
|
||||||
|
border_width_top = 1
|
||||||
|
border_width_right = 1
|
||||||
|
border_width_bottom = 1
|
||||||
|
border_color = Color(0.12, 0.32, 0.4, 0.9)
|
||||||
|
content_margin_left = 10.0
|
||||||
|
content_margin_top = 8.0
|
||||||
|
content_margin_right = 10.0
|
||||||
|
content_margin_bottom = 8.0
|
||||||
|
|
||||||
|
[node name="ShipEquipmentPanel" type="PanelContainer"]
|
||||||
|
anchors_preset = 1
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_left = -310.0
|
||||||
|
offset_top = 18.0
|
||||||
|
offset_right = -18.0
|
||||||
|
offset_bottom = 558.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
theme_override_styles/panel = SubResource("EquipmentPanelStyle")
|
||||||
|
|
||||||
|
[node name="Contents" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 6
|
||||||
|
|
||||||
|
[node name="Title" type="Label" parent="Contents"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.72, 0.88, 0.98, 1)
|
||||||
|
theme_override_font_sizes/font_size = 16
|
||||||
|
text = "WYPOSAŻENIE STATKU"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="WeaponLabel" type="Label" parent="Contents"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.98, 0.72, 0.38, 1)
|
||||||
|
theme_override_font_sizes/font_size = 13
|
||||||
|
text = "BROŃ PRZEDNIA"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="WeaponSlots" type="HBoxContainer" parent="Contents"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 8
|
||||||
|
|
||||||
|
[node name="Weapon1" type="PanelContainer" parent="Contents/WeaponSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 40)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/WeaponSlots/Weapon1"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "BROŃ 1 [LPM]\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Weapon2" type="PanelContainer" parent="Contents/WeaponSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 40)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/WeaponSlots/Weapon2"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "BROŃ 2 [PPM]\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Schematic" type="Control" parent="Contents"]
|
||||||
|
custom_minimum_size = Vector2(0, 136)
|
||||||
|
layout_mode = 2
|
||||||
|
script = ExtResource("1_schematic")
|
||||||
|
|
||||||
|
[node name="ModuleLabel" type="Label" parent="Contents"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.72, 0.88, 0.98, 1)
|
||||||
|
theme_override_font_sizes/font_size = 13
|
||||||
|
text = "MODUŁY NIEBOJOWE (6)"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="ModuleSlots" type="GridContainer" parent="Contents"]
|
||||||
|
layout_mode = 2
|
||||||
|
columns = 2
|
||||||
|
theme_override_constants/h_separation = 8
|
||||||
|
theme_override_constants/v_separation = 6
|
||||||
|
|
||||||
|
[node name="Module1" type="PanelContainer" parent="Contents/ModuleSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 54)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/ModuleSlots/Module1"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "MODUŁ 1\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Module2" type="PanelContainer" parent="Contents/ModuleSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 54)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/ModuleSlots/Module2"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "MODUŁ 2\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Module3" type="PanelContainer" parent="Contents/ModuleSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 54)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/ModuleSlots/Module3"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "MODUŁ 3\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Module4" type="PanelContainer" parent="Contents/ModuleSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 54)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/ModuleSlots/Module4"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "MODUŁ 4\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Module5" type="PanelContainer" parent="Contents/ModuleSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 54)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/ModuleSlots/Module5"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "MODUŁ 5\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Module6" type="PanelContainer" parent="Contents/ModuleSlots"]
|
||||||
|
custom_minimum_size = Vector2(0, 54)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Contents/ModuleSlots/Module6"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.82, 0.86, 0.9, 1)
|
||||||
|
text = "MODUŁ 6\nPUSTY"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
@ -1,9 +1,50 @@
|
|||||||
extends CanvasLayer
|
extends CanvasLayer
|
||||||
|
|
||||||
@onready var readout: Label = $HUDRoot/Readout
|
@onready var debug_toggle: Button = $HUDRoot/DebugToggle
|
||||||
|
@onready var debug_info: Label = $HUDRoot/DebugInfo
|
||||||
@onready var player: CharacterBody2D = get_parent().get_node("PlayerShip")
|
@onready var player: CharacterBody2D = get_parent().get_node("PlayerShip")
|
||||||
|
|
||||||
|
var _debug_expanded := true
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
debug_toggle.pressed.connect(_toggle_debug)
|
||||||
|
_update_debug_toggle()
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
var speed := player.velocity.length()
|
if not _debug_expanded:
|
||||||
var position := player.global_position
|
return
|
||||||
readout.text = "W — ciąg S — hamulec / wsteczny (50%)\nQ / E — strafe (50%) A / D — obrót\n\nPRĘDKOŚĆ %03d px/s\nPOZYCJA %d, %d" % [roundi(speed), roundi(position.x), roundi(position.y)]
|
|
||||||
|
var ship_position := player.global_position
|
||||||
|
var ship_velocity := player.velocity
|
||||||
|
var angular_speed := float(player.get("angular_velocity"))
|
||||||
|
debug_info.text = """STEROWANIE
|
||||||
|
W: ciąg S: hamulec / wsteczny
|
||||||
|
Q / E: strafe A / D: obrót
|
||||||
|
|
||||||
|
STATEK
|
||||||
|
KADŁUB: %d / %d
|
||||||
|
TARCZE: %d / %d
|
||||||
|
ENERGIA: %d / %d
|
||||||
|
|
||||||
|
RUCH
|
||||||
|
PRĘDKOŚĆ: %.1f px/s
|
||||||
|
WEKTOR X: %.1f px/s
|
||||||
|
WEKTOR Y: %.1f px/s
|
||||||
|
POZYCJA X: %.1f
|
||||||
|
POZYCJA Y: %.1f
|
||||||
|
KIERUNEK: %.1f°
|
||||||
|
OBRÓT: %.2f rad/s""" % [
|
||||||
|
roundi(float(player.get("hull"))), roundi(float(player.get("max_hull"))),
|
||||||
|
roundi(float(player.get("shields"))), roundi(float(player.get("max_shields"))),
|
||||||
|
roundi(float(player.get("energy"))), roundi(float(player.get("max_energy"))),
|
||||||
|
ship_velocity.length(), ship_velocity.x, ship_velocity.y,
|
||||||
|
ship_position.x, ship_position.y, rad_to_deg(player.rotation), angular_speed,
|
||||||
|
]
|
||||||
|
|
||||||
|
func _toggle_debug() -> void:
|
||||||
|
_debug_expanded = not _debug_expanded
|
||||||
|
debug_info.visible = _debug_expanded
|
||||||
|
_update_debug_toggle()
|
||||||
|
|
||||||
|
func _update_debug_toggle() -> void:
|
||||||
|
debug_toggle.text = "DEBUG [−]" if _debug_expanded else "DEBUG [+]"
|
||||||
|
|||||||
@ -12,6 +12,13 @@ const DEFAULT_SHIP_TEXTURE := "res://assets/Ships/Spaceship_0.png"
|
|||||||
@export var turn_acceleration := 7.0
|
@export var turn_acceleration := 7.0
|
||||||
@export var turn_damping := 4.0
|
@export var turn_damping := 4.0
|
||||||
|
|
||||||
|
@export var max_hull := 100.0
|
||||||
|
@export var max_shields := 100.0
|
||||||
|
@export var max_energy := 100.0
|
||||||
|
var hull := 100.0
|
||||||
|
var shields := 100.0
|
||||||
|
var energy := 100.0
|
||||||
|
|
||||||
var angular_velocity := 0.0
|
var angular_velocity := 0.0
|
||||||
var _sprite: Sprite2D
|
var _sprite: Sprite2D
|
||||||
|
|
||||||
|
|||||||
41
scripts/ui/ship_schematic.gd
Normal file
41
scripts/ui/ship_schematic.gd
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
func _draw() -> void:
|
||||||
|
var center := size.x * 0.5
|
||||||
|
var hull_color := Color(0.35, 0.72, 0.85, 1.0)
|
||||||
|
var hull_highlight := Color(0.72, 0.9, 0.96, 1.0)
|
||||||
|
var weapon_color := Color(0.98, 0.65, 0.28, 1.0)
|
||||||
|
|
||||||
|
var fuselage := PackedVector2Array([
|
||||||
|
Vector2(center, 8),
|
||||||
|
Vector2(center + 13, 44),
|
||||||
|
Vector2(center + 25, 100),
|
||||||
|
Vector2(center, 132),
|
||||||
|
Vector2(center - 25, 100),
|
||||||
|
Vector2(center - 13, 44),
|
||||||
|
])
|
||||||
|
var left_wing := PackedVector2Array([
|
||||||
|
Vector2(center - 11, 49),
|
||||||
|
Vector2(center - 62, 82),
|
||||||
|
Vector2(center - 46, 108),
|
||||||
|
Vector2(center - 23, 96),
|
||||||
|
])
|
||||||
|
var right_wing := PackedVector2Array([
|
||||||
|
Vector2(center + 11, 49),
|
||||||
|
Vector2(center + 62, 82),
|
||||||
|
Vector2(center + 46, 108),
|
||||||
|
Vector2(center + 23, 96),
|
||||||
|
])
|
||||||
|
|
||||||
|
draw_colored_polygon(left_wing, hull_color)
|
||||||
|
draw_colored_polygon(right_wing, hull_color)
|
||||||
|
draw_colored_polygon(fuselage, hull_highlight)
|
||||||
|
draw_polyline(PackedVector2Array([Vector2(center, 17), Vector2(center, 116)]), hull_color, 2.0)
|
||||||
|
draw_colored_polygon(PackedVector2Array([
|
||||||
|
Vector2(center - 18, 32), Vector2(center - 8, 36),
|
||||||
|
Vector2(center - 10, 48), Vector2(center - 20, 44),
|
||||||
|
]), weapon_color)
|
||||||
|
draw_colored_polygon(PackedVector2Array([
|
||||||
|
Vector2(center + 18, 32), Vector2(center + 8, 36),
|
||||||
|
Vector2(center + 10, 48), Vector2(center + 20, 44),
|
||||||
|
]), weapon_color)
|
||||||
1
scripts/ui/ship_schematic.gd.uid
Normal file
1
scripts/ui/ship_schematic.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://dq6de1qlgclpr
|
||||||
Loading…
x
Reference in New Issue
Block a user