In the code below I am trying to place multiple instances of the display group ‘tile’ into another group and then access the properties (x and y etc…) of each tile object. I’m pretty new to this and I’m not sure if what I’m trying to do is possible or if I just have the syntax ( board[2].x = 100 ) wrong?
Can anybody help with this? thanks
local colourFiles = { red = "red.png", blue = "blue.png", yellow = "yellow.png" }
local tile =display.newGroup()
local board = display.newGroup()
for key, file in pairs( colourFiles ) do
local colour = display.newImage( file )
tile:insert( colour )
tile[key] = colour
end
for i=1,3 do
board:insert(i, tile )
end
board[2].x = 100
board[2].yellow.isVisible = false
PS I dont think the code tag is working properly [import]uid: 3018 topic_id: 225 reply_id: 300225[/import]