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

How do I use DATA for backgrounds?

Root / Programming Questions / [.]

UltraPhoenix4Created:
I am making a game and I was looking at other games for inspiration and many of them had something like this:
DATA "0,1,1,1,0
DATA "1,0,0,0,1
DATA "0,1,1,1,0

The code was used for backgrounds as stated in comments. I looked through the code and couldn't figure it out. Any help is appreciated!

I saw this implementation in a mario game. All you had to do was place blocks (the text icon block) in the data, and it would put a physical block on the level, with collision included. I thought this was pretty impressive and I'm not sure how to do it either. It must take quite some setting up, but once you do you basically have a much simpler level editor.

Well, generally it goes something like this:
DIM MAP[5,3]
COPY MAP,@TOOLAZYTOMAKEABIGGERMAP
WHILE TRUE
FOR I=0 TO 4
FOR J=0 TO 2
BGPUT I,J,MAP[I,J]
NEXT
NEXT
WEND
@TOOLAZYTOMAKEABIGGERMAP
DATA 1,1,1,1,1
DATA 1,0,0,0,1
DATA 1,1,1,1,1
It basically works like any other DATA, but you use the data to create the map.

I'm getting a syntax error from running this...

Wait, on which line? If it's the second one, try putting the label in quotes. I was wondering if that was necessary, and it turns out it is.

I'm getting a syntax error from running this...
you forgot to indent.

I'm getting a syntax error from running this...
you forgot to indent.
You don't have to indent in BASIC.

Wait, on which line? If it's the second one, try putting the label in quotes. I was wondering if that was necessary, and it turns out it is.
Line 5.

I'm getting a syntax error from running this...
you forgot to indent.
You don't have to indent in BASIC.
:S, sorry

I'm getting a syntax error from running this...
you forgot to indent.
You don't have to indent in BASIC.
You don't have to indent in a lot of languages. You should indent for code readability. This applies to BASIC as well. It isn't the cause of the error, but in general proper formatting allows problems to be [fixed] more easily.

Well you at least get the point, right? My syntax isn't always the best off of SmileBASIC.

I'm getting error on 14 it says NEXT without FOR

Maybe this forum will answer your question: How do I create maps using DATA?