I’m trying to make a Towerfall like game in codea. To do this I need to be able to draw many blocks in different places. I’d rather not write each one myself, so if there is a fast way to do it(maybe with tables?) I’d really appreciate it.
@KidKoder Maybe this will help. You’ll have to change the size, the table, and use sprites instead of rects to make it how you want.
displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)
function setup()
size=50
tab={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1},
{1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1},
{1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
}
end
function draw()
background(40, 40, 50)
fill(93, 65, 33, 255)
for y=1,#tab do
for x=1,#tab[1] do
if tab[y][x]==1 then
rect(x*size,HEIGHT-y*size,size,size)
end
end
end
end
Sorry the name Towerfall is kind of misleading. Towerfall is a game like super smash bros in that you have platforms and walls and what not that you jump on and stuff.
Thanks I think this will help a lot.