プレイ日記
KJ kandlestix
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.
0そうだね
プレイ済み
返信[1]
親投稿
raimondz raimondxz
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
0そうだね
プレイ済み
返信[2]
親投稿
KJ kandlestix
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?
0そうだね
プレイ済み
返信[3]
親投稿
Keem☆ MogamiAmpharos
You could use "WHILE a variable is true", then set the variable to false once you press A. Then use another WHILE loop for the game.
1そうだね
プレイ済み
返信[4]
親投稿
KJ kandlestix
@osaka What will that code look like?
0そうだね
プレイ済み
返信[5]
親投稿
Keem☆ MogamiAmpharos
(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
0そうだね
プレイ済み
返信[6]
親投稿
Keem☆ MogamiAmpharos
oh, you still need VSYNC too.
0そうだね
プレイ済み
返信[7]
親投稿
KJ kandlestix
What does VSYNC do anyway? I don't understand what it says in HELP.
0そうだね
プレイ済み