0 votes

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.

in Engine by (57 points)

1 Answer

0 votes

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

get_parent().DAMAGE

or from child nodes with:

get_child(x).DAMAGE

http://docs.godotengine.org/en/latest/classes/class_node.html

by (129 points)

How should I execute this?

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 Frequently asked questions and 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 [email protected] with your username.