diff --git a/scenes/player.tscn b/scenes/player.tscn index e7cf436..436cfc6 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://scripts/player.gd" type="Script" id=1] -[ext_resource path="res://scripts/tp_camera.gd" type="Script" id=2] -[ext_resource path="res://scripts/player_name.gd" type="Script" id=3] +[ext_resource path="res://scenes/ability_icon.tscn" type="PackedScene" id=2] +[ext_resource path="res://scripts/tp_camera.gd" type="Script" id=3] +[ext_resource path="res://scripts/player_name.gd" type="Script" id=4] [sub_resource type="CapsuleShape" id=1] @@ -365,10 +366,24 @@ percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 +[node name="SwitchHero" parent="MasterOnly" index="2" instance=ExtResource( 2 )] + +visible = false +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_top = -107.0 +margin_bottom = -98.0 +cost = 100 +ability_name = "Switch Hero" +display_progress = false +action = "switch_hero" + [node name="TPCamera" type="Spatial" parent="." index="5"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.56913, 0 ) -script = ExtResource( 2 ) +script = ExtResource( 3 ) cam = NodePath("Camera") pivot = NodePath("Pivot") @@ -434,6 +449,6 @@ align = 1 percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 -script = ExtResource( 3 ) +script = ExtResource( 4 ) diff --git a/scripts/player.gd b/scripts/player.gd index 628a220..a85d604 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -20,6 +20,7 @@ var movement_charge = 0.15 # In percent per meter (except when heroes change tha onready var switch_text = get_node("MasterOnly/ChargeBar/ChargeText") onready var switch_bar = get_node("MasterOnly/ChargeBar") onready var switch_bar_extra = get_node("MasterOnly/ChargeBar/Extra") +onready var switch_hero_action = get_node("MasterOnly/SwitchHero") var fall_height = -400 # This is essentially the respawn timer var switch_height = -150 # At this point, stop adding to switch_charge. This makes falls not charge you too much @@ -85,8 +86,9 @@ func _process(delta): switch_charge += movement_charge * vel.length() * delta switch_text.set_text("%d%%" % int(switch_charge)) # We truncate, rather than round, so that switch is displayed AT 100% if switch_charge >= 100: - # Let switch_charge keep building, because we use it for walk_speed and things - switch_text.set_text("100%% (%.f)\nQ - Switch hero" % switch_charge) + switch_hero_action.show() + else: + switch_hero_action.hide() if switch_charge > switch_charge_cap: # There is however a cap switch_charge = switch_charge_cap