Simple Menu Issues

0 favourites
  • 6 posts
From the Asset Store
A well commented template with list menus and shops to use in your top-down RPGs or metroidvania games!
  • Ive been hitting my head against the wall and cant seem to get this to work.

    I want to use the arrows keys to move from box to box both horizontally and vertically.

    I originally had a series of

    If yellow1 and left pressed, then move to purple1

    If purple1 and left pressed, then move to blue1

    If blue1 and left pressed, then move to yellow1, etc

    As you can see, this will turn into a significant number of code lines.

    In the name of efficiency, I tried setting up a while loop with instance variables that are both active and inactive. While active (=1), the cursor will scroll over them, While inactive (=0), the cursor will skip over them and head to the next instance.

    As it stands now, the cursor will cycle through all nine objects... I would like it to recognize columns and rows, but I cant figure out how to do it other than the original way it was set up.

    Any assistance would be appreciated.

    dl.dropbox.com/u/70332704/simple%20menu.capx

  • Commented capx.

    This solution proposes to consider the markers as cells of a grid, and navigate the cursor according to the position in the grid.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hehe, I was working on responding to this, apparently right as you were Kyatric.

    I was going to mention, there really are good number of ways to go about this one. I'll post my own method here as well, which involves adding row and column variables to the markers, as well as a row and column variable to the cursor. The cursor can then get to each marker via row and column designation.

    My proposed method takes more resources methinks, since the position is checked each tick. But it's just another method. :)

    simple-menu-alt.capx

    Edit: I just realized I used roughly the same method as Kyatric, I just didn't read through his example thoroughly enough before posting.

  • Thanks guys. This is much cleaner than what I had going.

    That said, I was hoping I would be able to alter this grid. Sometimes, for instance, I may have 5 in a list in one column, 3 in a list in another column, and maybe only 2 in a third column.

    Also, depending on actions taken in the game, one of the center pieces may disappear and reappear. I could, for example, flip a switch and the center piece disappears. In that case, I would want to the cursor to pass over the now missing piece, and adjust automatically to the next piece.

    Any thoughts?

  • Have a look at that tutorial it depicts several things about picking, maintaining/evolving a grid, arrays, etc...

    It might help you with some aspects of your question.

  • Thanks for the help. I got what I needed.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)