Using arrow keys to move between menu options

Get help using Construct 2

Post » Thu Aug 30, 2012 7:44 pm

Hi, I'm back with another silly problem, no doubt. I want to have a classic menu cursor that moves between pre-set positions when you push Up and Down, but my cursor just wigs out and goes to the wrong coordinates if there's more than two options / choices.

That leads me to believe that they're in conflict; that all the "On down arrow released" events are firing off at the same time. My problem could be something else though, and either way I haven't managed to fix it or find the issue by searching.

Anyway, here's what it looks like:

B
9
S
2
G
1
Posts: 10
Reputation: 1,357

Post » Thu Aug 30, 2012 8:12 pm

if you want to change MainSelection variable by 1 and Y position by 10

Try this

+Keyboard: On Down arrow released -> Cursor: Set Y to Self.Y+10
                                  -> Add 1 to MainSelection

+Keyboard: On Up arrow released -> Cursor: Set Y to Self.Y-10
                                 -> Subtract 1 to MainSelection

ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Thu Aug 30, 2012 8:33 pm

That did it. Thanks a lot. Certainly way more elegant than what I was trying.

(And if the main selection ends up greater than my number of menu options, I can just set it back to 1, so my cursor will jump from the last choice back to the first. Or if it's less than 1, send it to the bottom of the list. Okay, cool.)
B
9
S
2
G
1
Posts: 10
Reputation: 1,357

Post » Thu Aug 30, 2012 8:37 pm

yes, exactly.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], benajad, Braus, R0J0hound and 25 guests