Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | SaberCat |
So, I want an action to be performed when a kinematicBody2d enters an Area2d(the action is printing something), so I put a connection between these two bodies using the command “_on_Area2D_body_entered” that can be found on the “Node” tab in area2d.
This is the code inside kinematicBody2d:
func _on_Area2D_body_entered(body): print("Hello World") pass
In this case, “Hello World” is printed, but the problem is that it is printed without the kinematicBody2d and area2d having to contact each other… it just prints automatically when the game starts. How can I fix this and make it so that the output is only printed when the two bodies actually contact each other? Thanks in advance.