Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

A Dark Room-esque Tilemap

I'm struggling to get a map like that of A Dark Room's. Can anyone help explain to me what i need to do to get something similar?

IMG_1395.JPG 193.3K

Comments

  • dave1707dave1707 Mod
    Posts: 6,230

    This just creates a map of , . Not sure the conditions of the other characters. You would just put them in the table tab at some tab[x][y] values.

    displayMode(FULLSCREEN)
    
    function setup()
        tab={}
        for x=1,37 do
            tab[x]={}
            for y=1,40 do
                tab[x][y]=","
            end            
        end    
    end
    
    function draw()
        background(40, 40, 50)
        fill(255)
        for x=1,37 do
            for y=1,40 do
                text(tab[x][y],x*20,HEIGHT-y*20-50)
            end
        end
    end
    
  • Posts: 449

    --# Main -- Ascii Map function setup() map = [[ .......... ....@..... ~~~.....,, .~~~..,,,. .......,,. ]] end function draw() background(40, 40, 50) translate(WIDTH/2, HEIGHT/2) local i = 0 for char in string.gmatch(map, "[^\n%s]") do local mod = i % 10 local x = mod == 0 and 0 or mod * 20 local y = math.floor(i / 10) * 20 i = i + 1 text(char, x, -y) end end
  • dave1707dave1707 Mod
    Posts: 6,230

    You could also do this, similar to @se24vad .

    displayMode(FULLSCREEN)
    
    function setup()
        font("Courier")
        textMode(CORNER)
        tab={
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        "..........:::::::::::::,,,,,,,,,,,,,,$$$$$$$$$$$$&&&&&&&",
        "..........:::::::::::::,,,,,,,,,,,,,,$$$$$$$$$$$$&&&&&&&",
        "..........:::::::::::::,,,,,,,,,,,,,,$$$$$$$$$$$$&&&&&&&",
        "..........:::::::::::::,,,,,,,,,,,,,,$$$$$$$$$$$$&&&&&&&",
        "..........:::::::::::::,,,,,,,,,,,,,,$$$$$$$$$$$$&&&&&&&",   
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        ",,,,,,,,,,,,..........;;;;;;;;;;;$$$$$$$$$$$$$,,,,,,,,,,",
        }
    end
    
    function draw()
        background(40, 40, 50)
        fill(255)
        for y=1,#tab do
            text(tab[y],100,HEIGHT-50-y*30)
        end
    end
    
Sign In or Register to comment.