? Map DATA array with comas (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Map DATA array with comas

  • #1 ✎ 39 Joshuaham123 If you go to this page you will see a array with ASCII characters. I know there is a way to do this with numbers but also with comas so that you can do numbers larger than 9. Does anybody know a thread for this or a way to do this? Please help. If I didn't do a good job explaining then I can do try to do it better. Posted
  • #2 ✎ 197 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies You'll have to do it better I reckon. Do you mean like DATA? DATA 4,5,9,0,8,1,... Posted
  • #3 ✎ 39 Joshuaham123 Sorry. So I want to spawn a map in so that I can have a sprite move around on it. Dont worry about the sprite. I want it to be written with Data 4,58,1,82 Data 4,7,8,8 Data 5,7,57,4 Data 6,72,3,1 Similar to the one in the link but with comas. Posted
  • #4 ✎ 197 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies There is no link in your original post. Posted
  • #5 ✎ 39 Joshuaham123 http://smilebasicsource.com/forum?ftid=1279 Posted
  • #6 ✎ 39 Joshuaham123 sorry Posted
  • #7 ✎ 197 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies So, you want to use numbers in string format, though have their values be larger than 9? Do you need it to be in a string? Numbers and strings can become interchangable with VAL() and STR$(). The best way to store numbers with DATA, especially those larger than 9, is to store them literally, ex. DATA 4, 58, 1, 82. Posted
  • #8 ✎ 76 kitesinpowerlines Avatar Block I didn't change my avatar for 30 days. Website Avatar Embargo I didn't change my avatar for 90 days Website Avatar Taboo I didn't change my avatar for 180 days Website You could do something like this: VAR MAXH=5:VAR MAXW=5:DIM MAP[MAXH,MAXW] 'a small map for demonstration purposes RESTORE @MAP FOR I=0 TO MAXH-1 FOR J=0 TO MAXW-1 READ MAP[I,J] NEXT NEXT DrawMap DEF DrawMap FOR I=0 TO MAXH-1 FOR J=0 TO MAXW-1 IF MAP[I,J]==0 THEN BGPUT 0,I,J,'TILE IF MAP[I,J]==1 THEN BGPUT 1,I,J,'TILE IF MAP[I,J]==56 THEN BGPUT 2,I,J,'TILE 'etc NEXT NEXT END @MAP DATA 0,0,0,0,0 DATA 0,1,1,1,0 DATA 0,1,1,1,0 DATA 0,1,56,1,0 DATA 0,0,0,0,0 If you need to put BG tiles across different layers with one number, that is simple to do as well. 'In DrawMap function under nested FOR loop IF MAP[I,J]==4 THEN BGPUT 0,I,J,'TILE BGPUT 1,I,J,'TILE 'etc ENDIF You may have to play around with this a bit, I wasn't able to test it because I am away from my 3DS but it is very similar to the link you had mentioned but with numbers instead of strings. Posted