![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Krasapan |
Here is the code below, it worked in version 3.2.3 but it stopped working for some reason. I think this may be due to the fact that I switched to the new version 3.3.3. Any way to fix this?
func bullet():
var bullet_instance = BULLET.instance()
bullet_instance.apply_impulse(Vector2(), Vector2(bullet_speed, 0).rotate d(rotation))
get_tree().get_root().add_child(bullet_instance)
yield(get_tree().create_timer(bulletDestroyTime), "timeout")
if bullet_instance != null:
bullet_instance.queue_free()
Error message: Attempt to call function 'queue_free' in base 'null instance' on a null instance.