Hello, 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
2 short questions, BGPUT 2, and DIM L0[0,0]
Root / Programming Questions / [.]
Jack_AkkiartoCreated:
PUSH 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.
Thanks 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?
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.
Thank you very much, that was really helpful and solved the problems.
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