Skip to content

Instantly share code, notes, and snippets.

@coelhucas
Last active November 26, 2019 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coelhucas/c21b9feb4318b23cc7b8563ef9dd9d13 to your computer and use it in GitHub Desktop.
Save coelhucas/c21b9feb4318b23cc7b8563ef9dd9d13 to your computer and use it in GitHub Desktop.
extents KinematicBody2D
var is_repelling: bool = false
[...]
func _process(delta):
if not is_repelling:
for i in get_slide_count():
var collision = get_slide_collision(i)
if (collision.collider.is_in_group("name")):
repel(collision)
func repel(collision: KinematicCollision2D) -> void:
var collision_body = collision.collider
is_repelling = true
# my knockback
# collision_body.repel(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment