system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
AllanOnAir |
extends Area2D
var is_inside = false
func interact():
if Input.is_action_just_pressed(“Interaction”):
print(“Interagie”)
func _on_Porte_body_entered(_body):
is_inside = true
if is_inside == true:
interact()
pass
system
2
|
|
|
|
Reply From: |
deaton64 |
Hi,
I think your code isn’t working as the body entered func is called once and so there isn’t enough time to call interact()
This is untested, but do something like:
extends Area2D
var is_inside = false
func _process(_delta: float) -> void:
if is_inside == true:
interact()
func interact():
if Input.isactionjust_pressed("Interaction"):
print("Interagie")
func onPortebodyentered(body):
is_inside = true
func onPortebodyexited(body: Node) -> void:
is_inside = false
THX A LOT ! My Friend.
AllanOnAir | 2020-07-31 00:11