un peu de ménage
This commit is contained in:
@@ -77,10 +77,11 @@ position = Vector2(0, 43)
|
||||
rotation = 1.5708
|
||||
shape = SubResource("CapsuleShape2D_a4vmx")
|
||||
|
||||
[node name="controleur" type="Node2D" parent="." node_paths=PackedStringArray("human", "ray")]
|
||||
[node name="controleur" type="Node2D" parent="." node_paths=PackedStringArray("human", "ray", "pathFinder")]
|
||||
script = ExtResource("1_oapm5")
|
||||
human = NodePath("..")
|
||||
ray = NodePath("../ShapeCast2D")
|
||||
pathFinder = NodePath("../PathFinder")
|
||||
|
||||
[node name="ShapeCast2D" type="ShapeCast2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_11ib5")
|
||||
|
||||
@@ -2,11 +2,12 @@ extends Node2D
|
||||
|
||||
@export var human: Human
|
||||
@export var ray : ShapeCast2D
|
||||
var can_interact_with : Node2D
|
||||
@onready var world: World = get_parent().get_parent();
|
||||
@onready var pathFinder : HumanPathFinder = $"../PathFinder"
|
||||
@export var pathFinder : HumanPathFinder
|
||||
@onready var world: World = human.get_parent();
|
||||
|
||||
var possible_interactables : Array[Node2D]
|
||||
# Stores the nearest Node2D we can interact with, then we can start interacting with it if the player
|
||||
# press grab
|
||||
var can_interact_with : Node2D
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
human.stop_interaction()
|
||||
@@ -47,7 +48,7 @@ func _process(delta) -> void:
|
||||
(ray.shape as RectangleShape2D).size = Vector2(20, 50)
|
||||
|
||||
# find all the possible interactables
|
||||
possible_interactables = []
|
||||
var possible_interactables = []
|
||||
if ray.is_colliding():
|
||||
var nbCollisions = ray.get_collision_count()
|
||||
for n in range(nbCollisions):
|
||||
|
||||
Reference in New Issue
Block a user