0 votes

I wanted to know if it's possible to extend a function, so that the new inherited function executed code from both the parent function and the new function.

For example, let's say I have a node with the function do_something() that does action x

What I want is to create an inherited node with the function do_something() being extended to do something more. so it would do action a as well as action b

Godot version 3.3.3.stable.mono
in Engine by (177 points)

1 Answer

0 votes
Best answer

Solved:

to create an inherited function which executed new code IN ADDITION to the previous code, call the parent function like this:

func do_something():
      .do_something()
      #additional code
by (177 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.