00:00
00:00
Newgrounds Background Image Theme

KWYuri just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

As2 Navigating menu with buttons

340 Views | 1 Reply
New Topic Respond to this Topic

As2 Navigating menu with buttons 2014-12-31 07:51:48


Hi, I'm having a menu with three buttons. I want to be able to change which one is selected by pressing w/s buttons. I can't seem to find a way to make it work properly. Each button has two frames. First one is deselected button, and the second one is selected button.

My code looks something like this:

If a variable is equal to 1, button 1 gets selected. Whilst it's selected, if I press S button, the variable gets changed to 2
If variable is equal to 2, button 1 returns to normal, and button 2 gets selected instead. Whilst it's selected If I press S it changes variable to 3, and if I press W it changes variable to 1.

The problem with this setting is, that when I press S and variable changes to 2, it immedietely reads the line that tells it to change to 3, therefore buttons change really quick from button 2 to 3 or 1.

I can't seem to find any useful command that would execute script on moment of press of a button, not when it's just pressed. Is there such command? Or just a better solution?

Response to As2 Navigating menu with buttons 2014-12-31 08:25:25


Nevermind, solved it.