Trying to find out how to make actions happen (keybind) by pressing a button using BASIC. But it's hopeless, so I was hoping someone on Miiverse can teach me.
This is a short example to handle button input. You need to use the button variable and the button constant(or the value of it) to detect the input.
VAR B
WHILE TRUE
CLS
B=BUTTON()
IF B AND #UP THEN ? "UP"
IF B AND #DOWN THEN ? "DOWN"
IF B AND #LEFT THEN ? "LEFT"
IF B AND #RIGHT THEN ? "RIGHT"
IF B AND #A THEN ? "A"
VSYNC 1
WEND
Thanks for the tip man. My next question is: How do you make it that a statement is no longer true? Take a look at my program;i'm trying to make it that if you press A when you're on the title screen, it will clear the screen and start a game. The problem is, the loop tells the computer to CLS anytime the A button is pressed. Can you give me pointers?
(any variable) = TRUE
WHILE (the variable) == TRUE
B=BUTTON()
IF B==#A THEN
(whatever happens if you press A)
(variable) = FALSE
ENDIF
WHILE (variable) == FALSE
(button inputs for the rest of the game)
WEND