Simple Menu Issues

Get help using Construct 2

Post » Thu Apr 26, 2012 7:02 am

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.

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




B
11
S
2
G
2
Posts: 26
Reputation: 2,974

Post » Thu Apr 26, 2012 8:29 am

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Thu Apr 26, 2012 8:43 am

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.Ugotsta2012-04-26 08:46:22
B
126
S
7
G
4
Posts: 185
Reputation: 7,233

Post » Fri Apr 27, 2012 12:06 am

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?
B
11
S
2
G
2
Posts: 26
Reputation: 2,974

Post » Fri Apr 27, 2012 12:22 am

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Tue May 01, 2012 3:56 pm

Thanks for the help. I got what I needed.bigpappapuck2012-05-01 15:57:38
B
11
S
2
G
2
Posts: 26
Reputation: 2,974


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests