|Topic was automatically imported from the old Question2Answer platform.
Nothing jumps out at me as obviously wrong there (by eye), but
collider must be null. It shouldn’t be hard to find out what’s wrong by either 1) throwing in some print statements to see what’s going wrong or, better yet 2) just put a debug break point there and examine what’s in the variables…
From the docs
get_slide_collison returns information about the last call to
move_and_slide. From your screen shots, it’s not clear where
move_and_slide is being called or how you get into your
collision_effect method. Perhaps the collider instance has already been freed elsewhere in the code when you access it here?
Short of anything else, you should probably change to something like this:
if collider && collider.is_in_group("enemy"):
jgodfrey | 2020-03-07 15:13