【发布时间】:2011-11-10 07:00:53
【问题描述】:
local xOffset = 0
for i = 1, levelPacks[prevCurrentLevelPack][prevCurrentLevel].ammount do
if i == 1 then --setup first one
shapesPrevArray[i].x = 30
shapesPrevArray[i].y = 41
shapesPrevArray[i].isVisible = true
end
if i > 1 then --setup the rest
--width of previous one plus the x value of the previous one to make them next to eachother.
xOffset = shapesPrevArray[i - 1].width + shapesPrevArray[i - 1].x
print("offset: " .. xOffset)
shapesPrevArray[i].x = xOffset
shapesPrevArray[i].y = 41
shapesPrevArray[i].isVisible = true
xOffset = 0
end
i = i + 1
end
i:2 width:60 x value:30 xoffset:90
i:3 width:40 x value:90 xoffset:130
i:4 width:50 x value:130 xoffset:180
i:5 width:70 x value:180 xoffset:250
谁能帮帮我?我不明白为什么这个位没有把它们隔开。
xOffset = shapePrevArray[i - 1].width + shapesPrevArray[i - 1].x
如果有人能解释为什么不这样做并指出我正确的方向,我将不胜感激。
谢谢。
【问题讨论】: