Normally don't comment much, but this tutorial really helped me get a quick grasp on what I wanted to understand about inheritance so I can use it how I want to use it for my game project. Instant Subscription. I'll be coming back for more tutorials :)
Hey thanks your tutorials are great! I know you dont have a huge number of subs but I hope you keep doing these great tutorials it is really helpful! Subbed!!!
This is a great tutorial! Thank you. Very informative. I'm wanting to learn a new engine for the course I'm taking at uni just to make me more "T-Shaped" I guess ahaha. I love inheritance in Unity for character controllers so this is perfect.
Update: in Godot 4.3 (I suppose from 4.0 onwards) the _ready function can be overwritten like any other function. In order to still call it, first call super._ready() in your child's _ready() function.
I'm glad you like the videos. I'm always trying my best to improve and have professional code, so it's great to here that. As far as GDNative, I haven't really done much with it at the moment, but it's definitely something I'll be looking into in the future. Maybe once I get a good grasp on it I'll try to see if I can do any good tutorial. Thanks for the feedback.
How do you inherit from an abstract base class like BaseButton and make it a concrete class? (I want to make my own button type which inherits BaseButton's features, but implement all the visual stuff myself as it's different from both the standard Button and TextureButton.)
As Arith metic already said, it is not possible with GDScript. (Thanks for your kind help in finding my way to a solution! :-) ) There seem to be 3 possibilities if you ever run into a situation like the one I had: 1. If the Button type you want to create is one that the world was waiting for - or if you're working on a complex project where it might be beneficial for other team members - you can create your Button type in C++ as a first class Godot citizen living besides all the other like TextureButton, ToolButton, etc. But for most types of projects this is overkill, including mine. 2. You can make a scene whose root is a regular Button, disable all the Godot default stuff by making it "flat", set a minimum size, etc., but still use the Button features you need like pressed and draw events, but implement the visual stuff yourself with other child nodes/controls. This is what I did for my current project and it worked great for my purposes. 3. If you want to avoid more of the default Button behavior or if your button type differs significantly, you could also base the new button type on Control and implement it entirely yourself.