Okay, so I add a menu from the players entity… if check is pressed blaba add new menu to the world. However, I can’t seem to remove the menu with the same button without creating a new one
I tried
//Upgrade
if (Input.pressed(Key.D) && Upgrades_Menu.activated == false) FP.world.add(new Upgrades_Menu(FP.camera.x, FP.camera.y));
and in the upgrades menu entity, I have this code in the update function
if (Input.pressed(Key.D))
{
FP.world.recycle(this);
activated = false;
}
The problem is that immediately after it removes itself and sets activated to false, then the hero class adds a new one since it seems to be checking for the variable “activated” immediately after it is set to false in the menu entity. Any ideas on how to fix this? =P Such a simple task, yet so confusing!
(PS, Upgrades_Menu.activated is a static variable)