Browse Source

[Ability icon] Show when action is pressed

master
Luna 7 years ago
parent
commit
c0345153e2
4 changed files with 28 additions and 23 deletions
  1. +19
    -21
      scenes/ability_icon.tscn
  2. +1
    -1
      scenes/heroes/0.tscn
  3. +7
    -0
      scripts/ability_icon.gd
  4. +1
    -1
      scripts/heroes/0.gd

+ 19
- 21
scenes/ability_icon.tscn View File

@ -8,7 +8,7 @@ content_margin_left = -1.0
content_margin_right = -1.0
content_margin_top = -1.0
content_margin_bottom = -1.0
bg_color = Color( 0.0297089, 0.230469, 0.206942, 1 )
bg_color = Color( 0.042572, 0.351562, 0.315353, 1 )
draw_center = true
border_width_left = 0
border_width_top = 0
@ -64,10 +64,8 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -6.0
margin_top = -4.0
margin_right = 5.0
margin_bottom = 5.0
margin_right = 30.0
margin_bottom = 30.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 0
mouse_default_cursor_shape = 0
@ -85,10 +83,10 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -20.0
margin_top = -21.0
margin_right = 30.0
margin_bottom = 28.0
margin_left = -25.0
margin_top = -25.0
margin_right = 25.0
margin_bottom = 25.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 0
mouse_default_cursor_shape = 0
@ -111,10 +109,10 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -25.0
margin_top = -26.0
margin_right = 25.0
margin_bottom = 23.0
margin_left = -30.0
margin_top = -30.0
margin_right = 20.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 0
mouse_default_cursor_shape = 0
@ -128,10 +126,10 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -68.0
margin_top = -49.0
margin_right = 74.0
margin_bottom = -35.0
margin_left = -72.0
margin_top = -44.0
margin_right = 70.0
margin_bottom = -30.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0
@ -150,10 +148,10 @@ 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
margin_left = -72.0
margin_top = 29.0
margin_right = 70.0
margin_bottom = 43.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 2
mouse_default_cursor_shape = 0


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

@ -24,7 +24,7 @@ mesh = ExtResource( 4 )
text = ""
[node name="ProgressBar" parent="MasterOnly" index="1" instance=ExtResource( 5 )]
[node name="Boost" parent="MasterOnly" index="1" instance=ExtResource( 5 )]
anchor_left = 1.0
anchor_top = 1.0


+ 7
- 0
scripts/ability_icon.gd View File

@ -28,7 +28,14 @@ func _ready():
description = ""
get_node("Button").text = description
func is_pressed():
return Input.is_action_pressed(action)
func _process(delta):
if action and Input.is_action_pressed(action):
available.rect_position = Vector2(-25, -25) # Centered / not offset
else:
available.rect_position = Vector2(-30, -30)
if disabled:
available.hide()
bar.value = 0


+ 1
- 1
scripts/heroes/0.gd View File

@ -24,7 +24,7 @@ func control_player(state):
var boost_strength = 2
var boost_drain = 25 # Recall increased charge must be factored in
var cost = boost_drain * state.step
if Input.is_action_pressed("hero_0_boost") and switch_charge > cost:
if get_node("MasterOnly/Boost").is_pressed() and switch_charge > cost:
walk_speed *= 2
air_accel *= 3
switch_charge -= cost


Loading…
Cancel
Save