How to make levels with more values than 0 or 1

I don’t feel like I should ask anything about code. It always feels like I’m stealing, but I’ll ask anyway.

I’m trying to remake a game called Secret Collect: http://www.homestarrunner.com/sbcollect.html

I don’t know how to make the levels, though - or at least, how to interpret them. I can make these sorts of things:

{{1,1,1,1,1,1,1,1}, {1,2,1,1,0,1,1,0}, ... etc

But I don’t know how to tell Codea that I want, say for instance 2, to be the player, and 1 to be the walls.

Does somebody mind helping me? It would be much appreciated.

Do you have a link to the source code? I’m not familiar enough with the game to help.

There is no shame in asking about how someone might implement things.

I doubt SecretCollect was done with a map like you describe - I suspect it was simply a list of types of rectangles, and the flash collision detection. You’d have to do all of that yourself, there’s no collision detection in Codea (yet!).

One of the example programs (I forget the exact one - my ipad is currently being held hostage by my 3-year-old. It’s the one with the “Hero” class) does exactly what you describe above - I’d take a look at that for starters.

In a nutshell, to do what you’re doing, you might have a part of draw() that looks like this (assume your table of tables above is called “level”):

   for i=1, #level do
      row = level[i]
      for j=1, #row do
         t = row[j]
         sprite(spritelist[t], j*25, i*25)
      end
   end

somewhere in setup(), you’d have

   spritelist = { "blank", "safewall", "bouncewall", "diewall", "secret" }

That’s the list of the sprites (or whatever) you wanted to draw on each square. If you weren’t using sprites, you might simply have colored rectangles, and replace the sprite() call in draw with “color(spritelist[t])” and a rect() call.

I hope this makes sense. Viva el Strongbad!