Hi,
I’m making levels for my game but I have so many difficulties to understand all the table in lua, I can make appear all the objects but I can’t change their position individually ,
I can just move the whole group or get random position for all
How can I change the x and y of each object in all #Elements table ?
I would like do something like that but I know isn’t working :
Levels[1].Elements[1].x = 100
local Niveaux = 2 local allElementGame = {} local ShowElementLevel local ElementImages = {"Platform", "nuage"} -- Here in #Levels: Elements[1] is "Platform" and Elements[2] is "nuage" -- I want to change the x and the y of all the object in #Elements but I didn't success to reach them local Levels = { {Elements = {1,2}}, {Elements = {2,1}} } function ShowElementLevel (Niveaux) local level = Levels[Niveaux] local Elements = level.Elements for x = 1, #Elements do local Elementlvl = Elements[x] local Element = display.newImage("Images/Element-" .. ElementImages[Elementlvl] .. ".png") Element.name = ElementImages[Elementlvl] Element.Elementlvl = Elementlvl allElementGame[#allElementGame+1] = Element end end ShowElementLevel(Niveaux)