void Unpress(int button)
This important function is used when you have handled a button press event and are ready for the engine to not show it as being pressed any more. After calling Unpress() for that button, the button will be read as being released. It will not read as being pressed until the user presses the button again.
This is most commonly used for buttons that operate as events, rather than states. For example, normally the [left] button will make a character be walking as long as it is pressed down. But if [left] is being used to control a menu cursor, you do not want to move the cursor left for as long as it is pressed (otherwise you will whiz across the menu in a split second). You may want to require each movement in the menu to be a separate press of the [left] button. In this case, you would use Unpress() after you did each movement.
I have made this sound more complicated than it is. Just look at the example.
This table shows the values to be given to unpress for each of verge's logical buttons. If you want to unpress left, you would use Unpress(7).
Numerical Value | Button Unpressed |
0 | b1 through b4 |
1 | b1 |
2 | b2 |
3 | b3 |
4 | b4 |
5 | up |
6 | down |
7 | left |
8 | right |
9 | b1 through b4 and all directionals (available on versions >= r251 (Oct 11, 2008)) |
if (b1) { Confirm(); Unpress(1); }
Talkback #2 written by Technetium on 2012-01-05.
Note that you CANNOT use key[] scan codes with Unpress. It only works with button values. Not only that, but the following code will NOT work:
if(key[SCAN_DOWN]) { //code to move a menu pointer down unpress(6); }
Talkback #1 written by verge-rpg.com on 2012-01-05.
This is the talkback thread for the documentation page: unpress
Doc Nav |
Your docs |