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

Tutorials for beginners

Root / Programming Questions / [.]

SmileLRMCreated:
Hello. I'm new to SmileBASIC and coding in general. I'm wondering if anyone has any links to good tutorials. I'm especially interested in learning how to control a character. I've already read the in game manual so I know the basics but it doesn't cover this. Any help is appreciated.

You can check the resources to see if there are any pages with what you want, or other forum threads on the site. EDIT: found this sample code in another thread:
@LOOP
B=BUTTON(1)
IF B AND 1 THEN INC Y,-1
IF B AND 2 THEN INC Y,1
IF B AND 4 THEN INC X,-1
IF B AND 8 THEN INC X,1
CLS
LOCATE X,Y
PRINT "O"
VSYNC 1
GOTO @LOOP
It may seem a bit confusing what each command does but you can look those up in the instruction manual.

This works but I meant controlling a sprite. A character for a game.

This works but I meant controlling a sprite. A character for a game.
Learn about... SPSET SPDEF (Optional) SPOFS BUTTON() (For controls) Enter a command and press the question mark button to get a description of it. Something like this should work for controlling a character:
SPSET 0,0,0
@L
IF BUTTON() AND 1 THEN Y=Y-1
IF BUTTON() AND 2 THEN Y=Y+1
IF BUTTON() AND 4 THEN X=X-1
IF BUTTON() AND 8 THEN X=X+1
SPOFS 0,X,Y
WAIT 1
GOTO @L