Trying out Unity's open source brother "Godot"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
380 B

extends RigidBody
var life_span = 0
func _ready():
set_contact_monitor(true)
set_max_contacts_reported(5)
set_fixed_process(true)
connect("body_enter", self, "on_hit")
func _fixed_process(delta):
life_span += delta
if life_span > 5:
print("removed shot")
remove_and_skip()
func on_hit(other):
# cannot remove node right here as this would break exec
life_span = 5