s

Why did we override a built-in function?

skullsy

You had mentioned previously how Godot 3, in the case of quite a few built-in functions, will run both the parent built-in function and the overriden built-in function of the script inheriting from the parent. With the way to solve this being refactoring the code into a custom function that we can override without issues.

But here, you override "_ready()" directly, as opposed to extracting the code into a new custom function, and then overriding that. Can you explain why you did this?

  • Nathan Lovato replied

    Because we want the parent Turret.gd script's _ready() function code to run, we don't want to replace it with new code. We just want to add more instructions to the original _ready() function, and Godot handles that for us.