プレイ日記
BBB agaaron
Is it possible to poll multiple buttons each frame using this method? In testing it, only the top conditional is registering meaning I've only access to the 'up' button. Thanks in advance for any advice!
1そうだね
プレイ済み
返信[1]
親投稿
こうやま kouyama1435
A Hint. Binary"00000001" -> Hexadecimal"1" -> Decimal"1" -> #Up Binary"00000010" -> Hexadecimal"2" -> Decimal"2" -> #Down Binary"00000100" -> Hexadecimal"4" -> Decimal"4" -> #Left Binary"00001000" -> Hexadecimal"8" -> Decimal"8" -> #Right Binary"00010000" -> Hexadecimal"A" -> Decimal"16" -> #A What's about Next "#B"?
0そうだね
未プレイ
返信[2]
親投稿
Hanzo rzsense
You should consider priority of operators. "==" is prior to "AND".
0そうだね
未プレイ
返信[3]
親投稿
Hanzo rzsense
I recommend you to modify IF statements as follows. IF(BUTTON(0)AND #UP)!=0 THEN The same is true of #DOWN, #LEFT and #RIGHT.
1そうだね
未プレイ
返信[4]
親投稿
BBB agaaron
Thank you very much both kouyama-senpai & Hanzo for your very helpful input! Yes, it looks like I will divide from largest to smallest as I have in the past ;c these hashtags are not as much of a shortcut as I was thinking, they just equal out to the raw values.
0そうだね
プレイ済み
返信[5]
親投稿
Kl'Dck Hul HissingToaster
The thing everyone is missing here, is the truth-iness of those values. Anything that is not 0 will be considered true in an IF statement. TRUE the keyword is just 1. So the top IF is working because 1==1. you just need: IF BUTTON() AND #DOWN THEN
1そうだね
プレイ済み
返信[6]
親投稿
BBB agaaron
Oh damn, as simple as treating both sides as complete conditionals, eh? After I already reorganized the whole thing, hah! I will remember, but it's okay as it is now as it all works accordingly. :3 Thanks! As always, you're an indispensable help Kl'Dck.
0そうだね
プレイ済み
返信[7]
親投稿
こうやま kouyama1435
Too simply sample for biginners. B=BUTTON() IF B==1 THEN (Code of moving Up) IF B==2 THEN (Code of moving Down) IF B==4 THEN (Code of moving Left) IF B==8 THEN (Code of moving Right) IF B==16 THEN (Code of moving Shoot or Jump) This pattern is enough to make and use a simple game! I also used this when I was biginner.
1そうだね
未プレイ
返信[8]
親投稿
BBB agaaron
Thank you for your input Kouyama, beginners should simply take into account that this kind of setup is not good for multiple button presses, but it's great for getting your game off the ground!
0そうだね
プレイ済み
返信[9]
親投稿
Kl'Dck Hul HissingToaster
This setup works for multiple button presses if you use the boolean operation AND. Button() is a binary number where each position is a button. ANDing that with a button ID (think binary) will match if both have a 1 in the same position. You can do mulitples by introducing OR. 01 OR 10 is 11 because there is a 1 in one OR the other of the numbers. So: IF BUTTON() AND (#A OR #X) THEN
1そうだね
プレイ済み