Sorry folks, I should know better than throwing out random information and expecting some assistance.
I think I figured out the answer to my above question during my travels. Scaling is something that I have a hard time wrapping my head around, so I’m adding that to my to-do list.
I’ve been messing around with the Pathfinding Demo code info, and I like the maze it creates. However, trying to get the code to recognize custom .pngs as assigned to cells of 1’s and 0’s is proving difficult. In other words, I would like to assign images instead of color to the cells generated. I have no doubt I’m missing/breaking something rudimentary, but a helpout would be much appreciated.
Here’s my test code, thanks!
[code]display.setStatusBar(display.HiddenStatusBar)
– constants to fiddle with
local kRoadProbability = 6 – number between 0 and 10 with 10 being a lot of roads and 0 being none
local kLevelRows = 35
local kLevelCols = 25
– our map to be generated –
local level = {}
– table contains display.newRect objects –
local cells = {}
local cellWidth = display.contentWidth / kLevelCols
local cellHeight = display.contentHeight / kLevelRows
– builds our grid –
function buildGrid()
– build map array –
for x = 0, kLevelCols do
level[x] = {}
for y = 0, kLevelRows do
local probability = math.random(0,10)
if probability <= kRoadProbability then
level[x][y] = 1
else
level[x][y] = 0
end
end
end
– build screen now –
for x = 0, kLevelCols do
for y = 0, kLevelRows do
local cell = display.newRect(x*cellWidth, y*cellHeight, cellWidth, cellHeight)
cell.strokeWidth = 1
cell:setStrokeColor(0,0,0)
if level[x][y] == 0 then
cell:setFillColor(0,0,0)
end
if cells[x] == nil then
cells[x] = {}
end
cells[x][y] = cell
end
end
end
buildGrid ()
[/code]
[import]uid: 135394 topic_id: 24952 reply_id: 101682[/import]