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