Advertisement
Jack_Prower

Check for null in loop

Jan 8th, 2022
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func collison_check():
  2.     if hurt_by_overlaps == false or ghosting == true:
  3.         pass
  4.     if hurt_by_overlaps == true and ghosting == false:
  5.         for body in suffocation_area.get_overlapping_bodies():
  6.             if body.has_collision == true:
  7.                 if body.get_tree().has_group("Wall"):
  8.                     if overlapping == false:
  9.                         if test_prints == true:
  10.                             print("Overlapping with " + body.Name)
  11.                         overlapping = true
  12.            
  13.             if body == null:
  14.                 if overlapping == true:
  15.                         if test_prints == true:
  16.                             print(Name + " is no longer Overlapping with " + body.Name)
  17.                         overlapping = false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement