Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Area2D
- var player_inside: bool = false
- var body2: CharacterBody2D
- func _process(delta):
- if player_inside == true && body2 != null:
- continous_detection(body2)
- func continous_detection(body2):
- if player_inside == true:
- for i in get_children():
- var a = Transform2D(0, i.global_position)
- var b = Transform2D(0, body2.col.global_position)
- var is_colliding = i.shape.collide(a,body2.col.shape,b)
- if is_colliding == true:
- print(i.shape)
- func _on_body_entered(body):
- body2 = body
- player_inside = true
- func _on_body_exited(body):
- body2 = null
- player_inside = false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement