'Burnable' "Interface"
I’ve created a ‘burnable’ “Interface”
item.is_burnable
along with an enum “Primary Material” so that anything wooden that gets thrown in the fire will burn.
In oop world, one way to achieve multiple inheritance is to define an abstract type that defines behaviors as method signatures. The interface is “what methods can I call on this object that implements this interface”. I can define an interface named
Pet
that says “any class that implementsPet
must have the functionswalk()
,eat()
, andpet()
. So classDog
andCat
canimplement Pet
.
By “oop”, i mean “Object Oriented Programming”
however, gdscript doesn’t support interfaces. gdscript uses duck-typing so i “implement interfaces” the duck typed way.
if object.has_method("method_name"):
do the thing
not shown in demo: a burnable that is not a FireWood will not start a fire
valid FireWood items are "stick_bundle", "wood_fence", "wood", "lumber"
Get Camp Fire Craft
Camp Fire Craft
Multiplayer survival game where teams compete to earn badges while camping
Status | In development |
Authors | GomaGames, kellishouts |
Genre | Survival |
Tags | Crafting, Godot, Multiplayer, Team-Based, Top-Down |
More posts
- Synchronizing Multiplayer Game State - ⛺️ 🏃♂️Mar 19, 2022
- Multiplayer LobbyMar 06, 2022
- 🚀 build-220226bFeb 27, 2022
- SinglePlayer Level Design - Process time lapse videoFeb 24, 2022
- Game Title and Sketches for brandingFeb 20, 2022
- 📘 Scouts Handbook UI 📘Feb 19, 2022
- 🦊 ⛺️ Foxes can destroy tents ⛺️ 🦊Feb 19, 2022
- 🔨📦 New Animations 📦🔨Feb 19, 2022
- Updated Animations 🪓 ⛏️Feb 19, 2022
- Netcode Update - InventoryFeb 19, 2022
Leave a comment
Log in with itch.io to leave a comment.