![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Pedro Henrique |
Hi everyone,
i would like some explanation on how to call variables from different scenes and scripts into other. i’ve been trying to make a hit box dependant on stats changes,below is the code so far :
extends Area2D
var hit_direction = Vector2.ZERO
onready var stats_values = PLAYERSTATS
#variable acessed by all children nodes ( BOXES )
onready var damage = 1
func final_damage_value() :
damage = damage * stats_values.strength
func _physics_process(delta):
final_damage_value()
That’s a node (HITBOX) with a script of the same name, i’m trying to import variables from (PLAYERSTATS) in order to change “damage” variable wich is currently affecting the health of enemies.currently the damage set to 1 responds ok to the code, but i can’t make formulaes.
I’ve tried the option “Autoload” in project settings but its not working so far,been struggling to understand how it works on Godot, even though i read the documentation
THANKS for any help or explanation!