[SOLVED] Variable problem. Need solution

So here`s the store. I want to make floating menu when player press m , then the menu disappear
after player press menu again.
I use opacity for this one .
In this picture.
“Before” picture shows full logic that i came up with.
var menu = 0
if menu == 0 : set “MenuObject” opacity to 0;
if player press m (trigger once) : menu += 1;
if menu == 1 : set “MenuObject” opacity to 219;
if menu >= 2 and m release : set menu = 0; (goes back up)
The problem is even when the var menu is 1 the “MenuObject” still at 0 opacity. Its still at the
“if menu == 0 : set “MenuObject” opacity to 0;”
if i disable this ^ . the everything works fine (the after picture)

here in GDevelop is a powerful feature called: sub-event (see the wiki). this is help not only build your logic, but optimizing the performance. worth checking out!

this is something like your problem:

try to not put any other action in the main event, than the controller variable. use the sub events to execute all other actions.

It’s so good that it works

1 Like