Feat/3 grapple fundamentals #7
Binary file not shown.
|
After Width: | Height: | Size: 532 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 484 KiB |
@@ -8,6 +8,10 @@ var _speed_label: Label
|
|||||||
var _state_label: Label
|
var _state_label: Label
|
||||||
var _chain_label: Label
|
var _chain_label: Label
|
||||||
var _weapon_label: Label
|
var _weapon_label: Label
|
||||||
|
var _grapple_icon: TextureRect
|
||||||
|
var _dash_icon: TextureRect
|
||||||
|
var _grapple_label: Label
|
||||||
|
var _dash_label: Label
|
||||||
var _player: CharacterBody3D
|
var _player: CharacterBody3D
|
||||||
|
|
||||||
|
|
||||||
@@ -489,6 +493,68 @@ func _build_hud() -> void:
|
|||||||
_weapon_label.add_theme_font_size_override("font_size", 24)
|
_weapon_label.add_theme_font_size_override("font_size", 24)
|
||||||
wp_panel.add_child(_weapon_label)
|
wp_panel.add_child(_weapon_label)
|
||||||
|
|
||||||
|
# ── Utilities Panel ───────────────────────────────────────────────────────
|
||||||
|
var util_panel := PanelContainer.new()
|
||||||
|
util_panel.name = "UtilPanel"
|
||||||
|
util_panel.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||||
|
util_panel.offset_left = -200
|
||||||
|
util_panel.offset_top = -180
|
||||||
|
util_panel.offset_right = -20
|
||||||
|
util_panel.offset_bottom = -110
|
||||||
|
var util_style := StyleBoxFlat.new()
|
||||||
|
util_style.bg_color = Color(0, 0, 0, 0.6)
|
||||||
|
util_style.corner_radius_top_left = 8
|
||||||
|
util_style.corner_radius_top_right = 8
|
||||||
|
util_style.corner_radius_bottom_left = 8
|
||||||
|
util_style.corner_radius_bottom_right = 8
|
||||||
|
util_style.content_margin_left = 12
|
||||||
|
util_style.content_margin_top = 8
|
||||||
|
util_style.content_margin_right = 12
|
||||||
|
util_style.content_margin_bottom = 8
|
||||||
|
util_panel.add_theme_stylebox_override("panel", util_style)
|
||||||
|
util_panel.grow_horizontal = Control.GROW_DIRECTION_BEGIN
|
||||||
|
canvas.add_child(util_panel)
|
||||||
|
|
||||||
|
var util_hbox := HBoxContainer.new()
|
||||||
|
util_hbox.name = "UtilHBox"
|
||||||
|
util_hbox.add_theme_constant_override("separation", 20)
|
||||||
|
util_hbox.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||||
|
util_panel.add_child(util_hbox)
|
||||||
|
|
||||||
|
var grapple_vbox := VBoxContainer.new()
|
||||||
|
grapple_vbox.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||||
|
util_hbox.add_child(grapple_vbox)
|
||||||
|
|
||||||
|
_grapple_icon = TextureRect.new()
|
||||||
|
_grapple_icon.texture = load("res://assets/ui/grapple_icon.jpg")
|
||||||
|
_grapple_icon.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||||
|
_grapple_icon.custom_minimum_size = Vector2(32, 32)
|
||||||
|
_grapple_icon.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||||
|
grapple_vbox.add_child(_grapple_icon)
|
||||||
|
|
||||||
|
_grapple_label = Label.new()
|
||||||
|
_grapple_label.text = "Grapple"
|
||||||
|
_grapple_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
|
_grapple_label.add_theme_font_size_override("font_size", 12)
|
||||||
|
grapple_vbox.add_child(_grapple_label)
|
||||||
|
|
||||||
|
var dash_vbox := VBoxContainer.new()
|
||||||
|
dash_vbox.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||||
|
util_hbox.add_child(dash_vbox)
|
||||||
|
|
||||||
|
_dash_icon = TextureRect.new()
|
||||||
|
_dash_icon.texture = load("res://assets/ui/dash_icon.jpg")
|
||||||
|
_dash_icon.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||||
|
_dash_icon.custom_minimum_size = Vector2(32, 32)
|
||||||
|
_dash_icon.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||||
|
dash_vbox.add_child(_dash_icon)
|
||||||
|
|
||||||
|
_dash_label = Label.new()
|
||||||
|
_dash_label.text = "Ready"
|
||||||
|
_dash_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
|
_dash_label.add_theme_font_size_override("font_size", 12)
|
||||||
|
dash_vbox.add_child(_dash_label)
|
||||||
|
|
||||||
|
|
||||||
# ── Utility: Key Name ─────────────────────────────────────────────────────────
|
# ── Utility: Key Name ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -529,6 +595,22 @@ func _process(_delta: float) -> void:
|
|||||||
if sm:
|
if sm:
|
||||||
_chain_label.text = "Chain: %d (+%d%%)" % [sm.chain_count, int(sm.current_chain_bonus * 100)]
|
_chain_label.text = "Chain: %d (+%d%%)" % [sm.chain_count, int(sm.current_chain_bonus * 100)]
|
||||||
|
|
||||||
|
# Update utility indicators
|
||||||
|
if sm.current_state == "grapple" or sm.is_grapple_shooting:
|
||||||
|
_grapple_icon.modulate = Color(0.2, 1.0, 0.4)
|
||||||
|
_grapple_label.text = "Grappling"
|
||||||
|
else:
|
||||||
|
_grapple_icon.modulate = Color(1.0, 1.0, 1.0)
|
||||||
|
_grapple_label.text = "Ready"
|
||||||
|
|
||||||
|
var dash_rem = sm.get_dash_cooldown_remaining()
|
||||||
|
if dash_rem > 0.0:
|
||||||
|
_dash_icon.modulate = Color(1.0, 0.3, 0.3)
|
||||||
|
_dash_label.text = "%.1f" % dash_rem
|
||||||
|
else:
|
||||||
|
_dash_icon.modulate = Color(1.0, 1.0, 1.0)
|
||||||
|
_dash_label.text = "Ready"
|
||||||
|
|
||||||
if _weapon_label:
|
if _weapon_label:
|
||||||
var wman = _player.get_node_or_null("HeadPivot/Camera3D/WeaponManager")
|
var wman = _player.get_node_or_null("HeadPivot/Camera3D/WeaponManager")
|
||||||
if wman and wman.weapons.has(wman.active_slot):
|
if wman and wman.weapons.has(wman.active_slot):
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class_name MovementParams
|
|||||||
# ── Dash ──────────────────────────────────────────────────────────────────────
|
# ── Dash ──────────────────────────────────────────────────────────────────────
|
||||||
@export var dash_speed: float = 10.0
|
@export var dash_speed: float = 10.0
|
||||||
@export var dash_duration: float = 0.25
|
@export var dash_duration: float = 0.25
|
||||||
@export var dash_cooldown: float = 1.0
|
@export var dash_cooldown: float = 10.0
|
||||||
@export var dash_invulnerability_time: float = 0.1
|
@export var dash_invulnerability_time: float = 0.1
|
||||||
|
|
||||||
# ── Rocket Jump ───────────────────────────────────────────────────────────────
|
# ── Rocket Jump ───────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -259,3 +259,7 @@ func _apply_crouch(crouched: bool) -> void:
|
|||||||
shape_node.position.y = 0.0
|
shape_node.position.y = 0.0
|
||||||
if head:
|
if head:
|
||||||
head.position.y = 0.7
|
head.position.y = 0.7
|
||||||
|
|
||||||
|
func get_dash_cooldown_remaining() -> float:
|
||||||
|
var now := Time.get_ticks_msec() / 1000.0
|
||||||
|
return maxf(0.0, params.dash_cooldown - (now - StateDash._last_dash_time))
|
||||||
|
|||||||
Reference in New Issue
Block a user