How do you use variables in scripts which are parented to other scripts with the same variable?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CardboardPow

I have a script called entity, all of my entitys (player and enemies) are parented to this script. my script uses contestants like DAMAGE and MAXHEALTH. to make the enemies and player have different stats they need to have the same constants. if I were to remove the constants from the entity script it would not work because the move and damage is done in the entity script. I already tried using variables such as export(int) var MAXHEALTH = 1. please help if you might know a solution.

:bust_in_silhouette: Reply From: aa

Your entities can read data from their parent node by using:

get_parent().DAMAGE

or from child nodes with:

get_child(x).DAMAGE

How should I execute this?

CardboardPow | 2020-01-04 04:55