Made more enemies, easier to kill, more slashy. You get passive health regen, health orbs. Little key bindings tooltip.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=4 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://level/ui/scripts/keybind_hint.gd" id="1_script"]
|
||||
[ext_resource type="Theme" uid="uid://dvsh7tuhulnfm" path="res://level/ui/theme/wow_style.tres" id="2_theme"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kb"]
|
||||
bg_color = Color(0.15, 0.15, 0.15, 0.85)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.6, 0.5, 0.2, 1)
|
||||
corner_radius_top_left = 4
|
||||
corner_radius_top_right = 4
|
||||
corner_radius_bottom_right = 4
|
||||
corner_radius_bottom_left = 4
|
||||
|
||||
[node name="KeybindHint" type="PanelContainer"]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -210.0
|
||||
offset_top = 20.0
|
||||
offset_right = -20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 1
|
||||
theme = ExtResource("2_theme")
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_kb")
|
||||
script = ExtResource("1_script")
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="Content" type="VBoxContainer" parent="Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 4
|
||||
@@ -8,6 +8,7 @@ var unit_frame: Control = null
|
||||
var target_frame: Control = null
|
||||
var character_sheet: Control = null
|
||||
var tab_hint: Control = null
|
||||
var keybind_hint: Control = null
|
||||
var escape_menu: Control = null
|
||||
|
||||
# Player reference
|
||||
@@ -77,6 +78,7 @@ func _create_ui_components():
|
||||
_create_unit_frame()
|
||||
_create_character_sheet()
|
||||
_create_tab_hint()
|
||||
_create_keybind_hint()
|
||||
_create_escape_menu()
|
||||
|
||||
## Create action bar at bottom of screen
|
||||
@@ -125,6 +127,16 @@ func _create_tab_hint():
|
||||
else:
|
||||
push_error("[HUD] Failed to load tab_hint.tscn")
|
||||
|
||||
## Create keybind hint (always visible, top-right corner)
|
||||
func _create_keybind_hint():
|
||||
var keybind_hint_scene = load("res://level/ui/scenes/keybind_hint.tscn")
|
||||
if keybind_hint_scene:
|
||||
keybind_hint = keybind_hint_scene.instantiate()
|
||||
add_child(keybind_hint)
|
||||
print("[HUD] Keybind hint created")
|
||||
else:
|
||||
push_error("[HUD] Failed to load keybind_hint.tscn")
|
||||
|
||||
## Create escape menu (toggle with Escape)
|
||||
func _create_escape_menu():
|
||||
var escape_menu_scene = load("res://level/ui/scenes/escape_menu.tscn")
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
extends PanelContainer
|
||||
## Always-on compact panel listing the current controls.
|
||||
## Reads bindings straight from the InputMap so it stays accurate if keys are rebound.
|
||||
|
||||
# Each row is a friendly label plus the input action(s) that feed it.
|
||||
# Grouped actions (like movement) show their keys joined together.
|
||||
const ROWS := [
|
||||
{ "label": "Move", "actions": ["move_forward", "move_left", "move_backward", "move_right"] },
|
||||
{ "label": "Jump", "actions": ["jump"] },
|
||||
{ "label": "Sprint", "actions": ["shift"] },
|
||||
{ "label": "Dash", "actions": ["dash"] },
|
||||
{ "label": "Attack", "actions": ["attack"] },
|
||||
{ "label": "Block", "actions": ["block"] },
|
||||
{ "label": "Pick Up / Drop", "actions": ["pickup"] },
|
||||
{ "label": "Character Sheet", "actions": ["toggle_character_sheet"] },
|
||||
{ "label": "Chat", "actions": ["toggle_chat"] },
|
||||
{ "label": "Menu", "actions": ["quit"] },
|
||||
]
|
||||
|
||||
func _ready() -> void:
|
||||
_build()
|
||||
|
||||
func _build() -> void:
|
||||
var content: VBoxContainer = $Margin/Content
|
||||
|
||||
var title := Label.new()
|
||||
title.text = "CONTROLS"
|
||||
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
title.add_theme_font_size_override("font_size", 16)
|
||||
title.add_theme_color_override("font_color", Color(1, 0.8, 0, 1))
|
||||
title.add_theme_color_override("font_outline_color", Color.BLACK)
|
||||
title.add_theme_constant_override("outline_size", 2)
|
||||
content.add_child(title)
|
||||
|
||||
var grid := GridContainer.new()
|
||||
grid.columns = 2
|
||||
grid.add_theme_constant_override("h_separation", 12)
|
||||
grid.add_theme_constant_override("v_separation", 3)
|
||||
content.add_child(grid)
|
||||
|
||||
for row in ROWS:
|
||||
var keys: Array[String] = []
|
||||
for action in row["actions"]:
|
||||
var k := _key_text(action)
|
||||
if k != "":
|
||||
keys.append(k)
|
||||
if keys.is_empty():
|
||||
continue
|
||||
grid.add_child(_make_label(" ".join(keys), Color(1, 0.82, 0.2, 1)))
|
||||
grid.add_child(_make_label(row["label"], Color.WHITE))
|
||||
|
||||
func _make_label(text: String, color: Color) -> Label:
|
||||
var l := Label.new()
|
||||
l.text = text
|
||||
l.add_theme_font_size_override("font_size", 13)
|
||||
l.add_theme_color_override("font_color", color)
|
||||
l.add_theme_color_override("font_outline_color", Color.BLACK)
|
||||
l.add_theme_constant_override("outline_size", 1)
|
||||
return l
|
||||
|
||||
## Returns a human-readable name for the first event bound to an action.
|
||||
func _key_text(action: String) -> String:
|
||||
if not InputMap.has_action(action):
|
||||
return ""
|
||||
for ev in InputMap.action_get_events(action):
|
||||
if ev is InputEventKey:
|
||||
var code: int = ev.physical_keycode if ev.physical_keycode != 0 else ev.keycode
|
||||
return OS.get_keycode_string(code)
|
||||
elif ev is InputEventMouseButton:
|
||||
match ev.button_index:
|
||||
MOUSE_BUTTON_LEFT: return "LMB"
|
||||
MOUSE_BUTTON_RIGHT: return "RMB"
|
||||
MOUSE_BUTTON_MIDDLE: return "MMB"
|
||||
_: return "Mouse %d" % ev.button_index
|
||||
return ""
|
||||
@@ -0,0 +1 @@
|
||||
uid://dh85b10pfih5e
|
||||
Reference in New Issue
Block a user