feat: Add powerup inventory UI and mobile touch controls including a virtual joystick and action buttons.
This commit is contained in:
@@ -74,6 +74,35 @@ func _setup_btn(effect_id: int, btn: Button):
|
||||
cd_lbl.text = ""
|
||||
btn.add_child(cd_lbl)
|
||||
|
||||
# Add Keyboard Shortcut Label
|
||||
if not btn.has_node("ShortcutLabel"):
|
||||
var sc_lbl = Label.new()
|
||||
sc_lbl.name = "ShortcutLabel"
|
||||
sc_lbl.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
sc_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
sc_lbl.vertical_alignment = VERTICAL_ALIGNMENT_BOTTOM
|
||||
sc_lbl.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
# Offset slightly below or at bottom edge
|
||||
sc_lbl.offset_bottom = 20
|
||||
sc_lbl.add_theme_font_size_override("font_size", 14)
|
||||
sc_lbl.add_theme_color_override("font_outline_color", Color.BLACK)
|
||||
sc_lbl.add_theme_constant_override("outline_size", 4)
|
||||
|
||||
# Determine Label Text based on Effect ID
|
||||
# 0: Speed -> 1
|
||||
# 2: Wall -> 2
|
||||
# 1: Freeze -> 3
|
||||
# 3: Ghost -> 4
|
||||
var key_text = ""
|
||||
match effect_id:
|
||||
0: key_text = "1"
|
||||
2: key_text = "2"
|
||||
1: key_text = "3"
|
||||
3: key_text = "4"
|
||||
|
||||
sc_lbl.text = key_text
|
||||
btn.add_child(sc_lbl)
|
||||
|
||||
# Connect click
|
||||
if not btn.pressed.is_connected(_on_btn_pressed):
|
||||
btn.pressed.connect(_on_btn_pressed.bind(effect_id))
|
||||
|
||||
Reference in New Issue
Block a user