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

Just random questions to help me make a game

Root / General / [.]

legofordmnCreated:
Is there a way to make an if then statement followed by another then statement?

Thera are more Ways to do this.
If "Insert condition" THEN
  If "Insert condition" THEN
     'insert code
  ENDIF
ENDIF

other way:

If "Insert condition" THEN
 'Insert Code
ELSEIF "Insert condition" AND "Insert condition" THEN
 'Insert Code
ELSEIF "Insert condition" OR "Insert condition" THEN
 'Insert Code
ELSE
 'Insert Code
ENDIF


Also, multi-line IF statements
IF CONDITION THEN
 PRINT"line 1"
 PRINT"line 2"
ENDIF

Also, multi-line IF statements
IF CONDITION THEN
 PRINT"line 1"
 PRINT"line 2"
ENDIF
oooh I love those I use them all the time

For conditions, you should use && and || rather than AND and OR. && and || are logical operators, whereas AND and OR are bitwise operators, which you usually don't want. It may seem like AND and OR work fine with conditions, because they give the same result when both sides are 0 or 1, but they can give surprising results with other numbers:
1 &&  2  '1
1 AND 2  '0

5 ||  0  '1
5 OR  0  '5
That said, sometimes you do want AND and OR, when you're working with bitmasks like BUTTON():
BUTTON() AND #A

Is there a way to increase the size of a sprite in increments when you are in a game? (Ex. You press a button, and it makes the sprite bigger in increments?)

Also, is there a way, where you would press a button and it would do one thing, but if you pressed the same button again, it would do something else?

Also, is there a way to move a sprite in increments when you push a button?

You should look at a variable tutorial. I know a good one: http://smilebasicsource.com/page?pid=404 Also, for increasing sprite scale and moving it, SPOFS moves it and SPSCALE scales it.

I thought it all had to be one line. I'm spoiled by the neatness of brackets in my code. This would've been so useful to know awhile back. Too late now. Finish what I'm working on and implement it in my next program.

How do I load, scale, and position a custom sprite?

'these are the placeholders i used for values in the examples below:
FILENAME, ID, DEF, X, Y, W, H, XF, YF

LOAD "GRP4:FILENAME",0 'loads a GRP named FILENAME into the fourth graphics slot, which is used as the spritesheet by default
'the ,0 makes it so there is no confirmation dialog (just remove it and you'll see)

'there are two main ways to create a sprite:
SPSET ID,DEF 'initializes the sprite <ID> and sets it to <DEF> definition number
SPSET ID,X,Y,W,H 'initializes the sprite <ID> and sets it to the region of the spritesheet defined by <X,Y,W,H>
'sprite ids are the number used to refer to the sprite for operations like scaling and positioning
'sprite ids range from 0-511 by default

SPSCALE ID,XF,YF 'scales the sprite <ID> by a factor of <XF> horizontally and a factor of <YF> vertically
'the scaling factors can't be less than 0, but 0 itself might be fine (i don't remember)

SPOFS ID,X,Y 'positions the sprite <ID> at the position <X,Y>
'the sprite's position is at the upper-left corner of the sprite
'the top screen is 400x240, and coordinates start from 0 on the top left

Is there a program or something that takes the QR code of a Petit Computer game, scan it, and program it into a code or game for SmileBasic?

Is there a program or something that takes the QR code of a Petit Computer game, scan it, and program it into a code or game for SmileBasic?
I don't think so, but people have made SB clones of petit computer games.

Is there a program or something that takes the QR code of a Petit Computer game, scan it, and program it into a code or game for SmileBasic?
There’s a PTC to SB Converter

Is there a program or something that takes the QR code of a Petit Computer game, scan it, and program it into a code or game for SmileBasic?
There’s a PTC to SB Converter
I believe there's also a PTC interpreter for SB

So, I am trying to recreate the VERY first of Minecraft on the 3DS, but I am not a professional at coding, so I was wondering if you guys could help me. I have currently made it so you can place stone blocks, but I want the blocks to move when I push a button. Could you guys help me with this? I have a picture of the code I have written so far, and I have a video showcasing the issue I'm experiencing. Video Link of game footage: https://youtu.be/6awom9GkGm4

I would help but the video won't load on my 3DS :(

Rando, you could use a computer to watch it. Just saying.

Rando, you could use a computer to watch it. Just saying.
And what if he doesn't have a computer to access it? Just saying.