I am having issues coding a game, in terms of variables in objects. Whgen running i get this error
FATAL ERROR in
action number 1
of Step Event0
for object obj_text_demo_player:
Variable obj_gameManager.<unknown variable>(100020, -2147483648) not set before reading it.
at gml_Object_obj_text_demo_player_StepNormalEvent_1 (line 1) - if (obj_gameManager.ammo == 0)
and i have no clue hope to fix this, this is where the code is used.
obj_player (player - where the issue seems to be - STEP EVENT)
if (obj_gameManager.ammo == 0)
{
obj_gameManager.weapon = "MachineGun";
obj_gameManager.ammo = 50000;
};
obj_pickup (pickup object - COLLISION /W PLAYER OBJECT)
obj_gameManager.weapon = "Tri-Shooter";
obj_gameManager.ammo = 900;
Obj_gameManager (object variables are from - DRAW EVENT)
global.health = 100;
global.weapon = "MachineGun";
global.ammo = 50000;
draw_healthbar(787,181,1073,231,health,c_white,c_red,c_green,0,true,true);
draw_set_colour(c_blue);
draw_set_font(fnt_speach_new);
draw_text(780, 300, global.weapon );
draw_text(780, 375, global.ammo );
Any help would be massively appreciated, as I'm new to Game Maker Studio. If you need any more info I'm happy to add it.