I know it would be more helpful if I posted the link to the game, but I don’t want to reveal the game yet. It seems as though there are too many menus spawning when the player presses ‘B’, which in turn causes a bunch of other problems. I’ve tried to set variables to keep the code from getting repeated,
but it isn’t working. Again, I know it’s harder to help when there’s no game link, but I don’t want to reveal my game yet.
Try using a different function for each menu change it won’t fix the issue, but it might make it easier to understand the problem when things are laid out nicely instead of one big line
@Blobbey maybe you could share a screenshot of the relevant code but draw over it to redact the secret bits?
Okay, here’s the first bit.
Then, further down.
These are the parts of the code that the problem seems to be coming from. I’ve been using the console log to pinpoint bugs, and it seems that several parts of the code (menu and morph fruit subtraction) seem to be getting repeated more than they should. I hope this helps.
ah, thanks! that’s perfect.
the tile overlaps event that you’re using will fire for every frame that the sprite is overlapping with the tile. if you happen to hold the B button down for more than 1 frame, it’s going to end up spawning multiple menus. even worse, if the sprite is overlapping with multiple of those tiles (e.g. you covered an area with the tile) then it will potentially fire multiple times a frame and create even more menus!
luckily, it’s an easy fix. just create a variable named something like “isMenuOpen” and set it to true when you create the menu and false when the menu is closed. then you can check it inside of the overlap event and not open the menu if it’s still true. here’s a sample:
I thought that this code was supposed to take care of that.
hmmm… where do you set morph to true?