le player se pilote à la souris ou avec le doigt
reste à faire: intérargir avec bob
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
extends Node
|
||||
extends Node2D
|
||||
|
||||
@export var human: Human
|
||||
@export var ray : ShapeCast2D
|
||||
var can_interact_with : Node2D
|
||||
@onready var world: World = get_parent().get_parent();
|
||||
|
||||
var possible_interactables : Array[Node2D]
|
||||
|
||||
@@ -18,6 +19,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
human.wants_to_interact_with = can_interact_with
|
||||
else:
|
||||
human.wants_to_grab = true
|
||||
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
||||
var tile_pos = world.local_to_map(world.to_local(get_global_mouse_position()))
|
||||
if event.pressed:
|
||||
print(event.position, tile_pos)
|
||||
$"../PathFinder".destination = get_global_mouse_position()
|
||||
|
||||
func _process(delta) -> void:
|
||||
ray.target_position = human.last_facing_direction * 48
|
||||
|
||||
Reference in New Issue
Block a user