Fixed a few more remaining issues.

This commit is contained in:
Relintai 2020-01-04 13:09:34 +01:00
parent bb8dad5d46
commit 2acaa97de9
3 changed files with 8 additions and 9 deletions

View File

@ -14,11 +14,11 @@ body_path = NodePath("KinematicBody2D")
character_skeleton_path = NodePath("KinematicBody2D/Character") character_skeleton_path = NodePath("KinematicBody2D/Character")
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="NamePlate" parent="." instance=ExtResource( 3 )]
[node name="KinematicBody2D" type="KinematicBody2D" parent="."] [node name="KinematicBody2D" type="KinematicBody2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"]
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="Character" parent="KinematicBody2D" instance=ExtResource( 1 )] [node name="Character" parent="KinematicBody2D" instance=ExtResource( 1 )]
[node name="NamePlate" parent="KinematicBody2D" instance=ExtResource( 3 )]

View File

@ -51,7 +51,7 @@ func _ready():
health_bar = get_node(health_bar_path) as TextureProgress health_bar = get_node(health_bar_path) as TextureProgress
health_bar_label = get_node(health_bar_label_path) as Label health_bar_label = get_node(health_bar_label_path) as Label
entity = get_node("../..") as Entity entity = get_node("..") as Entity
health = entity.get_health() health = entity.get_health()
health.connect("c_changed", self, "c_health_changed") health.connect("c_changed", self, "c_health_changed")
@ -77,19 +77,17 @@ func _ready():
func _process(delta): func _process(delta):
if interpolating: if interpolating:
var d : Vector2 = ((target_scale - get_scale()).normalized() * delta) + get_scale() var d : Vector2 = ((target_scale - get_scale()).normalized() * delta) + get_scale()
set_scale(d) set_scale(d)
if (get_scale() - target_scale).length() < 0.04: if (get_scale() - target_scale).length() < 0.04:
interpolating = false interpolating = false
var position : Vector2 = entity.get_body().position var position : Vector2 = entity.get_body().position
position = get_global_transform().xform_inv(position) position.x -= (rect_size.x / 2.0) * rect_scale.x
position.y -= 60
position.x -= (rect_size.x / 2.0 + 24) * rect_scale.x
position.y -= 130 * rect_scale.y
set_position(position) set_position(position)

View File

@ -11,6 +11,7 @@ script = ExtResource( 1 )
world_layer = ExtResource( 2 ) world_layer = ExtResource( 2 )
[node name="Terrarin" type="TileMap" parent="."] [node name="Terrarin" type="TileMap" parent="."]
z_index = -10
tile_set = ExtResource( 3 ) tile_set = ExtResource( 3 )
cell_size = Vector2( 32, 32 ) cell_size = Vector2( 32, 32 )
format = 1 format = 1