プレイ日記
Squidy matthew3737
How do i make a Beep play when the player presses a button? in this case, A.
7そうだね
プレイ済み
返信[1]
親投稿
Aaron Krondelo
Needs to be in a loop.
0そうだね
プレイ済み
返信[2]
親投稿
Squidy matthew3737
thx
0そうだね
プレイ済み
返信[3]
親投稿
Squidy matthew3737
it's still not working?
0そうだね
プレイ済み
返信[4]
親投稿
Christofer avalack
idk what im doing so dont kill me if im wrong but try if button() = #a then beep 10
2そうだね
プレイ済み
返信[5]
親投稿
Christofer avalack
*cough* *cough* if it used a real language like java i could probs help more *cough* *cough*
1そうだね
プレイ済み
返信[6]
親投稿
Your code is a little strange do you mean GOTO @LOOP instead of @LOOP? @LOOP is defining a checkpoint in code (a label) This code looks correct IF BUTTON() AND #A THEN BEEP 51 ENDIF Get rid of 051 and make it 51, in most languages like Java, putting a 0 before the number tells the compiler that that number is in the octal number system, I don't know if that's the case for SmileBASIC though.
1そうだね
プレイ済み
返信[7]
親投稿
@Christofer *cough* *cough* Java is spelled with a capital J Your code is almost correct, but typing IF BUTTON() AND #A THEN allows for multiple buttons to be pressed at once, because #A is a bitwise mask for 0b10000 (16) its a trick commonly used in Java to store up to 31 boolean values in a single number SmileBASIC is a fantastic language, that combines all sorts of programming tricks into a one
1そうだね
プレイ済み
返信[8]
親投稿
Aaron Krondelo
If you can do Java then Basic should be cake *cough*
0そうだね
プレイ済み
返信[9]
親投稿
Aaron Krondelo
Oh and even in Java you need == for comparison operator. Perhaps you just forgot.
2そうだね
プレイ済み
返信[10]
親投稿
Squidy matthew3737
AlgorithimZ: It's not working
0そうだね
プレイ済み
返信[11]
親投稿
Christofer avalack
A) yes i forgot about == and the lack of semi colons ect B) that post was wrighten goinig on like -3 days of sleep so i probs missed more than that. . . C) i was trying to help by saying that in basic, not in Java
1そうだね
プレイ済み