Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends CharacterBody2D
- # Get the gravity from the project settings to be synced with RigidBody nodes.
- var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
- func _physics_process(delta):
- # Add the gravity.
- if not is_on_floor():
- velocity.y = gravity * delta
- move_and_collide(velocity * delta)
- func _on_area_2d_body_entered(body):
- if body.name == "Ball":
- print("hit")
- queue_free()
- func _on_area_2d_body_exited(body):
- if body.name == "Ball":
- print("hit")
- queue_free()
- func _on_area_2d_area_entered(area):
- if area.name == "Impact":
- print("hit")
- queue_free()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement