Working on a state machine and I am having a little difficulty understanding why calling super() that returns an int, doesn’t finish or return but keeps processing code below it.
So, if the extended class calls super(), but in the super class it returns, why does code below super() in the extended class process? Thanks in advance.
Calling super() from the child (extended) class to the parent (base) base class is no different than calling any other method in your game.
That is, it calls the method, does its job and returns. That’s why after calling super() the code in your extended class is executed. It’s just another method.
You are just calling the inherited version of the function via the super comand. If you don’t intend to execute the extended class function, remove it from the extended class. And don’t override the function. Just call the function directly.
So in IdleState’s physics_process, super() is called and executed returning 0, and that’s it, not storing it in a variable or anything. For some reason I was expecting it to return there back to its parent. CS Major junior year brainfart
I believe you may have thought like me that super() was taking the code from the base class and append it directly in the current function, this way the function would take into account the return statement, or would keep declared variables in the same scope . But super() is just a simple call of the base class function with the same name.