Browse Source

Add currently bound button to ability_icon

master
Luna 7 years ago
parent
commit
0855689ae6
5 changed files with 46 additions and 4 deletions
  1. +27
    -4
      scenes/ability_icon.tscn
  2. +1
    -0
      scenes/heroes/0.tscn
  3. +1
    -0
      scenes/heroes/4.tscn
  4. +1
    -0
      scenes/heroes/5.tscn
  5. +16
    -0
      scripts/ability_icon.gd

+ 27
- 4
scenes/ability_icon.tscn View File

@ -77,6 +77,7 @@ script = ExtResource( 1 )
cost = 1
ability_name = "Ability"
display_progress = true
action = ""
[node name="Bar" type="ProgressBar" parent="." index="0"]
@ -127,10 +128,10 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -65.0
margin_top = 36.0
margin_right = 77.0
margin_bottom = 50.0
margin_left = -68.0
margin_top = -49.0
margin_right = 74.0
margin_bottom = -35.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0
@ -143,4 +144,26 @@ percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="Button" type="Label" parent="." index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -68.0
margin_top = 38.0
margin_right = 74.0
margin_bottom = 52.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
custom_colors/font_color = Color( 0.00357056, 0.0703125, 0.04372, 1 )
text = "<Button>"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

+ 1
- 0
scenes/heroes/0.tscn View File

@ -37,5 +37,6 @@ margin_bottom = -109.0
cost = 2
ability_name = "Speed Boost"
display_progress = false
action = "hero_0_boost"

+ 1
- 0
scenes/heroes/4.tscn View File

@ -47,5 +47,6 @@ margin_right = -98.0
margin_bottom = -91.0
cost = 0
ability_name = "Destroy"
action = "primary_ability"

+ 1
- 0
scenes/heroes/5.tscn View File

@ -32,6 +32,7 @@ margin_right = -149.0
margin_bottom = -103.0
cost = 20
ability_name = "Build Portal"
action = "hero_5_place_portal"
[node name="Teleport" parent="MasterOnly" index="3" instance=ExtResource( 5 )]


+ 16
- 0
scripts/ability_icon.gd View File

@ -6,11 +6,27 @@ onready var available = get_node("Available")
export var cost = 1
export var ability_name = "Ability"
export var display_progress = true
export var action = ""
# This is intended to be public
var disabled = false
func _ready():
get_node("Name").text = ability_name
var description
if action:
var primary = InputMap.get_action_list(action)[0]
if primary is InputEventMouseButton:
if primary.button_index == BUTTON_LEFT:
description = "Click"
elif primary.button_index == BUTTON_RIGHT:
description = "Right Click"
else:
description = "Scroll Click"
else:
description = primary.as_text()
else:
description = ""
get_node("Button").text = description
func _process(delta):
if disabled:


Loading…
Cancel
Save