implement correct behavior of Max Health attribute of Player

remotes/1698854768171617226/layered_gunshot
Jan Heemstra 2021-03-31 23:22:12 +02:00
parent cfd33f791c
commit e6366f8fea
4 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,7 @@ script = ExtResource( 2 )
max_health = 90
[node name="Hand" parent="Camera" index="0"]
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.399939, -0.559 )
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.395602, -0.559 )
[node name="WeaponBobAnimationTree" parent="Camera/Hand" index="0"]
parameters/playback = SubResource( 1 )

View File

@ -309,7 +309,7 @@ master func kill():
func spawn():
is_dead = false
set_health(150)
set_health(max_health)
velocity = Vector3()
@ -383,6 +383,8 @@ func set_local_player():
# Called when the node enters the scene tree for the first time.
func _ready():
$HUD/Health/HealthBar.max_value = max_health
# Set player class
var path = get_script().get_path()

View File

@ -138,7 +138,7 @@ script = ExtResource( 8 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.53592, -0.0651628 )
[node name="Hand" type="Spatial" parent="Camera"]
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.399017, -0.559 )
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.390011, -0.559 )
[node name="WeaponBobAnimationTree" type="AnimationTree" parent="Camera/Hand"]
tree_root = SubResource( 12 )

View File

@ -22,8 +22,7 @@ __meta__ = {
margin_right = 150.0
margin_bottom = 50.0
rect_min_size = Vector2( 150, 50 )
max_value = 150.0
value = 150.0
value = 100.0
texture_under = ExtResource( 3 )
texture_over = ExtResource( 2 )
texture_progress = ExtResource( 1 )