#1✎ 9Jack_AkkiartoHello, i have 2 short questions:
1.) Why can't i use BGPUT 2,0,0,5 to put a Tile in the second Layer? If i only write this line in a new program, i get an error, but if i replace the 2 with a 1 it works fine for the 1st layer.
2.) If i write DIM L0[0]:PUSH L0,7 ,the push function works fine, but if i use DIM L0[0,0]:PUSH L0[0],7 ,i get an error, can somebody tell me how to use push in a 2-dimensional array?
Thanks for every help
Posted
Edited
by Jack_Akkiarto
#2✎ 474SquareFingersPUSH only works on one-dimensional arrays (and strings). 2D arrays in SmileBasic are rectangular, not 'jagged', so even in principle, there's no way (in general) to push a single value to a 2D SmileBasic array.
I don't know BGPUT, I'll leave that question for someone else.
Posted
#3✎ 9Jack_AkkiartoThanks for the fast answer, but can you also tell me if there is a way to make a 2-dimensional array bigger after i created it?
Posted
#4✎ 144012Me21AdminSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfSecond YearMy account is over 2 years oldWebsiteThere is no way to resize 2/3/4-dimensional arrays, other than loading from a DAT file.
You can't resize a 2/3/4-D array in place, but what you can do is something like:
DIM ARRAY[10,10] 'make original array
DIM NEW[11,10] 'create new array. You can only easily resize the FIRST index
COPY NEW,ARRAY 'copy data to the new array
ARRAY=NEW 'replace original array with new array.
the BGPUT won't work because you're using XSCREEN mode 2 or 3, which assign BG layers 0 and 1 to the top screen, and 2 and 3 to the bottom screen. You have to use DISPLAY to switch to the lower screen, or you can change the number of layers on the upper screen with optional arguments to XSCREEN.
Posted
Edited
by 12Me21
#5✎ 9Jack_AkkiartoThank you very much, that was really helpful and solved the problems.
Posted
#6✎ 203JustGreatFirst MonthJoined in the very first month of SmileBASIC SourceWebsiteAvatar TabooI didn't change my avatar for 180 daysWebsiteNight PersonI like the quiet night and sleep late.Express Yourself
1.) Why can't i use BGPUT 2,0,0,5 to put a Tile in the second Layer? If i only write this line in a new program, i get an error, but if i replace the 2 with a 1 it works fine for the 1st layer.
If you have activated the bottom screen with XSCREEN, sprite and BG elements were divided amongst the two screens evenly. This means that BG layers 0 & 1 are on the top screen, and 2 & 3 are on the bottom screen. Check the help menu for XSCREEN to solve your issue.
EDIT: lol 12Me21 already answered this
Posted
Edited
by JustGreat