How do you properly explode an enemy? (Without freezing the main thread)

Here’s the core of how to use threads. This comes from a file I use as a central threaded object loader:


func _ready():
	m_nError = ResourceLoader.load_threaded_request(m_stPath)
	if m_nError != OK:
		print("Can't start the threaded load.")
	
func _process(delta):
	if !m_bDone:
		m_nError = ResourceLoader.load_threaded_get_status(m_stPath)
		match m_nError:
			ResourceLoader.THREAD_LOAD_INVALID_RESOURCE:
				fatalError.emit(self)
				queue_free()
			ResourceLoader.THREAD_LOAD_IN_PROGRESS:
				pass
			ResourceLoader.THREAD_LOAD_FAILED:
				fatalError.emit(self)
				queue_free()
			ResourceLoader.THREAD_LOAD_LOADED:
				var scene = ResourceLoader.load_threaded_get(m_stPath).instantiate()
				
				m_bDone = true
				loaded.emit(self,scene)
				queue_free()
			_:
				fatalError.emit(self)
				queue_free()