|Topic was automatically imported from the old Question2Answer platform.
Hello everyone. I have two scripts, one of them defines a Character class and other extends the Character class and provides the code for the player. However, the Character script holds the movement variables for the player and I don’t want to change this.
How can I call the variable from the character script and modify it in the player script?
suppose you have the below two class definitions
#Player class (extends Character class)
parentVar=1 #we modifier the parent scripts 'parentVar' member, even if the variable isn't defined in the player class script
childVar=1 #we modify our child class's member
Above illustrates (in the
_ready function of the Player class) how we can access a member (
parentVar) of the parent script from inside the child class.
Does this help?