rudimentary arrow pickup working
This commit is contained in:
@@ -163,8 +163,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.21551, 0.500001, -0.339623)
|
||||
player = NodePath("..")
|
||||
|
||||
[node name="SwordHit" type="Area3D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 8
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="SwordHit"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25024, -0.766663)
|
||||
|
||||
@@ -33,13 +33,5 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
func pickup_follow(delta):
|
||||
if follow_target != null:
|
||||
if spawn_out:
|
||||
follow_target.arrow += 1
|
||||
follow_target.arrows += 1
|
||||
queue_free()
|
||||
else:
|
||||
if global_position.distance_to(follow_target.global_position) < .5:
|
||||
spawn_out = true
|
||||
else:
|
||||
var direction_to_player = global_position.direction_to(follow_target.global_position)
|
||||
var distance_to_player = global_position.distance_to(follow_target.global_position)
|
||||
global_position += global_transform.basis * direction_to_player * (5 + distance_to_player * 3) * delta
|
||||
|
||||
@@ -40,4 +40,4 @@ func _on_area_3d_body_entered(body: Node3D) -> void:
|
||||
|
||||
func _on_area_3d_area_entered(area: Area3D) -> void:
|
||||
if area.get_parent() is Arrow:
|
||||
body.get_parent().follow_target = self
|
||||
area.get_parent().follow_target = self
|
||||
|
||||
Reference in New Issue
Block a user