Using Enums in GDScript for Better Code in Godot 4
9.4 هزار بار بازدید -
پارسال
-
Enums in GDScript are a
Enums in GDScript are a great way to manage state and limited options for variables. This video goes over how to define them, use them, and work with them in the Inspector in Godot 4. The concept is illustrated by adding a fire state to a play that handles firing one bullet or two. An anti-example is provided, then the code is refactored to show the value of enums.
Source code: https://gist.github.com/brettchalupa/120e232aeb41914952745eff2a24fe80
Godot version used: 4.0
Donate as a way to say thank you: https://www.buymeacoffee.com/brettchalupa
Check out my games: https://brettchalupa.itch.io/
Subscribe to my newsletter: https://www.brettchalupa.com/newsletter
Chapters
https://www.seevid.ir/fa/w/DbR8KrQ6Ndc - Intro
https://www.seevid.ir/fa/w/DbR8KrQ6Ndc - Counter-Example Using a String Variable
https://www.seevid.ir/fa/w/DbR8KrQ6Ndc - Refactor to Using an Enum
https://www.seevid.ir/fa/w/DbR8KrQ6Ndc - Referencing an Enum in Other Scripts
https://www.seevid.ir/fa/w/DbR8KrQ6Ndc - Code Clean Up
https://www.seevid.ir/fa/w/DbR8KrQ6Ndc - Easier Testing
https://www.seevid.ir/fa/w/DbR8KrQ6Ndc - Outro
#Godot #Godot4 #GrowingWithGodot #GodotEngine
پارسال
در تاریخ 1402/01/31 منتشر شده
است.
9,454
بـار بازدید شده