Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hey, guys, I really don't get how to use a body_enter function, please explain.
- I got two nodes Player and Enemy and they both are KinematicBodies2D.
- Enemy node has got an Area2D node in it with script like this:
- extends Area2D
- func _ready():
- connect("body_enter", self, "_on_enemy_body_enter")
- func _on_enemy_body_enter(body):
- print("Collision")
- if (body.get_name == "Player"):
- print("Ouch!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement