LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

How do you use the circle pad?

Root / Programming Questions / [.]

GuzzlerCreated:
Yeah but it would be cool to impress people with other than programming and extremely high mathematical skills.

Those mathematical skills are nice. XD

Yep trig is hard

We're now like, three topics removed from the title of the thread but, yeah functions are defined with DEF. They have certain advantages over GOSUB blocks. The way the manual (well, the "Instruction List" on the website) organizes the info about DEF is a little confusing (but it's much more complete than it used to be!) Basically it wants to show that there are three ways to use it depending on how many inputs and outputs you have. DEF(1) gives an overview of all three types, then subsections (2) through (4) give examples of each type. There are apparently also sprite functions and BG functions, but I don't know anything about those. Once graphics get involved, I become a total novice.

I suck at graphics and sprites too lol. I guess DEF would be better in some situations, but for now I'm sticking sith GOSUB and RETURN.

We're now like, three topics removed from the title of the thread but, yeah functions are defined with DEF. They have certain advantages over GOSUB blocks. The way the manual (well, the "Instruction List" on the website) organizes the info about DEF is a little confusing (but it's much more complete than it used to be!) Basically it wants to show that there are three ways to use it depending on how many inputs and outputs you have. DEF(1) gives an overview of all three types, then subsections (2) through (4) give examples of each type. There are apparently also sprite functions and BG functions, but I don't know anything about those. Once graphics get involved, I become a total novice.
Ha! lol.

Ha what? lol

Ha what? lol
We're now like, three topics removed from the title of the thread but... That, Ha lol

Yeah it's pretty funny how quickly we can get off topic.

Yeah it's pretty funny how quickly we can get off topic.
Renames thread to "How do you use SmileBASIC?"

There's a nifty function for using the thumbstick to return button() values in the platformer game sample. The name escapes me but, I thought I'd throw that out there.

I see it in the source code. It's like this: DEF STKANDBTN() SLV=0.2 'the minimum the stick has to move in any direction BTN=BUTTON() 'takes button values STICK OUT SX,SY 'retrieves stick values IF (SY>SLV) THEN BTN=BTN OR 1 'makes it so if the stick is going up then BTN counts as an up press and so on IF (SY<-SLV) THEN BTN=BTN OR 2 IF (SX<-SLV) THEN BTN=BTN OR 4 IF (SX>SLV) THEN BTN=BTN OR 8 RETURN BTN END

OK, so now I know how to use it, I've made a minimalist code to move a sprite. Here it is:
X=178:Y=98
@LOOP
CLS
PRINT "CX",CX
PRINT "CY",CY
SPD=8
X=X+DA:Y=Y+DB
DA=CX*SPD
DB=CY*-SPD
STICK OUT CX,CY
SPSET 0,506
SPOFS 0,X,Y,-64
SPSCALE 0,3,3
WAIT 1
GOTO@LOOP

How to use the circle pad: 1: put your finger on the circle pad 2: move your finger around 3: dont forget to like comment and subscribe