So I have been developing a game for roughly the last two months and am nearing a finished product, however, I have hit a brick wall trying to implement a song selection menu.
The Basis: my game is meant to play, die and play again, so I do not want the gameplay to get repetitive from the music getting old (especially considering the way the game is designed, certain levels take more time to get past)
The Solution: My original problem was that my first idea to create a menu basically just sets one variable true and all others false and tells it what to go to if right arrow key is hit or left arrow key is hit (basically just forward and back) however, this worked occasionally but for the most part what I ran into was the process would jump past the desired variable and go to the end. Essentially because it would [on arrow key hit] go to next, go to next, go to next, etc... until the end as it would continuously set one the next variable to true onward through the list.
The only solution I have seen posted to create a menu that A) can be navigated through with the keyboard/touch controls and B) is in a cyclical loop so that it always refers to the next and previous song on the list (essentially just something that tells the game which item is selected and what items will be selected if either arrow key is triggered) requires a "For" statement that interferes with the music playing.
The Problem: The real problem lies in the fact that the only menu that seems to be possible to create in Construct relies on a "For each" statement. It relays two object's position to the console and determines what is selected based off its current position in relation to eachother. This leads to an issue though where every time the player cycles through the menu it plays the intended song, however, it repeats infinitely from the start (roll your tongue, it sounds like that) my theory is it is being interfered with by the "For Each" statement that the menu relies on causing it to select the song over and over repeatedly from the beginning
(example of the code for the menu above)
The way that the song selection actually works is I essentially just paired the song selection with said menu option and made the menu invisible. So using the same idea as before, if ___ is selected in the menu, then ____ song is activated (set songpic animation to ___ frame, set song__ variable to true, set song__ variable to false x2 (for both the song before and the song after))
So basically, what I'm really wondering and hoping for here, is there a way to make a cyclical menu that one can control with the keyboard/touch input that doesn't rely on a "For" statement? I'm not sure how this would be accomplished as you assumably need the "For" statement to test the position of the marker to the menu item, and from what I have found, that is the only way to make a menu like this.
P.S. section: I will mention, as I said above, the original solution did work occasionally, however, it was odd and hard to pinpoint what was working and what wasn't. But for the sake of trying to come up with solutions I will attempt to explain the best I can.
On one attempt, I finished the menu by having 13 different songs to choose from, if you were on or otherwise (global variable) SongOne is true, then set SongTwo to false and SongThirteen to false, if on SongTwo is true then set SongOne and SongThree to false, if SongThree is true then set SongTwo and SongFour to false, so on so forth through the whole list so that the previous and next song would always be set false once you arrive on the selected song (this prevents overlay from the previous song). Then I simply set it so if the SongSelectionMenu (also global variable) menu is true (activated if you select it from the pause menu ((that section works fine))) then set SongOne to true.
Now here's where it gets weird, first the menu worked perfectly as intended if you were to only go back through it (IE 1,13,12,11,10,9,8,7,6,5,4,3,2, and 1), however if you went forward on it it would always go back to 1, and more-so if you were on 1 it would always skip to 13 if you were to attempt to go forward one song.
On another attempt, none of really worked (this was for a different menu but same concept in the problem I was facing) however, this time I set it so that it only activated the Song__ variable IF BOTH the other two variables were also false. That didn't really work, but then I started deleting different conditions in various patterns and undoing them until something worked, AND IT DID! somehow...
I don't really get it but with a strange combination of If true AND also if ____(s) false conditions the menu went through three selections (out of four) correctly, for some reason the fourth was disabled. However I had a power outage and was neither able to save the work nor continue testing why that solution was working.
So Hopefully maybe these last few notes can maybe get the ol' brain juices flowing for anyone looking to help me create a new way to make a menu in Construct, or hopefully maybe someone knows something I don't. I'm only a novice when it comes to programming.