プレイ日記
Aaron Krondelo
What is the best way to detect the player position during a button push. My logic seems right but why isn't this working? It's like it's not even registering the button.
1そうだね
プレイ済み
返信[1]
親投稿
Aaron Krondelo
Oops, the screenshot should have this code after the button push IF: IF X==21 AND Y==12 THEN INC KEY1. Combining all of that into one statement didn't work either.
0そうだね
プレイ済み
返信[2]
親投稿
Oscar PwnageBlock
AND is a logical gate that operates over two values, placing a 1-bit over all positions where both values have a 1-bit. AND should only be used in conditionals when working with BUTTON input. For conventional conditional statements you should use the && operator. This one evaluates as true as long as the two expressions it joins also evaluate as true.
0そうだね
プレイ済み
返信[3]
親投稿
Oscar PwnageBlock
This means that your IF statements should look like this... IF X==21 && Y==12 THEN 'DO SMTH If you want to use button input at the same time you have to isolate the logical gates from the logical operators... IF (B AND #A) && KEY1==0 THEN 'DO SMTH
1そうだね
プレイ済み
返信[4]
親投稿
Aaron Krondelo
Ah! I knew about using bit-wise operators in Java, but I didn't think about using them in Basic..Doh! Also that parenthesis part for button input is perfect thankyou! Oddly enough I got it working with AND in a nested IF statement.
0そうだね
プレイ済み
返信[5]
親投稿
Aaron Krondelo
Just for illustrative/educational purposes. Here are two methods with identical results.
0そうだね
プレイ済み
返信[6]
親投稿
Alex MrCashews
AND has higher precedence than &&. In fact, && and || have the lowest precedence on the operator table, probably on account of their shortcutting. The parents around the AND shouldn't be necessary, unless I'm missing something.
1そうだね
プレイ済み
返信[7]
親投稿
Aaron Krondelo
Thanks Alex, suppose I could test it.
0そうだね
プレイ済み
返信[8]
親投稿
こうやま kouyama1435
At first,you have to move colum to see easier. for example: IF A==1 THEN IF B==1 THEN (commands) ELSE (commands) ENDIF ELSE (commands) ENDIF
0そうだね
未プレイ