トピック
Caesar Caesar267

Button controls-Teach me please!

My name is Caesar. I've been doing smileBASIC for a while and I would like to learn button controls. The problem is I don't know where to start. Could someone please teach me? Thank you! I appreciate any help I can get.
0そうだね
プレイ済み
返信[1]
親投稿
TN21 Trinitro21
BUTTON(number) returns the button code. It's a binary value, with bits corresponding to buttons. 1 for up 2 for down 4 for left 8 for right 16 for A 32 for B etc... But SmileBASIC also includes constants such as #UP, #DOWN, #A, and #L that store these button codes, so you don't have to memorize them if you don't want to.
0そうだね
プレイ済み
返信[2]
親投稿
TN21 Trinitro21
You can put IF BUTTON(0)==1 THEN PRINT "UP" into your program, but it won't trigger when you press multiple buttons. Because the number is binary, you can write IF BUTTON(0) AND 1 THEN PRINT "UP" and it will trigger even when you're pressing multiple buttons. The number inside the parentheses is 0-pressed 1-moment pressed with repeat 2-moment pressed without repeat 3-moment released
1そうだね
プレイ済み
返信[3]
親投稿
TN21 Trinitro21
Pretty much just write IF BUTTON(0) AND #button and you'll be fine.
0そうだね
プレイ済み
返信[4]
親投稿
Caesar Caesar267
Thanks so much! Do you have any idea how to make sprites move using the circle or plus pads? I think I may have an idea, but if you could help me with that I think it would save time and frustration. What I'm not sure how to do is make a sprite go somewhereand from that point, move in a different direction. Thanks again! You've already helped me advance a ton! BTY, when I understand how to do
0そうだね
プレイ済み
返信[5]
親投稿
Caesar Caesar267
button controls and moving sprites. Do you mind if I make an explanation (with example program)? And if I use parts of your explanation, do you mind if I put your mii name in the credits? Thanks again! Happy programming!
0そうだね
プレイ済み
返信[6]
親投稿
Luis SuperChato15
i have made a sprite movement explanation a little while ago, just search on it from my profile. I also have other posts on How To's and what not if your interested
0そうだね
プレイ済み
返信[7]
親投稿
Caesar Caesar267
Thanks, Luis! I really appreciate the help! I can't wait to start using this!
0そうだね
プレイ済み
返信[8]
親投稿
Caesar Caesar267
Hi, Luis! Thanks for the tutorial. I understand button controls! Good luck with your programming! Picture: I discovered screen-edge teleportation. The AI hates me.
0そうだね
プレイ済み
返信[9]
親投稿
Caesar Caesar267
Hi, again! I have a two questions for you, Luis (or anyone who can help). 1. What is VSYNC and how does it work? 2. I noticed in the part of the code (in Luis's prg) where it says how far a sprite moves it has" Y=PY+Y*2+J." What does the J do? 3. How does SPHIT work? Thanks so much! I appreciate all the help!
0そうだね
プレイ済み
返信[10]
親投稿
Caesar Caesar267
Sorry. Meant 3 questions.
0そうだね
プレイ済み
返信[11]
親投稿
Luis SuperChato15
np, going around mii verse and helping people start up :]
0そうだね
プレイ済み
返信[12]
親投稿
Luis SuperChato15
vsync is like the frame rate, 1 is the best and lowest value. higher values runs the prg at slower pace.
0そうだね
プレイ済み
返信[13]
親投稿
Luis SuperChato15
Q.2] jumping was originally going to be in the tutorial but i left that out because i wanted it to be top down later on the development. I completly forgot to remove Jumping completely :p
0そうだね
プレイ済み
返信[14]
親投稿
Luis SuperChato15
Q3] sphitsp is the command used for sprite collision. before you add the command sphitsp, make sure to call spcol[#] first on both sprites you want to have collisions with. then you call sphitsp and set it = true and then GOTO/GOSUB @[loop]. if both sprites do collide the it will go to the @[LOOP]
0そうだね
プレイ済み
返信[15]
親投稿
Caesar Caesar267
Thanks, Luis! I appreciate the help! I'm glad that you're helping people. I've been trying, but I need more experience first. So, thanks again and keep up the great work!
1そうだね
プレイ済み
返信[16]
親投稿
Luis SuperChato15
thanks :3
0そうだね
プレイ済み
返信[17]
親投稿
Caesar Caesar267
Closing this discussion. Thanks, everyone!
0そうだね
プレイ済み