hello guys, i have a doubt about the create event and ways to update variables with new values.
well, I'm trying to create a system that passes information between instances and, I modified and updated its variables, however, when I was creating the system (I tried it in many ways, even with a step event) I realized that no matter what I did, the variable always came with original value (code below for better explanation):
explaining how the code works: I create an object that when it is created in the room, it creates the player's obj and then sends the variable information, and one of them is from hp. I would like to know why the value is always reset even if I ask or pass the modification information? I appreciate any help
NOTE: hp is zero in the player's create (actually obj_entidadee_player, which I created and only people that he is the son of obj_player)
well, I'm trying to create a system that passes information between instances and, I modified and updated its variables, however, when I was creating the system (I tried it in many ways, even with a step event) I realized that no matter what I did, the variable always came with original value (code below for better explanation):
GML:
//create event
//fighter life
hp_lutador = 64;
var player_lutador = instance_create_layer(x,y,"player",obj_player);
player_lutador.hp_max = hp_lutador;
explaining how the code works: I create an object that when it is created in the room, it creates the player's obj and then sends the variable information, and one of them is from hp. I would like to know why the value is always reset even if I ask or pass the modification information? I appreciate any help
NOTE: hp is zero in the player's create (actually obj_entidadee_player, which I created and only people that he is the son of obj_player)