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?
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
--# 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, "[^\
%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
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