Skip to content

Commit f80ab37

Browse files
committed
adding destroy event
1 parent 3d509e2 commit f80ab37

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: readme.md

+12
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ func _draw():
7979
draw_rect(Rect2, Color, bool filled=true)
8080
```
8181

82+
## Destroy event
83+
84+
There is not an equivalent event for the **Destroy Event** but it can easily be coded in GDScript. Instead of destroying that node with the usual `queue_free()` you create a function called `destroy()` and execute some code before self deleting.
85+
86+
GDScript **destroy()**
87+
```gdscript
88+
func destroy():
89+
# Here you write whatever you want to
90+
# run before removing the node
91+
self.queue_free()
92+
```
93+
8294
---
8395

8496
# Globals

0 commit comments

Comments
 (0)