global variables

Godot Version



Hello im really new to godot, Im trying to make a game, were when kill an enemy your
“monster journal” is updated with a new btn to show some information about the monster, so i have created a global variable enemy1_dead = false, and have taged it, into the enemy script and the journal but i cant work.
Am I tagging the var wrong ???
global script :

enemy script :

journal script:

thank you for your help :slight_smile:

In the enemy script, I wouldn’t clarify the var again.

Maybe remove

var en1_dead = (Death global)

Otherwise you should maybe see via print if the code works

I also do not know if the method is called, that could be a problem (might just be a pre-set method that gets called under certain condition)

Have you added your global script to the autoloader? Go to “Project” → “Project Settings” → “Autoload” and add your global script. Take a look at Singletons (Autoload) — Godot Engine (stable) documentation in English for more information.

1 Like