Cant choose different character after i go back to menu

M

Mark Francis

Guest
so im developing a fighting game and the only problem is i cant choose again a different character after the fight ends. Example i choose A for player1 and B for A.I and when the game ends theres a button in my room which will go back to my character_select room and when i choose again different character example i chose C for player1 and D for AI , A will go back to my fighting room and D working fine. i hope u all got my point sorry for my bad english . I HOPE U GUYS CAN HELP ME

PS. i use global variables. global.player = noone; global.enemy = noone;
 
V

VagrantWhaleGames

Guest
Global variables are persistent so make sure you aren't setting/resetting them unintentionally...Hard to say where the exact error is without seeing some code. For example, make sure you set those global variables up in the beginning of the game, not every time you go back to the character_select room.
 
M

Mark Francis

Guest
Global variables are persistent so make sure you aren't setting/resetting them unintentionally...Hard to say where the exact error is without seeing some code. For example, make sure you set those global variables up in the beginning of the game, not every time you go back to the character_select room.
i have this object that control global.player and global.enemy
in global.player create event heres my only code : instance_change(global.player,true);
in global.enemy also in creave event : instance_change(global.enemy,true);
 
V

VagrantWhaleGames

Guest
global.player should be a variable not an object. Ex. global.player = objPlayer0; global.enemy=objEnemy0;

///create event of control object
global.player=objPlayer0;

//create event of player
if(global.player != -1)
{
instance_change(global.player,true);
}

other then that, I think you still may be resetting the variable somewhere. In the future maybe using an array to store characters and their values and applying them to the player might be a good idea, i'm not the biggest fan of using instance change.
 
Last edited by a moderator:
Top